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 X-Spam-Level: X-Spam-Status: No, score=-5.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B222DC2BA19 for ; Mon, 6 Apr 2020 08:52:18 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7C8E7206C3 for ; Mon, 6 Apr 2020 08:52:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=xen.org header.i=@xen.org header.b="eFakgQtB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C8E7206C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jLNU4-0005p4-4T; Mon, 06 Apr 2020 08:51:56 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jLNU2-0005oy-Hc for xen-devel@lists.xenproject.org; Mon, 06 Apr 2020 08:51:54 +0000 X-Inumbo-ID: dd1afc3c-77e3-11ea-b58d-bc764e2007e4 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id dd1afc3c-77e3-11ea-b58d-bc764e2007e4; Mon, 06 Apr 2020 08:51:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Rs4q5BylTNraN+j0XjUsuGksYpP/Fnjb0R58wRrNrw0=; b=eFakgQtBq543a5kOsN4iBYKn8e A0xOmFHY9dmnJ0lBhDdwZdLuuU0A9cmc6FIT80V/Xc/a20+OM40cgSXCme5Uh0osKhhhv7QtfcWcq zLbd/m3ib22rQX/078g4UbDHFzbPX4Fwvbanrh+Bu5Mlh1eTLS0B7l4/KImsp6FPIgEg=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jLNTs-0004xN-Gs; Mon, 06 Apr 2020 08:51:44 +0000 Received: from 54-240-197-239.amazon.com ([54.240.197.239] helo=a483e7b01a66.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1jLNTs-0005Wf-9S; Mon, 06 Apr 2020 08:51:44 +0000 Subject: Re: [PATCH 5/7] xen: include xen/guest_access.h rather than asm/guest_access.h To: paul@xen.org, xen-devel@lists.xenproject.org References: <20200404131017.27330-1-julien@xen.org> <20200404131017.27330-6-julien@xen.org> <001201d60be6$ab976e20$02c64a60$@xen.org> From: Julien Grall Message-ID: <7fc71644-3f4d-bbac-f593-fab86bfb2ff9@xen.org> Date: Mon, 6 Apr 2020 09:51:41 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <001201d60be6$ab976e20$02c64a60$@xen.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: 'Kevin Tian' , 'Stefano Stabellini' , 'Jun Nakajima' , 'Wei Liu' , 'Andrew Cooper' , 'Julien Grall' , 'Ian Jackson' , 'George Dunlap' , 'Jan Beulich' , 'Volodymyr Babchuk' , =?UTF-8?B?J1JvZ2VyIFBhdSBNb25uw6kn?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Hi Paul, On 06/04/2020 08:40, Paul Durrant wrote: >> diff --git a/xen/include/asm-x86/guest_access.h b/xen/include/asm-x86/guest_access.h >> index 9ee275d01f..5c3dfc47b6 100644 >> --- a/xen/include/asm-x86/guest_access.h >> +++ b/xen/include/asm-x86/guest_access.h >> @@ -54,22 +54,24 @@ >> >> /* Cast a XEN_GUEST_HANDLE to XEN_GUEST_HANDLE_PARAM */ >> #define guest_handle_to_param(hnd, type) ({ \ >> + typeof((hnd).p) _x = (hnd).p; \ >> + XEN_GUEST_HANDLE_PARAM(type) _y = { _x }; \ >> /* type checking: make sure that the pointers inside \ >> * XEN_GUEST_HANDLE and XEN_GUEST_HANDLE_PARAM are of \ >> * the same type, then return hnd */ \ >> - (void)((typeof(&(hnd).p)) 0 == \ >> - (typeof(&((XEN_GUEST_HANDLE_PARAM(type)) {}).p)) 0); \ >> - (hnd); \ >> + (void)(&_x == &_y.p); \ >> + _y; \ >> }) >> >> /* Cast a XEN_GUEST_HANDLE_PARAM to XEN_GUEST_HANDLE */ >> -#define guest_handle_from_param(hnd, type) ({ \ >> - /* type checking: make sure that the pointers inside \ >> - * XEN_GUEST_HANDLE and XEN_GUEST_HANDLE_PARAM are of \ >> - * the same type, then return hnd */ \ >> - (void)((typeof(&(hnd).p)) 0 == \ >> - (typeof(&((XEN_GUEST_HANDLE_PARAM(type)) {}).p)) 0); \ >> - (hnd); \ >> +#define guest_handle_from_param(hnd, type) ({ \ >> + typeof((hnd).p) _x = (hnd).p; \ >> + XEN_GUEST_HANDLE(type) _y = { _x }; \ >> + /* type checking: make sure that the pointers inside \ >> + * XEN_GUEST_HANDLE and XEN_GUEST_HANDLE_PARAM are of \ >> + * the same type, then return hnd */ \ >> + (void)(&_x == &_y.p); \ >> + _y; \ >> }) >> > > The commit comment would have the reader believe that this patch is just some changes in header file inclusion. These last two hunks are something else so I would suggest they get split out into a separate patch. These two chunks were meant to be squashed in patch #6, but I messed up the rebase. I will fix on the next version. Sorry for that. Cheers, > > Paul > >> #define guest_handle_for_field(hnd, type, fld) \ >> diff --git a/xen/lib/x86/private.h b/xen/lib/x86/private.h >> index b793181464..2d53bd3ced 100644 >> --- a/xen/lib/x86/private.h >> +++ b/xen/lib/x86/private.h >> @@ -4,12 +4,12 @@ >> #ifdef __XEN__ >> >> #include >> +#include >> #include >> #include >> #include >> #include >> >> -#include >> #include >> >> #define copy_to_buffer_offset copy_to_guest_offset >> -- >> 2.17.1 > > -- Julien Grall