Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2785753rwr; Fri, 28 Apr 2023 16:15:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4bLfxY3T/xLg7/tvl/DvbMFDiaxEfd2Fsrox8xFZLv4QXYUbz3Jq+DSYUBdmsFp5kcPpq5 X-Received: by 2002:a17:90a:34c:b0:247:2baf:d6f with SMTP id 12-20020a17090a034c00b002472baf0d6fmr6219844pjf.0.1682723728561; Fri, 28 Apr 2023 16:15:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682723728; cv=none; d=google.com; s=arc-20160816; b=k6e8U424d1/StzoK+L7Xz6XDz2/HDpDPoEobqLkQr3DASC+0oXZYt8StBBwnNTAScH HbQ67gNAGf80019VhjYlEyjwEXyWCgpl6l0X+YjbomHgWjta0MDW/mQ9O/tkwOGrMDFF dlU8vN5ymLM6ttzMdVbQ/u9wJbiDF5TK2KV2r7OAMFhYkZuwOI8GnxRS1NBRcC6UQYEO Qy/pTFPgJ+ObE5N5mxaVxTrJYJJSpewKH9K8llg560cG3zkIotT3ZHYsv6dFSP7q6p8a vkBsSGd4j2/lNSA+jQ/XMfa9GqSmHgEpKnpLQ1fNvGcbgAxOlDEOHLw55b0nUQ/KNs9D KQMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=QF94rjS2z1vD5ApVZ2dn+CkuXnR8dw5vfvE0RTDVXh8=; b=lcEY3YUYt3sVSvqpbsHIkGDPfcXHE/FqPbQyVtAMclkcLPHjvdUuzCfLe804lvfCjM Qp8KXWZwF/sj+ggy+anC9HBbsxPVV7zhQYeNL+iKT3oWr0bFbjuFX736CMbF6XS2CL7w eCEAevmAfeYVNySxjE/veNubANjLBL84DcvFQCEhiHti+Qun5xLct0WGAStR7xMGYPC1 wC2OKbYbh3zWbDIJz1JQiJrlM3nr5UHajJdqVxAeOp8Xoq2xLB+dYMuNeqGgQVs+BAWx AcRu1Vs1JycGk8KUEH2GFEHIE6083F2g6WYhaVhSj/15mZOyHfAAXKDK8PB8xbaP+xnZ 1irg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=H1pJRhNb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z9-20020a1709027e8900b001a25ae310a7si22131575pla.50.2023.04.28.16.15.07; Fri, 28 Apr 2023 16:15:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=H1pJRhNb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346866AbjD1Ws6 (ORCPT + 99 others); Fri, 28 Apr 2023 18:48:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230436AbjD1Ws4 (ORCPT ); Fri, 28 Apr 2023 18:48:56 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D06526A5; Fri, 28 Apr 2023 15:48:55 -0700 (PDT) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33SMmaWK014260; Fri, 28 Apr 2023 22:48:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=QF94rjS2z1vD5ApVZ2dn+CkuXnR8dw5vfvE0RTDVXh8=; b=H1pJRhNbZIdjGS5iLism4xT9RJTsUV9F16y+GJxd9hFY2592DvqNcmF5iHkAUo8MgJty fnr5jkCZCzxQKyPWW8b7l9o2YuXd7JZhshth884JRUArkh2jwPjrUxHNn31hdXp209g6 yUQIamDK4D+nYGWLZBxb51Jrhuk72MWoJdTvXlMk9qTSuInr+AqyJhbVPXo9Mu2BQqOo j/rlX+JqFneDzqBP8w6m5CHhjJ5H7vNq9vk1EbDyLcCht0wTjqaDf4ld+2Cx/VG4xTMW jz9Q+B0UjjxopCz94csuXDu5Y2eWyGv+K0wNvYDL9nvt8hKQifilFSn/Hlk9HYSt4mvJ cg== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q8jun8jnn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 28 Apr 2023 22:48:36 +0000 Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 33SMmZx0009857 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 28 Apr 2023 22:48:35 GMT Received: from [10.110.78.181] (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Fri, 28 Apr 2023 15:48:34 -0700 Message-ID: <70acccee-22d7-0d35-b943-346a435b9eab@quicinc.com> Date: Fri, 28 Apr 2023 15:48:33 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH v2 3/7] virt: geniezone: Introduce GenieZone hypervisor support Content-Language: en-US To: Marc Zyngier , Yi-De Wu CC: Yingshiuan Pan , Ze-Yu Wang , Rob Herring , Krzysztof Kozlowski , Jonathan Corbet , Catalin Marinas , Will Deacon , Arnd Bergmann , Matthias Brugger , AngeloGioacchino Del Regno , , , , , , , David Bradil , Jade Shih , Miles Chen , Ivan Tseng , My Chuang , Shawn Hsiao , PeiLun Suei , Liju Chen References: <20230428103622.18291-1-yi-de.wu@mediatek.com> <20230428103622.18291-4-yi-de.wu@mediatek.com> <904abf67ec4ba7d37fc1e500e8a2dbd1@kernel.org> From: Trilok Soni In-Reply-To: <904abf67ec4ba7d37fc1e500e8a2dbd1@kernel.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 6UvFND-TZbp9AA4jPqH0KdgtcDq1-F5h X-Proofpoint-ORIG-GUID: 6UvFND-TZbp9AA4jPqH0KdgtcDq1-F5h X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-28_07,2023-04-27_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 clxscore=1011 bulkscore=0 mlxlogscore=696 priorityscore=1501 malwarescore=0 phishscore=0 mlxscore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304280190 X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marc, > > [...] > >> +/** >> + * gzvm_gfn_to_pfn_memslot() - Translate gfn (guest ipa) to pfn (host >> pa), >> + *                   result is in @pfn >> + * >> + * Leverage KVM's gfn_to_pfn_memslot(). Because gfn_to_pfn_memslot() >> needs >> + * kvm_memory_slot as parameter, this function populates necessary >> fileds >> + * for calling gfn_to_pfn_memslot(). >> + * >> + * Return: >> + * * 0            - Succeed >> + * * -EFAULT        - Failed to convert >> + */ >> +static int gzvm_gfn_to_pfn_memslot(struct gzvm_memslot *memslot, u64 >> gfn, u64 *pfn) >> +{ >> +    hfn_t __pfn; >> +    struct kvm_memory_slot kvm_slot = {0}; >> + >> +    kvm_slot.base_gfn = memslot->base_gfn; >> +    kvm_slot.npages = memslot->npages; >> +    kvm_slot.dirty_bitmap = NULL; >> +    kvm_slot.userspace_addr = memslot->userspace_addr; >> +    kvm_slot.flags = memslot->flags; >> +    kvm_slot.id = memslot->slot_id; >> +    kvm_slot.as_id = 0; >> + >> +    __pfn = gfn_to_pfn_memslot(&kvm_slot, gfn); > > Again, I absolutely oppose this horror. This is internal to KVM, > and we want to be able to change this without having to mess > with your own code that we cannot test anyway. > > What if we start using the extra fields that you don't populate > as they mean nothing to you? Or add a backpointer to the kvm > structure to do fancy accounting? > > You have your own hypervisor, that's well and good. Since your > main argument is that it is supposed to be standalone, make it > *really* standalone and don't use KVM as a prop. Agreed, same comments were made earlier too. I would prefer that GenieZone have its own identify rather than sharing the APIs/data-structures here. ---Trilok Soni