From nobody Fri Mar 29 00:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1593186027; cv=none; d=zohomail.com; s=zohoarc; b=C8KB/moS14GO1p/IcG8dyLp19LYEBmF4yU6sAMPdw+pgKXeFyPHTe53lKag1yy9gYhFF4cJPoU3vTcKv3nANp98Z7UUDjukKAUGEGFYIzipZLoRrvfdyJRwyKQrw44fuGjuRDg3Y1owd3r9OnkbRB7yczZdvr1kl7Y1vNViZZuo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593186027; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=Sk5e5K1KgzuiMF8y9S5AdDRosyDyjsgcBcOtNI0oaz8=; b=hpxyV19ZtNqOn9p8mML9ryhR2tgnkAcpzoXb5bhu6Eoho8OlfuNiMqE1uq4Qw/RoSx03GZCh344Mzc0TKUaM0odFgEtA0/EbTDtcIXbsewlbpn5qFibLVxSd+kQyuBIif+5hzFpZWr/s1EbWxlRjlXJwT2BBgF4Xt+RK9iGP15Y= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1593186027847452.43056560669015; Fri, 26 Jun 2020 08:40:27 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1joqSY-0007YA-C3; Fri, 26 Jun 2020 15:40:10 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1joqSW-0007Y4-Rg for xen-devel@lists.xenproject.org; Fri, 26 Jun 2020 15:40:08 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 4fb8982a-b7c3-11ea-bca7-bc764e2007e4; Fri, 26 Jun 2020 15:40:07 +0000 (UTC) X-Inumbo-ID: 4fb8982a-b7c3-11ea-bca7-bc764e2007e4 Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: /5VOdIWJ0MeIXeWPlncNGlg2m0KLFGjmtBDH4eRiW3TJeFGSGFz7nnYQdJlNXA89nwZZ8hwx4R fpWnGtnJx9Zq128WdeIli8yJr3SSUDjF6IHCpOBJng5nrApvWbaRcI9nyOuywyTZobFcO9yKwl IzTCButeBh3cThHU6s1ZsRH028/Din4D53VtcAIfe+855VbHpvjh3zh4NU49YneKn0HIREK3hr lFpPPyVqoulex0hCys6+Og1VLAbGSmLmSYQw6MsBDYn7ZC7cuhYZaCvebvm679lJ4+fMNK8GiF 5IY= X-SBRS: 2.7 X-MesageID: 21380212 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.75,284,1589256000"; d="scan'208";a="21380212" From: Roger Pau Monne To: Subject: [PATCH for-4.14 v3] mm: fix public declaration of struct xen_mem_acquire_resource Date: Fri, 26 Jun 2020 17:39:51 +0200 Message-ID: <20200626153951.91301-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Julien Grall , Wei Liu , paul@xen.org, Andrew Cooper , Ian Jackson , George Dunlap , Jan Beulich , Roger Pau Monne Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" XENMEM_acquire_resource and it's related structure is currently inside a __XEN__ or __XEN_TOOLS__ guarded section to limit it's scope to the hypervisor or the toolstack only. This is wrong as the hypercall is already being used by the Linux kernel at least, and as such needs to be public. Also switch the usage of uint64_aligned_t to plain uint64_t, as uint64_aligned_t is only to be used by the toolstack. Doing such change will reduce the size of the structure on 32bit x86 by 4bytes, since there will be no padding added after the frame_list handle. This is fine, as users of the previous layout will allocate 4bytes of padding that won't be read by Xen, and users of the new layout won't allocate those, which is also fine since Xen won't try to access them. Note that the structure already has compat handling, and such handling will take care of copying the right size (ie: minus the padding) when called from a 32bit x86 context. This is true for the compat code both before and after this patch, since the structures in the memory.h compat header are subject to a pragma pack(4), which already removed the trailing padding that would otherwise be introduced by the alignment of the frame field to 8 bytes. Fixes: 3f8f12281dd20 ('x86/mm: add HYPERVISOR_memory_op to acquire guest re= sources') Signed-off-by: Roger Pau Monn=C3=A9 Reviewed-by: Jan Beulich --- Should also be backported. --- Changes since v2: - Remove the tail padding. - Expand commit message. Changes since v1: - Add padding on 32bits so structure size matches between arches and the previous layout is kept. --- xen/include/public/memory.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h index 850bd72c52..21057ed78e 100644 --- a/xen/include/public/memory.h +++ b/xen/include/public/memory.h @@ -610,6 +610,8 @@ struct xen_reserved_device_memory_map { typedef struct xen_reserved_device_memory_map xen_reserved_device_memory_m= ap_t; DEFINE_XEN_GUEST_HANDLE(xen_reserved_device_memory_map_t); =20 +#endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */ + /* * Get the pages for a particular guest resource, so that they can be * mapped directly by a tools domain. @@ -648,7 +650,7 @@ struct xen_mem_acquire_resource { * IN - the index of the initial frame to be mapped. This parameter * is ignored if nr_frames is 0. */ - uint64_aligned_t frame; + uint64_t frame; =20 #define XENMEM_resource_ioreq_server_frame_bufioreq 0 #define XENMEM_resource_ioreq_server_frame_ioreq(n) (1 + (n)) @@ -669,8 +671,6 @@ struct xen_mem_acquire_resource { typedef struct xen_mem_acquire_resource xen_mem_acquire_resource_t; DEFINE_XEN_GUEST_HANDLE(xen_mem_acquire_resource_t); =20 -#endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */ - /* * XENMEM_get_vnumainfo used by guest to get * vNUMA topology from hypervisor. --=20 2.26.2