From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sean Christopherson Date: Tue, 21 Jun 2022 14:41:02 +0000 Subject: [PATCH 2/3] KVM: selftests: Consolidate boilerplate code in get_ucall() In-Reply-To: References: <20220618001618.1840806-1-seanjc@google.com> <20220618001618.1840806-3-seanjc@google.com> Message-ID: List-Id: To: kvm-riscv@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Sun, Jun 19, 2022, Huang, Shaoqin wrote: > > > On 6/18/2022 8:16 AM, Sean Christopherson wrote: > > Consolidate the actual copying of a ucall struct from guest=>host into > > the common get_ucall(). Return a host virtual address instead of a guest > > virtual address even though the addr_gva2hva() part could be moved to > > get_ucall() too. Conceptually, get_ucall() is invoked from the host and > > should return a host virtual address (and returning NULL for "nothing to > > see here" is far superior to returning 0). > > It seems the get_ucall() returns the uc->cmd, the ucall_arch_get_ucall() > returns a host virtual address. Yep, get_ucall() then does the memcpy() from guest memory via that host virtual addres and returns the resulting ucall command. The intent is that the arch hooks are not to be called by common code. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5B18C43334 for ; Tue, 21 Jun 2022 14:41:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 3C5AF4B0D9; Tue, 21 Jun 2022 10:41:11 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ah6n03kIW6sy; Tue, 21 Jun 2022 10:41:10 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 2059A49ED6; Tue, 21 Jun 2022 10:41:10 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 05C3149EBC for ; Tue, 21 Jun 2022 10:41:09 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XPySzTBsBM+D for ; Tue, 21 Jun 2022 10:41:07 -0400 (EDT) Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id CD97E49EB2 for ; Tue, 21 Jun 2022 10:41:07 -0400 (EDT) Received: by mail-pj1-f53.google.com with SMTP id t3-20020a17090a510300b001ea87ef9a3dso13593184pjh.4 for ; Tue, 21 Jun 2022 07:41:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=JOicc8moSgPUHZwRa0UCLUvVifYA0qTN8DaBzCizOgw=; b=cKCuyyDnkfNQBL6avZcuKqgcaAnrDgGaMrPVXHKS56JghxcscK9NoNnj3Fq7/NVRC+ oRVzrbe4sEZRyZOqRivaOWFZO8Gd7vthX9YgbDCc1RkeiGegxd0pyZQqGZ/UzgMt5ruJ MaD7F/sfEkQoWFzd4qxP745PX7p+Gml77tWHRrjRjkZiJB4Si0+QNOhldE61LLtgrKtz z7nAckxCBVmBlyIGhrdH+2BUYxEDwzsjv/pBBt1WZ1hcXBLEmjxXq9UXzk0BiNzqacIe VkYCNWJt/9iPC5J8GLSnvPOdHVjKAoDqjVqKQeMuB+EOm3tQprFc1Ew0wMXup3tiDdCK rfwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JOicc8moSgPUHZwRa0UCLUvVifYA0qTN8DaBzCizOgw=; b=OJ4JIJrkoFTnU2IAgpCDDWl/TaIK0g9yFwhbkIGRR+P/k+O8RQ7R6pbyJvBXvI5Xvp NEmZ8YsKC1N/cHDpc68lusAmqgDjsiqDPwmBwfy5gTeMPJTytRbIKw8AX+WX0oI5zAGl Oo/JH9ZBkPIitn1d1iPRV26MuafRyB2/4lJagEO5ktowedgQ8M3O5ywzg+iGTiDyVp9v XPb3po8NZN+5cfRgu/XdDm4kikNFQ5HPlqrfttVV7e0FxMG8AHhy2ppMAZWY+mgyGTYH uUsHue5CCB7QkkIzZkWRtIWdq2M1bes0Yfv7u/UceG4uDn+tTCTlBdv/cRmnw74HdiJv F7lQ== X-Gm-Message-State: AJIora+ynemuidDOZLEZWamkYM4+gWr3ugh91qtQRARvKoyVTQ4yEfpq PZDXZj6qFRI1Z9FtNuv1a7gXSw== X-Google-Smtp-Source: AGRyM1vJrRABFv+Um9W+VY7dY1s+g55BsfMNsbio+5fYQj4/zIQK6olfXAORs7KW0GbN7wK+7Xjx+Q== X-Received: by 2002:a17:902:ab87:b0:162:26cf:bf7a with SMTP id f7-20020a170902ab8700b0016226cfbf7amr28637304plr.168.1655822466277; Tue, 21 Jun 2022 07:41:06 -0700 (PDT) Received: from google.com (123.65.230.35.bc.googleusercontent.com. [35.230.65.123]) by smtp.gmail.com with ESMTPSA id s17-20020a170902c65100b0016a091e993dsm8269986pls.42.2022.06.21.07.41.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 07:41:05 -0700 (PDT) Date: Tue, 21 Jun 2022 14:41:02 +0000 From: Sean Christopherson To: "Huang, Shaoqin" Subject: Re: [PATCH 2/3] KVM: selftests: Consolidate boilerplate code in get_ucall() Message-ID: References: <20220618001618.1840806-1-seanjc@google.com> <20220618001618.1840806-3-seanjc@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Cc: kvm@vger.kernel.org, David Hildenbrand , Paul Walmsley , Colton Lewis , linux-riscv@lists.infradead.org, Claudio Imbrenda , kvmarm@lists.cs.columbia.edu, Janosch Frank , Marc Zyngier , Christian Borntraeger , Albert Ou , Atish Patra , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Palmer Dabbelt , kvm-riscv@lists.infradead.org, Paolo Bonzini X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Sun, Jun 19, 2022, Huang, Shaoqin wrote: > > > On 6/18/2022 8:16 AM, Sean Christopherson wrote: > > Consolidate the actual copying of a ucall struct from guest=>host into > > the common get_ucall(). Return a host virtual address instead of a guest > > virtual address even though the addr_gva2hva() part could be moved to > > get_ucall() too. Conceptually, get_ucall() is invoked from the host and > > should return a host virtual address (and returning NULL for "nothing to > > see here" is far superior to returning 0). > > It seems the get_ucall() returns the uc->cmd, the ucall_arch_get_ucall() > returns a host virtual address. Yep, get_ucall() then does the memcpy() from guest memory via that host virtual addres and returns the resulting ucall command. The intent is that the arch hooks are not to be called by common code. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ED215C433EF for ; Tue, 21 Jun 2022 14:41:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XCJBe5ILzaOohQr9U9tsqSjqb57I5N2e0zkYNfrXP2U=; b=CfYAdGQPrHF2gd bvdTqTBSqInLavIVOOnW5CVdmN+v0n5OZBqG61GIYz7Ouh/tqQJ9l73T84DkJ0Ea3Rlbi2H7o2Rqh tbFGFv05E14829h6sizllXGgRSDNgPWYu/F9x9Yi4TQTFYiP3ISBSv+6VAopv9Beyeyfo7DxYtWDW io4VIPR9qvWiI2JW7IGqSecvMj7rN8tBSl4vNlMwQ5WNNJNSuKAzWigbhnA0ipx2ETtRgTC6fdxQF JaTdPM7YWhBEwgn7cYrbXJV0cuyZPurP6TRZTTMCJ+/CQgLbuvyDRrF5/SfisI7a5qfUOqbw3N/u7 2IptjlDEYqGf4DBizvOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o3f4F-005ulS-7O; Tue, 21 Jun 2022 14:41:23 +0000 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o3f43-005uXp-88 for linux-riscv@lists.infradead.org; Tue, 21 Jun 2022 14:41:12 +0000 Received: by mail-pj1-x102f.google.com with SMTP id 73-20020a17090a0fcf00b001eaee69f600so13607580pjz.1 for ; Tue, 21 Jun 2022 07:41:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=JOicc8moSgPUHZwRa0UCLUvVifYA0qTN8DaBzCizOgw=; b=cKCuyyDnkfNQBL6avZcuKqgcaAnrDgGaMrPVXHKS56JghxcscK9NoNnj3Fq7/NVRC+ oRVzrbe4sEZRyZOqRivaOWFZO8Gd7vthX9YgbDCc1RkeiGegxd0pyZQqGZ/UzgMt5ruJ MaD7F/sfEkQoWFzd4qxP745PX7p+Gml77tWHRrjRjkZiJB4Si0+QNOhldE61LLtgrKtz z7nAckxCBVmBlyIGhrdH+2BUYxEDwzsjv/pBBt1WZ1hcXBLEmjxXq9UXzk0BiNzqacIe VkYCNWJt/9iPC5J8GLSnvPOdHVjKAoDqjVqKQeMuB+EOm3tQprFc1Ew0wMXup3tiDdCK rfwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JOicc8moSgPUHZwRa0UCLUvVifYA0qTN8DaBzCizOgw=; b=VQY1NPE5hQDLa+uRtMNiABcUHZL6AxD5iHvUzftp+qFq6xKTlBzTmj4kRVqXJLuDe3 jh2HY5FWaOjlsyXcrnCaoSXM+S1ZKIUjKyJMkk0EXuNZKAlKRMFb5Dln52VhIG5x2rT8 GQPAMh5JX1VOWmDWkyGeebwK4b7WWzwRkjCchyRVp++ISm/CfZs6j928Shk3f1NMsS2n KCpcxtb3mm3CXkxpESRJxHvScw3RqylMLfRfQ23pnE/wAFxOwwe0bGLOXQmodh3mLzX3 EE3YDBAhUfS+M/r+QrCTqiwHHgQAW6Vunwb+Kql+qN+zDxwQEc1tkP5DLT6vgVAWs2q2 /MQw== X-Gm-Message-State: AJIora+NxDK4IaYabXp5tEMh2wwu8puiz4EzoF1PdsXpBcatIDcPL+yT GdMjyzzqMNQ/WFnf+A3YmOGO2w== X-Google-Smtp-Source: AGRyM1vJrRABFv+Um9W+VY7dY1s+g55BsfMNsbio+5fYQj4/zIQK6olfXAORs7KW0GbN7wK+7Xjx+Q== X-Received: by 2002:a17:902:ab87:b0:162:26cf:bf7a with SMTP id f7-20020a170902ab8700b0016226cfbf7amr28637304plr.168.1655822466277; Tue, 21 Jun 2022 07:41:06 -0700 (PDT) Received: from google.com (123.65.230.35.bc.googleusercontent.com. [35.230.65.123]) by smtp.gmail.com with ESMTPSA id s17-20020a170902c65100b0016a091e993dsm8269986pls.42.2022.06.21.07.41.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 07:41:05 -0700 (PDT) Date: Tue, 21 Jun 2022 14:41:02 +0000 From: Sean Christopherson To: "Huang, Shaoqin" Cc: Paolo Bonzini , Marc Zyngier , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , James Morse , Alexandru Elisei , Suzuki K Poulose , Atish Patra , David Hildenbrand , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Colton Lewis , Andrew Jones Subject: Re: [PATCH 2/3] KVM: selftests: Consolidate boilerplate code in get_ucall() Message-ID: References: <20220618001618.1840806-1-seanjc@google.com> <20220618001618.1840806-3-seanjc@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220621_074111_362903_7BBDEB37 X-CRM114-Status: GOOD ( 12.63 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Sun, Jun 19, 2022, Huang, Shaoqin wrote: > > > On 6/18/2022 8:16 AM, Sean Christopherson wrote: > > Consolidate the actual copying of a ucall struct from guest=>host into > > the common get_ucall(). Return a host virtual address instead of a guest > > virtual address even though the addr_gva2hva() part could be moved to > > get_ucall() too. Conceptually, get_ucall() is invoked from the host and > > should return a host virtual address (and returning NULL for "nothing to > > see here" is far superior to returning 0). > > It seems the get_ucall() returns the uc->cmd, the ucall_arch_get_ucall() > returns a host virtual address. Yep, get_ucall() then does the memcpy() from guest memory via that host virtual addres and returns the resulting ucall command. The intent is that the arch hooks are not to be called by common code. _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F2E96C43334 for ; Tue, 21 Jun 2022 14:42:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tbENX+AqPNJZK6yyfZaueMHnxIvjTxeoxyite1qB3VY=; b=aeQWfgUtJjme8I iewXiOqB4fVobZaamgzvbawjdfV9EfkDtDIg5Pn8GF7F6XNS8jJ6wjONlM6cXo+xW2oNTfGDYpaVc ImKItfpw/y6tNBTMHkCEmZ+1FfvZ6qF4xVVTrYWLRhGIXjlYXkAzMxg8qWYO48GmnbWB8L9pittI6 sPcko79jy0U6gmIf4NrCG1KCWZ/e5BqbudZzhqKOlLyVh7YvCZKOwkX1bwTpCp9t28jexT8lTT8AR hibWy8YsZQd39Nmz0eQZvUYH7L19CCd0GjmLcGJZgP+ny55NQDGJkhVLjTPq9SsI5jpYZuUy5csX2 iUfIlB47pB05IEf7vv+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o3f46-005ugb-HR; Tue, 21 Jun 2022 14:41:14 +0000 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o3f43-005uXo-9S for linux-arm-kernel@lists.infradead.org; Tue, 21 Jun 2022 14:41:12 +0000 Received: by mail-pj1-x1033.google.com with SMTP id g10-20020a17090a708a00b001ea8aadd42bso13639014pjk.0 for ; Tue, 21 Jun 2022 07:41:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=JOicc8moSgPUHZwRa0UCLUvVifYA0qTN8DaBzCizOgw=; b=cKCuyyDnkfNQBL6avZcuKqgcaAnrDgGaMrPVXHKS56JghxcscK9NoNnj3Fq7/NVRC+ oRVzrbe4sEZRyZOqRivaOWFZO8Gd7vthX9YgbDCc1RkeiGegxd0pyZQqGZ/UzgMt5ruJ MaD7F/sfEkQoWFzd4qxP745PX7p+Gml77tWHRrjRjkZiJB4Si0+QNOhldE61LLtgrKtz z7nAckxCBVmBlyIGhrdH+2BUYxEDwzsjv/pBBt1WZ1hcXBLEmjxXq9UXzk0BiNzqacIe VkYCNWJt/9iPC5J8GLSnvPOdHVjKAoDqjVqKQeMuB+EOm3tQprFc1Ew0wMXup3tiDdCK rfwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JOicc8moSgPUHZwRa0UCLUvVifYA0qTN8DaBzCizOgw=; b=KCf0VCn6kevn7Vg7v8LnQ5uw0nubWcik8r4pfmN0b0vKtF24p2yAXkI8D8DlH+EsuS mIdPKeDMlKU8ICUuiUW+WcPaEkB+3ctP+RbV0zNAgWfD8IKhc96c4cpsGA8Hv8gP9Ktf GmbdII1Enr8teDl0Bf7IH/ZJU5uhsU5EtY7q3LwN8bo3CKayE/u6IX+zXyGDFonu6YhD oEYHyLe+z/mVBska7fHMfVTeW6HixxJoouXn+ow/LNNOTGU271EpGQun1rQAiigXuQ7g u65lc0AQ0urCyNN0tER5Jqvt32ymnd3+DJBglWx9Eph+b4ATOLEXp+9Im2NdqpYcCPSw fygw== X-Gm-Message-State: AJIora+HbYz0vfKMDxJRRp3H9+3ZYD1yAH09+WkEA2q9jjFlbHjmtKP9 uHbn/gDDc+R5eRZSA6Js8hLe9A== X-Google-Smtp-Source: AGRyM1vJrRABFv+Um9W+VY7dY1s+g55BsfMNsbio+5fYQj4/zIQK6olfXAORs7KW0GbN7wK+7Xjx+Q== X-Received: by 2002:a17:902:ab87:b0:162:26cf:bf7a with SMTP id f7-20020a170902ab8700b0016226cfbf7amr28637304plr.168.1655822466277; Tue, 21 Jun 2022 07:41:06 -0700 (PDT) Received: from google.com (123.65.230.35.bc.googleusercontent.com. [35.230.65.123]) by smtp.gmail.com with ESMTPSA id s17-20020a170902c65100b0016a091e993dsm8269986pls.42.2022.06.21.07.41.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 07:41:05 -0700 (PDT) Date: Tue, 21 Jun 2022 14:41:02 +0000 From: Sean Christopherson To: "Huang, Shaoqin" Cc: Paolo Bonzini , Marc Zyngier , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , James Morse , Alexandru Elisei , Suzuki K Poulose , Atish Patra , David Hildenbrand , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Colton Lewis , Andrew Jones Subject: Re: [PATCH 2/3] KVM: selftests: Consolidate boilerplate code in get_ucall() Message-ID: References: <20220618001618.1840806-1-seanjc@google.com> <20220618001618.1840806-3-seanjc@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220621_074111_363774_362FED8E X-CRM114-Status: GOOD ( 14.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sun, Jun 19, 2022, Huang, Shaoqin wrote: > > > On 6/18/2022 8:16 AM, Sean Christopherson wrote: > > Consolidate the actual copying of a ucall struct from guest=>host into > > the common get_ucall(). Return a host virtual address instead of a guest > > virtual address even though the addr_gva2hva() part could be moved to > > get_ucall() too. Conceptually, get_ucall() is invoked from the host and > > should return a host virtual address (and returning NULL for "nothing to > > see here" is far superior to returning 0). > > It seems the get_ucall() returns the uc->cmd, the ucall_arch_get_ucall() > returns a host virtual address. Yep, get_ucall() then does the memcpy() from guest memory via that host virtual addres and returns the resulting ucall command. The intent is that the arch hooks are not to be called by common code. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38CB8C433EF for ; Tue, 21 Jun 2022 14:41:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351686AbiFUOlK (ORCPT ); Tue, 21 Jun 2022 10:41:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351436AbiFUOlI (ORCPT ); Tue, 21 Jun 2022 10:41:08 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 167BC24F06 for ; Tue, 21 Jun 2022 07:41:07 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id f16so11895776pjj.1 for ; Tue, 21 Jun 2022 07:41:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=JOicc8moSgPUHZwRa0UCLUvVifYA0qTN8DaBzCizOgw=; b=cKCuyyDnkfNQBL6avZcuKqgcaAnrDgGaMrPVXHKS56JghxcscK9NoNnj3Fq7/NVRC+ oRVzrbe4sEZRyZOqRivaOWFZO8Gd7vthX9YgbDCc1RkeiGegxd0pyZQqGZ/UzgMt5ruJ MaD7F/sfEkQoWFzd4qxP745PX7p+Gml77tWHRrjRjkZiJB4Si0+QNOhldE61LLtgrKtz z7nAckxCBVmBlyIGhrdH+2BUYxEDwzsjv/pBBt1WZ1hcXBLEmjxXq9UXzk0BiNzqacIe VkYCNWJt/9iPC5J8GLSnvPOdHVjKAoDqjVqKQeMuB+EOm3tQprFc1Ew0wMXup3tiDdCK rfwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JOicc8moSgPUHZwRa0UCLUvVifYA0qTN8DaBzCizOgw=; b=Eo13eu+DoWMgwx6g78Cc0JtMacplQ2LUiheh5nP+QCghcgDwPJn/g8K3hvJji8l6oh qB9q0U4MXD6ZulI0OT6zF9GXxXAUDkElL1itJRDydw0UWzeB9UkZXOrWaRl3J0qkOaJa NcaxXcVp6T7/AgxG+Ux2U5K3dSFQUav8Ebs7BXeq2UO0ir7qMcr1Hr+GFbipm6nA3nEN cicBHTYUhaIDAjhwL3wzoXfzDJSvKFEzIuBmFv9zcGaQWqq5FbDPzbNMwjZL4ZpZ9wN5 NreGAz4LmzV8+8y+OH+qARNxtVGW4iT+eV5m0CCUkA0MRk/41DlOYdcHZjoqpXeavyJi W7DQ== X-Gm-Message-State: AJIora/8p0W3DpyonZtKA4KWoFsC/2Q+xuLuhZHyJT3X6G8C9442QMPS IvIT7iW6+G5kV0KXvqsaD6EKLQ== X-Google-Smtp-Source: AGRyM1vJrRABFv+Um9W+VY7dY1s+g55BsfMNsbio+5fYQj4/zIQK6olfXAORs7KW0GbN7wK+7Xjx+Q== X-Received: by 2002:a17:902:ab87:b0:162:26cf:bf7a with SMTP id f7-20020a170902ab8700b0016226cfbf7amr28637304plr.168.1655822466277; Tue, 21 Jun 2022 07:41:06 -0700 (PDT) Received: from google.com (123.65.230.35.bc.googleusercontent.com. [35.230.65.123]) by smtp.gmail.com with ESMTPSA id s17-20020a170902c65100b0016a091e993dsm8269986pls.42.2022.06.21.07.41.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 07:41:05 -0700 (PDT) Date: Tue, 21 Jun 2022 14:41:02 +0000 From: Sean Christopherson To: "Huang, Shaoqin" Cc: Paolo Bonzini , Marc Zyngier , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , James Morse , Alexandru Elisei , Suzuki K Poulose , Atish Patra , David Hildenbrand , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Colton Lewis , Andrew Jones Subject: Re: [PATCH 2/3] KVM: selftests: Consolidate boilerplate code in get_ucall() Message-ID: References: <20220618001618.1840806-1-seanjc@google.com> <20220618001618.1840806-3-seanjc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Sun, Jun 19, 2022, Huang, Shaoqin wrote: > > > On 6/18/2022 8:16 AM, Sean Christopherson wrote: > > Consolidate the actual copying of a ucall struct from guest=>host into > > the common get_ucall(). Return a host virtual address instead of a guest > > virtual address even though the addr_gva2hva() part could be moved to > > get_ucall() too. Conceptually, get_ucall() is invoked from the host and > > should return a host virtual address (and returning NULL for "nothing to > > see here" is far superior to returning 0). > > It seems the get_ucall() returns the uc->cmd, the ucall_arch_get_ucall() > returns a host virtual address. Yep, get_ucall() then does the memcpy() from guest memory via that host virtual addres and returns the resulting ucall command. The intent is that the arch hooks are not to be called by common code.