Received: by 10.213.65.68 with SMTP id h4csp673991imn; Tue, 20 Mar 2018 12:23:27 -0700 (PDT) X-Google-Smtp-Source: AG47ELs5goU0xo5qC8WMTyzR3Shx2rKHgGzmMdzhdKJHW8K69hncCxfha1nEkcLgZDnVdRBBT23s X-Received: by 10.99.67.1 with SMTP id q1mr12962312pga.365.1521573807363; Tue, 20 Mar 2018 12:23:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521573807; cv=none; d=google.com; s=arc-20160816; b=JVDEMDlk08NclCxlYL1ajyuD2GHiOBjxgfbTDjmC08oM0zDkdS10teEaBqo3sijA/x Iu4PVu15+1jDXjhjbulHfUoqIyB5lx7weAjZqvgiWfSyardxsc6hemeKxYcyNSizQrXf Hn71oopgk7XZwEIGQviBWnuJsqb4ZU06tZu178CLA8lhFehSPZxRxi1Bw23Q9ae/E76T cRfFDC+CFgNnmvzQmZfRDjzu8DQIAoJIxUVMxffCSp8wk7LUzDazXVgHYoa6PN/vDfg8 yHJWmT96lok3vu4hr6TQenKyRkA7keKEA6tANwOxyYeVAOymYG4+Mjm3Z8Tq4DZuYR2w mqJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=xJIR2gf/kMpdaijyWhrEUh+6NDXYDUr0tiBP2ShJFL8=; b=OnEoELjbIyGb/YCDKryQxgdeMVVWvjL2Nc3d95FRbKXtklyo9KapUaRkYpTYoPEGog j7nHTcwfopHlKplqyDmrQ5hqU5RMoxJeZBxxcjbkYrk9ZPDUQ0+YN/XmclE613XJhVPt 9uvHpGlYTWLw+PbLz1hviRBv8rbaOlg1dxIotUg4zVT85Zen7NoYwMvPcOYyaMkm77Jm NFCtxbK04jgaLhF9lZV+k3zOs8qw0WHELOsN4kNOuHvTIEKeUc070IgignXzG4fXDi+s DfXi9CIWej6reepaHF+vU7AYInvKsmtjSBiEhmscftrmfGfdmeigsnQBPTZS8KSrEJhy TL8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=Tuwi6288; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c18-v6si2097810plo.474.2018.03.20.12.23.13; Tue, 20 Mar 2018 12:23:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=Tuwi6288; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751650AbeCTTV1 (ORCPT + 99 others); Tue, 20 Mar 2018 15:21:27 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:60074 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751512AbeCTTVI (ORCPT ); Tue, 20 Mar 2018 15:21:08 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w2KJCOkI148363; Tue, 20 Mar 2018 19:20:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=xJIR2gf/kMpdaijyWhrEUh+6NDXYDUr0tiBP2ShJFL8=; b=Tuwi6288YNf9y2RcHdMsfFUyd/WlqUOfC/jY3TdmxIzJGDUjssCy0D6DPXOKouIZIsKR 7Dsmt4emSVUTLVtMfqotxQ+YyQJucOFEMmfWq45PXdEkE5W4/UlKnaiuyuF5G46ZalTh 4SUlTKX5keSbSS7Q4fNp10uTazpnNJccgAZRsc1PV8kQ7e5RtnhTXTy8mir9xQh+PdUB z44niOSgIXtAi1n3rPs2QrkORkTaz0jfU1/oXSLLk5WeZYPtXq+R2VwZTPbi7iyDByMm D3+JYeb+DfUAvBjrZCWo9tz8oGIa78mx/RXKEpB33qnjjQYu1YwpqrqN4LmJYTzcVQSJ YA== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2gu88m0146-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Mar 2018 19:20:59 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w2KJKwBt022440 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Mar 2018 19:20:58 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w2KJKwx8009119; Tue, 20 Mar 2018 19:20:58 GMT Received: from marawils-linux.us.oracle.com (/10.141.197.9) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Mar 2018 12:20:58 -0700 From: Maran Wilson To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, pbonzini@redhat.com, jgross@suse.com Cc: JBeulich@suse.com, roger.pau@citrix.com, boris.ostrovsky@oracle.com, rkrcmar@redhat.com, maran.wilson@oracle.com Subject: [PATCH v5 6/7] xen/pvh: Add memory map pointer to hvm_start_info struct Date: Tue, 20 Mar 2018 12:20:36 -0700 Message-Id: <1521573636-17563-1-git-send-email-maran.wilson@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1521573369-17216-1-git-send-email-maran.wilson@oracle.com> References: <1521573369-17216-1-git-send-email-maran.wilson@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8838 signatures=668695 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=473 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803200127 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The start info structure that is defined as part of the x86/HVM direct boot ABI and used for starting Xen PVH guests would be more versatile if it also included a way to pass information about the memory map to the guest. This would allow KVM guests to share the same entry point. Signed-off-by: Maran Wilson --- include/xen/interface/hvm/start_info.h | 65 +++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/include/xen/interface/hvm/start_info.h b/include/xen/interface/hvm/start_info.h index 648415976ead..d491f2d89393 100644 --- a/include/xen/interface/hvm/start_info.h +++ b/include/xen/interface/hvm/start_info.h @@ -33,7 +33,7 @@ * | magic | Contains the magic value XEN_HVM_START_MAGIC_VALUE * | | ("xEn3" with the 0x80 bit of the "E" set). * 4 +----------------+ - * | version | Version of this structure. Current version is 0. New + * | version | Version of this structure. Current version is 1. New * | | versions are guaranteed to be backwards-compatible. * 8 +----------------+ * | flags | SIF_xxx flags. @@ -48,6 +48,15 @@ * 32 +----------------+ * | rsdp_paddr | Physical address of the RSDP ACPI data structure. * 40 +----------------+ + * | memmap_paddr | Physical address of the (optional) memory map. Only + * | | present in version 1 and newer of the structure. + * 48 +----------------+ + * | memmap_entries | Number of entries in the memory map table. Zero + * | | if there is no memory map being provided. Only + * | | present in version 1 and newer of the structure. + * 52 +----------------+ + * | reserved | Version 1 and newer only. + * 56 +----------------+ * * The layout of each entry in the module structure is the following: * @@ -62,13 +71,52 @@ * | reserved | * 32 +----------------+ * + * The layout of each entry in the memory map table is as follows: + * + * 0 +----------------+ + * | addr | Base address + * 8 +----------------+ + * | size | Size of mapping in bytes + * 16 +----------------+ + * | type | Type of mapping as defined between the hypervisor + * | | and guest it's starting. See XEN_HVM_MEMMAP_TYPE_* + * | | values below. + * 20 +----------------| + * | reserved | + * 24 +----------------+ + * * The address and sizes are always a 64bit little endian unsigned integer. * * NB: Xen on x86 will always try to place all the data below the 4GiB * boundary. + * + * Version numbers of the hvm_start_info structure have evolved like this: + * + * Version 0: Initial implementation. + * + * Version 1: Added the memmap_paddr/memmap_entries fields (plus 4 bytes of + * padding) to the end of the hvm_start_info struct. These new + * fields can be used to pass a memory map to the guest. The + * memory map is optional and so guests that understand version 1 + * of the structure must check that memmap_entries is non-zero + * before trying to read the memory map. */ #define XEN_HVM_START_MAGIC_VALUE 0x336ec578 +/* + * The values used in the type field of the memory map table entries are + * defined below and match the Address Range Types as defined in the "System + * Address Map Interfaces" section of the ACPI Specification. Please refer to + * section 15 in version 6.2 of the ACPI spec: http://uefi.org/specifications + */ +#define XEN_HVM_MEMMAP_TYPE_RAM 1 +#define XEN_HVM_MEMMAP_TYPE_RESERVED 2 +#define XEN_HVM_MEMMAP_TYPE_ACPI 3 +#define XEN_HVM_MEMMAP_TYPE_NVS 4 +#define XEN_HVM_MEMMAP_TYPE_UNUSABLE 5 +#define XEN_HVM_MEMMAP_TYPE_DISABLED 6 +#define XEN_HVM_MEMMAP_TYPE_PMEM 7 + /* * C representation of the x86/HVM start info layout. * @@ -86,6 +134,14 @@ struct hvm_start_info { uint64_t cmdline_paddr; /* Physical address of the command line. */ uint64_t rsdp_paddr; /* Physical address of the RSDP ACPI data */ /* structure. */ + uint64_t memmap_paddr; /* Physical address of an array of */ + /* hvm_memmap_table_entry. Only present in */ + /* version 1 and newer of the structure */ + uint32_t memmap_entries; /* Number of entries in the memmap table. */ + /* Only present in version 1 and newer of */ + /* the structure. Value will be zero if */ + /* there is no memory map being provided. */ + uint32_t reserved; /* Must be zero for Version 1. */ }; struct hvm_modlist_entry { @@ -95,4 +151,11 @@ struct hvm_modlist_entry { uint64_t reserved; }; +struct hvm_memmap_table_entry { + uint64_t addr; /* Base address of the memory region */ + uint64_t size; /* Size of the memory region in bytes */ + uint32_t type; /* Mapping type */ + uint32_t reserved; /* Must be zero for Version 1. */ +}; + #endif /* __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__ */ -- 2.16.1