From nobody Thu Apr 18 09:48:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1580921503085718.5533972942561; Wed, 5 Feb 2020 08:51:43 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1izNtI-0000OZ-1a; Wed, 05 Feb 2020 16:51:04 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1izNtG-0000OP-QF for xen-devel@lists.xenproject.org; Wed, 05 Feb 2020 16:51:02 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b058a590-4837-11ea-8396-bc764e2007e4; Wed, 05 Feb 2020 16:51:01 +0000 (UTC) X-Inumbo-ID: b058a590-4837-11ea-8396-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1580921462; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=9ZIqs+U1WpXILjnoNd1edq+4N035xYkLfhKbPUauqrU=; b=ezmzsSIWpXKg65lEgzW2CKnLFzfvKN50Dx9pAAmLOOIqbw9NfhGDA6KJ /3MKsSzp07DIO4DlO+RzzQQ0NFcUB95b+x9t3yck8ERiBqJBN37st32nC qUw9drsuCN4ZUGjjJ+g7SCz4A3KhrmDGpu4GXig/uMEhMd2XlI9GDw1GC s=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 4rJQbKaf9mnkTz3u46b5lxPaOk+CoWfKWJY9ZPlXdjamHcosb5grXBfbGUw/iQDmegFTSymr8f YI9UPIolU3AF135OgcNqAErJVTUV7nPCkj/Kt6dRlIRSiHgVgz4sFEfPMcgx/78i/hJwjFAYIr 7sXiRjVBeFvoeOz1cZyPFB1ZShChXKoLSpXUkTtmm2m/i6KXbN2yiM+GmXUTaxq2+atuC3WIRV 42cK3HFXslV+QHUDNyv4QMOPN6eSAyhKIw8cgf8axML3f30kUhn6B8584C5ccPmBNIVctstH4U k8Q= X-SBRS: 2.7 X-MesageID: 11991639 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,406,1574139600"; d="scan'208";a="11991639" From: Andrew Cooper To: Xen-devel Date: Wed, 5 Feb 2020 16:50:51 +0000 Message-ID: <20200205165056.11734-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200205165056.11734-1-andrew.cooper3@citrix.com> References: <20200205165056.11734-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 1/6] tools/libxl: Remove libxl_cpuid_{set, apply_policy}() from the API 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: Anthony PERARD , Andrew Cooper , Wei Liu , Ian Jackson Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) These functions should never have been exposed. They don't have external users, and can't usefully be used for several reasons. Move libxl_cpuid_{set,apply_policy}() to being internal functions, and leave an equivalent of the nop stubs in the API for caller compatibility. Signed-off-by: Andrew Cooper Acked-by: Ian Jackson --- CC: Ian Jackson CC: Wei Liu CC: Anthony PERARD RFC for obvious reasons. An alternative would be to #if 0 them, which would result in a compile failure rather than silent stubbing. I'm not sure which is least bad, but I don't think either are going to cause a problem in practice. --- tools/libxl/libxl.h | 26 ++++++++++++++++++++++---- tools/libxl/libxl_cpuid.c | 6 +++--- tools/libxl/libxl_dom.c | 4 ++-- tools/libxl/libxl_internal.h | 4 ++++ tools/libxl/libxl_nocpuid.c | 6 +++--- 5 files changed, 34 insertions(+), 12 deletions(-) diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 18c1a2d6bf..d1d31b1e67 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -665,7 +665,7 @@ typedef struct libxl__ctx libxl_ctx; #if LIBXL_API_VERSION !=3D 0x040200 && LIBXL_API_VERSION !=3D 0x040300 && \ LIBXL_API_VERSION !=3D 0x040400 && LIBXL_API_VERSION !=3D 0x040500 && \ LIBXL_API_VERSION !=3D 0x040700 && LIBXL_API_VERSION !=3D 0x040800 && \ - LIBXL_API_VERSION !=3D 0x041300 + LIBXL_API_VERSION !=3D 0x041300 && LIBXL_API_VERSION !=3D 0x041400 #error Unknown LIBXL_API_VERSION #endif #endif @@ -2325,9 +2325,27 @@ libxl_device_pci *libxl_device_pci_assignable_list(l= ibxl_ctx *ctx, int *num); int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* s= tr); int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *cpuid, const char* str); -void libxl_cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid); -void libxl_cpuid_set(libxl_ctx *ctx, uint32_t domid, - libxl_cpuid_policy_list cpuid); +#if LIBXL_API_VERSION < 0x041400 +/* + * Dropped from the API in Xen 4.14. At the time of writing, these functi= ons + * don't appear to ever have had external callers. + * + * These have always been used internally during domain construction, and + * can't easily be used externally because of their implicit parameters in + * other pieces of global state. + * + * Furthermore, an API user can't usefully determine whether they get + * libxl_cpuid (the real implementation) or libxl_nocpuid (no-op stubs). + * + * The internal behaviour of these functions also needs to change. Theref= ore + * for simplicitly, provide the no-op stubs. Yes technically this is an A= PI + * change in some cases for existing software, but there is 0 of that in + * practice. + */ +static inline void libxl_cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid= ) {} +static inline void libxl_cpuid_set(libxl_ctx *ctx, uint32_t domid, + libxl_cpuid_policy_list cpuid) {} +#endif =20 /* * Functions for allowing users of libxl to store private data diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c index 5c52cbe0f9..505ec1b048 100644 --- a/tools/libxl/libxl_cpuid.c +++ b/tools/libxl/libxl_cpuid.c @@ -410,13 +410,13 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_= list *cpuid, return 0; } =20 -void libxl_cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid) +void libxl__cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid) { xc_cpuid_apply_policy(ctx->xch, domid, NULL, 0); } =20 -void libxl_cpuid_set(libxl_ctx *ctx, uint32_t domid, - libxl_cpuid_policy_list cpuid) +void libxl__cpuid_set(libxl_ctx *ctx, uint32_t domid, + libxl_cpuid_policy_list cpuid) { int i; char *cpuid_res[4]; diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index d9ada8a422..bbb1be75ba 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -454,9 +454,9 @@ int libxl__build_post(libxl__gc *gc, uint32_t domid, if (rc) return rc; =20 - libxl_cpuid_apply_policy(ctx, domid); + libxl__cpuid_apply_policy(ctx, domid); if (info->cpuid !=3D NULL) - libxl_cpuid_set(ctx, domid, info->cpuid); + libxl__cpuid_set(ctx, domid, info->cpuid); =20 if (info->type =3D=3D LIBXL_DOMAIN_TYPE_HVM && !libxl_ms_vm_genid_is_zero(&info->u.hvm.ms_vm_genid)) { diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index dd3c08bc14..164d93b89b 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -2056,6 +2056,10 @@ struct libxl__cpuid_policy { char *policy[4]; }; =20 +_hidden void libxl__cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid); +_hidden void libxl__cpuid_set(libxl_ctx *ctx, uint32_t domid, + libxl_cpuid_policy_list cpuid); + /* Calls poll() again - useful to check whether a signaled condition * is still true. Cannot fail. Returns currently-true revents. */ _hidden short libxl__fd_poll_recheck(libxl__egc *egc, int fd, short events= ); diff --git a/tools/libxl/libxl_nocpuid.c b/tools/libxl/libxl_nocpuid.c index ef1161c434..a39babe754 100644 --- a/tools/libxl/libxl_nocpuid.c +++ b/tools/libxl/libxl_nocpuid.c @@ -34,12 +34,12 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_li= st *cpuid, return 0; } =20 -void libxl_cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid) +void libxl__cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid) { } =20 -void libxl_cpuid_set(libxl_ctx *ctx, uint32_t domid, - libxl_cpuid_policy_list cpuid) +void libxl__cpuid_set(libxl_ctx *ctx, uint32_t domid, + libxl_cpuid_policy_list cpuid) { } =20 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Thu Apr 18 09:48:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1580921511198634.9522854984855; Wed, 5 Feb 2020 08:51:51 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1izNtX-0000VR-N7; Wed, 05 Feb 2020 16:51:19 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1izNtV-0000Ug-Mt for xen-devel@lists.xenproject.org; Wed, 05 Feb 2020 16:51:17 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b3951216-4837-11ea-ad98-bc764e2007e4; Wed, 05 Feb 2020 16:51:06 +0000 (UTC) X-Inumbo-ID: b3951216-4837-11ea-ad98-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1580921466; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=XOn1aGJowhLxP+fjsrtFOac5vlSPUDqREW49qXLnIIE=; b=Gq7DIBq/Jr2FOdeCfEaa87zfOfoIO6UIdZyjTrZLAoTvpTcNlwkrE6RQ cVSWtiWMHLrg35EoZ4drqM/K2wwEqkd3Ffa4hIOqLTuZuxyoh9j39G8ui TxTodug40g9M1UADWqJpCnCbyxuJrTkMlR1AruQiBH/EJ1hhk4SeF/KDu o=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: SpBRXGKvCX08i12FVu/xpGSeRPKqR2elnti/u4gQJ75BmaXNepaatH66wjEMSzHaX9/EkBsqDs HznIaevi4CG86tyraCjniuz1D3+IksJPwNjrSXjoCoZGCbixoxOvBNvjhvzeUQj2HwABkXstQ2 dmpN+h4LnJ6qD8Hkt4mwWlTBVaykksTxvY8MqqOsbQxuApieNeG7NkVxPOKo98+UQgw1HI6ywa +NkJI5xxJ0T9hu7wMcmHaSQ/gtLOOqi7q6hoAbsLmTRC/+BuHqpsFUVLNsM6qul1Onn0CdHfgN 72k= X-SBRS: 2.7 X-MesageID: 12612174 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,406,1574139600"; d="scan'208";a="12612174" From: Andrew Cooper To: Xen-devel Date: Wed, 5 Feb 2020 16:50:52 +0000 Message-ID: <20200205165056.11734-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200205165056.11734-1-andrew.cooper3@citrix.com> References: <20200205165056.11734-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 2/6] tools/ocaml: Drop cpuid helpers 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: Andrew Cooper , Christian Lindig Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) These have no callers, and the underlying infrastructure is about to be rewritten completely. Signed-off-by: Andrew Cooper Acked-by: Christian Lindig --- CC: Christian Lindig --- tools/ocaml/libs/xc/xenctrl.ml | 7 ----- tools/ocaml/libs/xc/xenctrl.mli | 7 ----- tools/ocaml/libs/xc/xenctrl_stubs.c | 62 ---------------------------------= ---- 3 files changed, 76 deletions(-) diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml index e00a74d48d..497ded7ce2 100644 --- a/tools/ocaml/libs/xc/xenctrl.ml +++ b/tools/ocaml/libs/xc/xenctrl.ml @@ -256,13 +256,6 @@ external domain_set_memmap_limit: handle -> domid -> i= nt64 -> unit external domain_memory_increase_reservation: handle -> domid -> int64 -> u= nit =3D "stub_xc_domain_memory_increase_reservation" =20 -external domain_cpuid_set: handle -> domid -> (int64 * (int64 option)) - -> string option array - -> string option array - =3D "stub_xc_domain_cpuid_set" -external domain_cpuid_apply_policy: handle -> domid -> unit - =3D "stub_xc_domain_cpuid_apply_policy" - external map_foreign_range: handle -> domid -> int -> nativeint -> Xenmmap.mmap_interface =3D "stub_map_foreign_range" diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.= mli index 0e7049d708..26ec7e59b1 100644 --- a/tools/ocaml/libs/xc/xenctrl.mli +++ b/tools/ocaml/libs/xc/xenctrl.mli @@ -219,10 +219,3 @@ external pages_to_kib : int64 -> int64 =3D "stub_pages= _to_kib" val pages_to_mib : int64 -> int64 external watchdog : handle -> int -> int32 -> int =3D "stub_xc_watchdog" - -external domain_cpuid_set: handle -> domid -> (int64 * (int64 option)) - -> string option array - -> string option array - =3D "stub_xc_domain_cpuid_set" -external domain_cpuid_apply_policy: handle -> domid -> unit - =3D "stub_xc_domain_cpuid_apply_policy" diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenc= trl_stubs.c index 48f39f81d5..904da45c4f 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -48,12 +48,6 @@ #define string_of_option_array(array, index) \ ((Field(array, index) =3D=3D Val_none) ? NULL : String_val(Field(Field(ar= ray, index), 0))) =20 -/* maybe here we should check the range of the input instead of blindly - * casting it to uint32 */ -#define cpuid_input_of_val(i1, i2, input) \ - i1 =3D (uint32_t) Int64_val(Field(input, 0)); \ - i2 =3D ((Field(input, 1) =3D=3D Val_none) ? 0xffffffff : (uint32_t) Int64= _val(Field(Field(input, 1), 0))); - static void Noreturn failwith_xc(xc_interface *xch) { char error_str[XC_MAX_ERROR_MSG_LEN + 6]; @@ -826,62 +820,6 @@ CAMLprim value stub_xc_domain_memory_increase_reservat= ion(value xch, CAMLreturn(Val_unit); } =20 -CAMLprim value stub_xc_domain_cpuid_set(value xch, value domid, - value input, - value config) -{ - CAMLparam4(xch, domid, input, config); - CAMLlocal2(array, tmp); -#if defined(__i386__) || defined(__x86_64__) - int r; - unsigned int c_input[2]; - char *c_config[4], *out_config[4]; - - c_config[0] =3D string_of_option_array(config, 0); - c_config[1] =3D string_of_option_array(config, 1); - c_config[2] =3D string_of_option_array(config, 2); - c_config[3] =3D string_of_option_array(config, 3); - - cpuid_input_of_val(c_input[0], c_input[1], input); - - array =3D caml_alloc(4, 0); - for (r =3D 0; r < 4; r++) { - tmp =3D Val_none; - if (c_config[r]) { - tmp =3D caml_alloc_small(1, 0); - Field(tmp, 0) =3D caml_alloc_string(32); - } - Store_field(array, r, tmp); - } - - for (r =3D 0; r < 4; r++) - out_config[r] =3D (c_config[r]) ? String_val(Field(Field(array, r), 0)) = : NULL; - - r =3D xc_cpuid_set(_H(xch), _D(domid), - c_input, (const char **)c_config, out_config); - if (r < 0) - failwith_xc(_H(xch)); -#else - caml_failwith("xc_domain_cpuid_set: not implemented"); -#endif - CAMLreturn(array); -} - -CAMLprim value stub_xc_domain_cpuid_apply_policy(value xch, value domid) -{ - CAMLparam2(xch, domid); -#if defined(__i386__) || defined(__x86_64__) - int r; - - r =3D xc_cpuid_apply_policy(_H(xch), _D(domid), NULL, 0); - if (r < 0) - failwith_xc(_H(xch)); -#else - caml_failwith("xc_domain_cpuid_apply_policy: not implemented"); -#endif - CAMLreturn(Val_unit); -} - CAMLprim value stub_xc_version_version(value xch) { CAMLparam1(xch); --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Thu Apr 18 09:48:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1580921507017214.26223044991502; Wed, 5 Feb 2020 08:51:47 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1izNtN-0000Q2-CA; Wed, 05 Feb 2020 16:51:09 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1izNtM-0000Pi-Cq for xen-devel@lists.xenproject.org; Wed, 05 Feb 2020 16:51:08 +0000 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id b1389f38-4837-11ea-915c-12813bfff9fa; Wed, 05 Feb 2020 16:51:02 +0000 (UTC) X-Inumbo-ID: b1389f38-4837-11ea-915c-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1580921463; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wt9JPNfDaTiVVEOj4fX5wmVP6nuaEv41Cj0T1A9EtMU=; b=BjIzVxWefP4IX1AepZEI+xbLm+JjOjtGxkeR41OJ30bU7lhxAfMFKbAq T82r5H6ptgCD1HNWbcyAJVipCoZdAhnQlHquu5iw8wd1sbL6fYMjgR/Cv p2HUr0SvWougmObOOzVeVTdKJ3k3BEKWy2AGxwsbD4SyNEi2jIazNP/6G g=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: fNJAwZA3Zt6X/angS7jPEVClGH0loHKIrj+8woOELPJxB5EiV7TAuz1NDCijUKjZWyl019ldb5 h6muKODVdWQGyPVWaQGECl/tvH+HuVqjJ4q+wfvGw796IyXt9h05HBH9+hYxIeneQ5N7mNx7jk CaCO87UY675mpsaEIcKujRGDYI2W+IVnGdcEMbbEAaE3s3P522jsJJrX+XrYgNWAz0DQ5fkVaE xwqoqHuFaIqvkLmEUUD9YTPZ1iKXrOzNMwa2sPn6nxzJC5GHFOU5zVfHk3PVMfKb3zeU/8HaDr SH8= X-SBRS: 2.7 X-MesageID: 12001772 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,406,1574139600"; d="scan'208";a="12001772" From: Andrew Cooper To: Xen-devel Date: Wed, 5 Feb 2020 16:50:53 +0000 Message-ID: <20200205165056.11734-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200205165056.11734-1-andrew.cooper3@citrix.com> References: <20200205165056.11734-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 3/6] tools/python: Drop cpuid helpers 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: Andrew Cooper , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Wei Liu , Ian Jackson Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) These are believed-unused, and the underlying infrastructure is about to be rewritten completely. Signed-off-by: Andrew Cooper Acked-by: Ian Jackson Acked-by: Marek Marczykowski-G=C3=B3recki --- CC: Ian Jackson CC: Wei Liu CC: Marek Marczykowski-G=C3=B3recki --- tools/python/xen/lowlevel/xc/xc.c | 98 -----------------------------------= ---- 1 file changed, 98 deletions(-) diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/= xc/xc.c index a751e85910..ac0e26a742 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -694,84 +694,6 @@ static PyObject *pyxc_get_device_group(XcObject *self, return Pystr; } =20 -#if defined(__i386__) || defined(__x86_64__) -static void pyxc_dom_extract_cpuid(PyObject *config, - char **regs) -{ - const char *regs_extract[4] =3D { "eax", "ebx", "ecx", "edx" }; - PyObject *obj; - int i; - - memset(regs, 0, 4*sizeof(*regs)); - - if ( !PyDict_Check(config) ) - return; - - for ( i =3D 0; i < 4; i++ ) - if ( (obj =3D PyDict_GetItemString(config, regs_extract[i])) !=3D = NULL ) - regs[i] =3D PyBytes_AS_STRING(obj); -} - -static PyObject *pyxc_create_cpuid_dict(char **regs) -{ - const char *regs_extract[4] =3D { "eax", "ebx", "ecx", "edx" }; - PyObject *dict; - int i; - - dict =3D PyDict_New(); - for ( i =3D 0; i < 4; i++ ) - { - if ( regs[i] =3D=3D NULL ) - continue; - PyDict_SetItemString(dict, regs_extract[i], - PyBytes_FromString(regs[i])); - free(regs[i]); - regs[i] =3D NULL; - } - return dict; -} - -static PyObject *pyxc_dom_set_policy_cpuid(XcObject *self, - PyObject *args) -{ - int domid; - - if ( !PyArg_ParseTuple(args, "i", &domid) ) - return NULL; - - if ( xc_cpuid_apply_policy(self->xc_handle, domid, NULL, 0) ) - return pyxc_error_to_exception(self->xc_handle); - - Py_INCREF(zero); - return zero; -} - - -static PyObject *pyxc_dom_set_cpuid(XcObject *self, - PyObject *args) -{ - PyObject *sub_input, *config; - unsigned int domid, input[2]; - char *regs[4], *regs_transform[4]; - - if ( !PyArg_ParseTuple(args, "IIOO", &domid, - &input[0], &sub_input, &config) ) - return NULL; - - pyxc_dom_extract_cpuid(config, regs); - - input[1] =3D XEN_CPUID_INPUT_UNUSED; - if ( PyLong_Check(sub_input) ) - input[1] =3D PyLong_AsUnsignedLong(sub_input); - - if ( xc_cpuid_set(self->xc_handle, domid, input, (const char **)regs, - regs_transform) ) - return pyxc_error_to_exception(self->xc_handle); - - return pyxc_create_cpuid_dict(regs_transform); -} -#endif /* __i386__ || __x86_64__ */ - static PyObject *pyxc_gnttab_hvm_seed(XcObject *self, PyObject *args, PyObject *kwds) @@ -2406,26 +2328,6 @@ static PyMethodDef pyxc_methods[] =3D { "Inject debug keys into Xen.\n" " keys [str]: String of keys to inject.\n" }, =20 -#if defined(__i386__) || defined(__x86_64__) - { "domain_set_cpuid",=20 - (PyCFunction)pyxc_dom_set_cpuid,=20 - METH_VARARGS, "\n" - "Set cpuid response for an input and a domain.\n" - " dom [int]: Identifier of domain.\n" - " input [long]: Input for cpuid instruction (eax)\n" - " sub_input [long]: Second input (optional, may be None) for cpuid " - " instruction (ecx)\n" - " config [dict]: Dictionary of register\n\n" - "Returns: [int] 0 on success; exception on error.\n" }, - - { "domain_set_policy_cpuid",=20 - (PyCFunction)pyxc_dom_set_policy_cpuid,=20 - METH_VARARGS, "\n" - "Set the default cpuid policy for a domain.\n" - " dom [int]: Identifier of domain.\n\n" - "Returns: [int] 0 on success; exception on error.\n" }, -#endif - { "dom_set_memshr",=20 (PyCFunction)pyxc_dom_set_memshr, METH_VARARGS, "\n" --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Thu Apr 18 09:48:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1580921503047223.24931699702324; Wed, 5 Feb 2020 08:51:43 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1izNtM-0000Pn-VL; Wed, 05 Feb 2020 16:51:08 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1izNtL-0000PZ-MT for xen-devel@lists.xenproject.org; Wed, 05 Feb 2020 16:51:07 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b17c133a-4837-11ea-8396-bc764e2007e4; Wed, 05 Feb 2020 16:51:02 +0000 (UTC) X-Inumbo-ID: b17c133a-4837-11ea-8396-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1580921463; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=w7ytyD/TCLp1VDxBKjEYmlzN9beHNXWINcG+VlSltN0=; b=iNOM7RxGJyLYTQ3UMs+3yrWasZI5pbcsNgPWlQoRTOoTEytjNV5efQZi Rka6krRF0zKZxB48GTLi5qCVm62rlkr2HfTlOHhkpxqZJmhyyoafmeTAd hzhamFJw/uKQZFOY/8ymXeOHwqeE+t11aqzJBp/tvGknvppONl6Xy+NV3 E=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: eU4oycvXqixxpKEP6blaTpC76iUyO9TQajsL+z/+6ofiAQ/gAvaOq5bGEBR8Ylt9OJIUK76DXE vVXjD/rvg5oAZJbp6iNdOFcrDZBJd0R4lwzAoFxTqe3P+MQg0lMzNsPHw1ME0j1CWdX2jshYv8 yGhJ1Q1dPDpSvFbLwZh6/y/w7et9OKO3ks6eEestgW+q5FAL8hJZgdnssGInqnA4CsmJ85RAZ7 eKh6cHtdAZL8FTZGrJIbHwYkSBgsN50bZGkNE1jf7ajlfCVgbU1rkLgDsUXqhC3nFePwrHdLQH 8fY= X-SBRS: 2.7 X-MesageID: 11991643 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,406,1574139600"; d="scan'208";a="11991643" From: Andrew Cooper To: Xen-devel Date: Wed, 5 Feb 2020 16:50:54 +0000 Message-ID: <20200205165056.11734-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200205165056.11734-1-andrew.cooper3@citrix.com> References: <20200205165056.11734-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 4/6] tools/libxl: Combine legacy CPUID handling logic 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: Anthony PERARD , Andrew Cooper , Wei Liu , Ian Jackson Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) While we are in the process of overhauling boot time CPUID/MSR handling, the existing logic is going to have to remain in roughly this form for backwards compatibility. Fold libxl__cpuid_apply_policy() and libxl__cpuid_set() together into a sin= gle libxl__cpuid_legacy() to reduce the complexity for callers. No functional change. Signed-off-by: Andrew Cooper Acked-by: Ian Jackson --- CC: Ian Jackson CC: Wei Liu CC: Anthony PERARD --- tools/libxl/libxl_cpuid.c | 15 ++++++++------- tools/libxl/libxl_dom.c | 4 +--- tools/libxl/libxl_internal.h | 5 ++--- tools/libxl/libxl_nocpuid.c | 8 ++------ 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c index 505ec1b048..49d3ca5b26 100644 --- a/tools/libxl/libxl_cpuid.c +++ b/tools/libxl/libxl_cpuid.c @@ -410,17 +410,18 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_= list *cpuid, return 0; } =20 -void libxl__cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid) -{ - xc_cpuid_apply_policy(ctx->xch, domid, NULL, 0); -} - -void libxl__cpuid_set(libxl_ctx *ctx, uint32_t domid, - libxl_cpuid_policy_list cpuid) +void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, + libxl_domain_build_info *info) { + libxl_cpuid_policy_list cpuid =3D info->cpuid; int i; char *cpuid_res[4]; =20 + xc_cpuid_apply_policy(ctx->xch, domid, NULL, 0); + + if (!cpuid) + return; + for (i =3D 0; cpuid[i].input[0] !=3D XEN_CPUID_INPUT_UNUSED; i++) xc_cpuid_set(ctx->xch, domid, cpuid[i].input, (const char**)(cpuid[i].policy), cpuid_res); diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index bbb1be75ba..71cb578923 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -454,9 +454,7 @@ int libxl__build_post(libxl__gc *gc, uint32_t domid, if (rc) return rc; =20 - libxl__cpuid_apply_policy(ctx, domid); - if (info->cpuid !=3D NULL) - libxl__cpuid_set(ctx, domid, info->cpuid); + libxl__cpuid_legacy(ctx, domid, info); =20 if (info->type =3D=3D LIBXL_DOMAIN_TYPE_HVM && !libxl_ms_vm_genid_is_zero(&info->u.hvm.ms_vm_genid)) { diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 164d93b89b..4936446069 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -2056,9 +2056,8 @@ struct libxl__cpuid_policy { char *policy[4]; }; =20 -_hidden void libxl__cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid); -_hidden void libxl__cpuid_set(libxl_ctx *ctx, uint32_t domid, - libxl_cpuid_policy_list cpuid); +_hidden void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, + libxl_domain_build_info *info); =20 /* Calls poll() again - useful to check whether a signaled condition * is still true. Cannot fail. Returns currently-true revents. */ diff --git a/tools/libxl/libxl_nocpuid.c b/tools/libxl/libxl_nocpuid.c index a39babe754..7776574a0c 100644 --- a/tools/libxl/libxl_nocpuid.c +++ b/tools/libxl/libxl_nocpuid.c @@ -34,12 +34,8 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_lis= t *cpuid, return 0; } =20 -void libxl__cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid) -{ -} - -void libxl__cpuid_set(libxl_ctx *ctx, uint32_t domid, - libxl_cpuid_policy_list cpuid) +void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, + libxl_domain_config *d_config) { } =20 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Thu Apr 18 09:48:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1580921505883589.8072915399457; Wed, 5 Feb 2020 08:51:45 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1izNtT-0000Sg-5g; Wed, 05 Feb 2020 16:51:15 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1izNtR-0000S9-D2 for xen-devel@lists.xenproject.org; Wed, 05 Feb 2020 16:51:13 +0000 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id b1dc2e78-4837-11ea-915c-12813bfff9fa; Wed, 05 Feb 2020 16:51:03 +0000 (UTC) X-Inumbo-ID: b1dc2e78-4837-11ea-915c-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1580921464; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=4Oa6M4WM6CGr9S2ZAmXGocXyWxGoZB+1v9DkZxuf6vk=; b=em/wVdcDJlKk7OTQfnsPVE5AwFYR+eerDePxIdSG8JM8EljE7eGNw9qO jFgo3aF/woy2tQeAAV2LhBFGc8SRMUzCfsTXDElob8cplG9lJQ7oHzc+z tt4+LGd7Wid7bZAIMabE1UhVg461/wPWAqnK7H790ODPOCP6AHtGdSpfn 0=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: kgo0xgdk/kqQRdU5w13717eY8Du0SX/rid1Uwwtq3KGFfMNrRtJv6nNZOkzq3j+zU5D2eK3dzj f19Z88yFny6+x3vI1mAflFPBz9NNXVjyDzv74PoB7ot30DyoHGfBvvu7vIqhBIssTOSSBZM1Lx sF1F/fiidjWa5D+wKJYSrDdOgk7NqWcUH7mdINg1ZucU9RsRi3v9t0enmr/vnYlPhEaVjz8b+O pU9aLdQbdMRcZMleLAsXaTNaxhIePOOrzeKh8Swq2Py0J6nBdMn5vSYUavLeN9oppjZPCtwXIx Q+A= X-SBRS: 2.7 X-MesageID: 12001776 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,406,1574139600"; d="scan'208";a="12001776" From: Andrew Cooper To: Xen-devel Date: Wed, 5 Feb 2020 16:50:55 +0000 Message-ID: <20200205165056.11734-6-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200205165056.11734-1-andrew.cooper3@citrix.com> References: <20200205165056.11734-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 5/6] tools/libx[cl]: Don't use HVM_PARAM_PAE_ENABLED as a function parameter 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: Anthony PERARD , Andrew Cooper , Wei Liu , Ian Jackson Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The sole use of HVM_PARAM_PAE_ENABLED is as a non-standard calling conventi= on for xc_cpuid_apply_policy(). Pass PAE as a regular parameter instead. Leave a rather better explaination of why only HVM guests have a choice in = PAE setting. No functional change. Signed-off-by: Andrew Cooper --- CC: Ian Jackson CC: Wei Liu CC: Anthony PERARD --- tools/libxc/include/xenctrl.h | 2 +- tools/libxc/xc_cpuid_x86.c | 15 +++++---------- tools/libxl/libxl_cpuid.c | 14 +++++++++++++- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index 311df1ef0f..4eb4f4c2c6 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -1807,7 +1807,7 @@ int xc_cpuid_set(xc_interface *xch, int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, const uint32_t *featureset, - unsigned int nr_features); + unsigned int nr_features, bool pae); int xc_mca_op(xc_interface *xch, struct xen_mc *mc); int xc_mca_op_inject_v2(xc_interface *xch, unsigned int flags, xc_cpumap_t cpumap, unsigned int nr_cpus); diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c index 2540aa1e1c..4e74a7ed3b 100644 --- a/tools/libxc/xc_cpuid_x86.c +++ b/tools/libxc/xc_cpuid_x86.c @@ -455,7 +455,8 @@ int xc_cpuid_set( } =20 int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, - const uint32_t *featureset, unsigned int nr_feat= ures) + const uint32_t *featureset, unsigned int nr_feat= ures, + bool pae) { int rc; xc_dominfo_t di; @@ -579,8 +580,6 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t d= omid, } else { - uint64_t val; - /* * Topology for HVM guests is entirely controlled by Xen. For now= , we * hardcode APIC_ID =3D vcpu_id * 2 to give the illusion of no SMT. @@ -635,14 +634,10 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t= domid, } =20 /* - * HVM_PARAM_PAE_ENABLED is a parameter to this function, stashed = in - * Xen. Nothing else has ever taken notice of the value. + * PAE used to be a parameter passed to this function by + * HVM_PARAM_PAE_ENABLED. It is now passed normally. */ - rc =3D xc_hvm_param_get(xch, domid, HVM_PARAM_PAE_ENABLED, &val); - if ( rc ) - goto out; - - p->basic.pae =3D val; + p->basic.pae =3D pae; =20 /* * These settings are necessary to cause earlier HVM_PARAM_NESTEDH= VM / diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c index 49d3ca5b26..8c49e34125 100644 --- a/tools/libxl/libxl_cpuid.c +++ b/tools/libxl/libxl_cpuid.c @@ -416,8 +416,20 @@ void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domi= d, libxl_cpuid_policy_list cpuid =3D info->cpuid; int i; char *cpuid_res[4]; + bool pae =3D true; + + /* + * PAE is a Xen-controlled for PV guests (it is the 'p' that causes the + * difference between the xen-3.0-x86_32 and xen-3.0-x86_32p ABIs). I= t is + * mandatory as Xen is running in 64bit mode. + * + * PVH guests don't have a top-level PAE control, and is treated as + * available. + */ + if (info->type =3D=3D LIBXL_DOMAIN_TYPE_HVM) + pae =3D libxl_defbool_val(info->u.hvm.pae); =20 - xc_cpuid_apply_policy(ctx->xch, domid, NULL, 0); + xc_cpuid_apply_policy(ctx->xch, domid, NULL, 0, pae); =20 if (!cpuid) return; --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Thu Apr 18 09:48:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1580921508156927.2391524090244; Wed, 5 Feb 2020 08:51:48 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1izNtS-0000SQ-QU; Wed, 05 Feb 2020 16:51:14 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1izNtQ-0000Rw-NP for xen-devel@lists.xenproject.org; Wed, 05 Feb 2020 16:51:12 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b266ad96-4837-11ea-ad98-bc764e2007e4; Wed, 05 Feb 2020 16:51:04 +0000 (UTC) X-Inumbo-ID: b266ad96-4837-11ea-ad98-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1580921464; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wkRiF1V/Bg3ivbCm3TNMAkp/y/0fmOHfkDJ6wpVO1Ss=; b=KkIWFTwvVKgWK5cPk/h7QrJSVoMSqsiAlex4aGzpsPJVr9t5IEMPBxhr Xx4nczhqVx5SStGFslILmhkUuqtgWzdoPXEU/h6KvdBV5nUo354ojxQ0R Z0phcMm+PKwROHL4IVvbivMhSv9bHDgv3+8Z0YS3EJRiJHZvoxl8Ujxua 8=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: nBxv7lrf0X1sy3+VQdHdz0hUZyKn1zDMgHoSAHMbHXOKQs3md85Fe/2Db4sLcpwc5v6In3vj+y BbbVZb1hYU5jScHez0xhir6DqVX990LSIwZInv025difmvD1kulIg7fAz2T1zGGBZz68GQBZc1 jtg/wlnT9xUePbKTebxaVzE+JCdMytmcFweL7yNRtRc8hFUXJxtd2VLI9qISKhb9qCw+aNJEG/ h1hU0ThHeVS1wlx9aOuhR0COJzroXOK/xK0hIKDYPM6rVeR7zQ7ex94pIClJjF6xF+DZiZFk1H wVE= X-SBRS: 2.7 X-MesageID: 12612165 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,406,1574139600"; d="scan'208";a="12612165" From: Andrew Cooper To: Xen-devel Date: Wed, 5 Feb 2020 16:50:56 +0000 Message-ID: <20200205165056.11734-7-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200205165056.11734-1-andrew.cooper3@citrix.com> References: <20200205165056.11734-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 6/6] xen/public: Obsolete HVM_PARAM_PAE_ENABLED 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: Stefano Stabellini , Julien Grall , Wei Liu , Andrew Cooper , Jan Beulich , Anthony PERARD , Ian Jackson , Volodymyr Babchuk , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) HVM_PARAM_PAE_ENABLED is undocumented and Xen has never acted upon its valu= e, contrary perhaps to expectations based on how other boolean fields work. It was only ever used as a non-standard calling convention for xc_cpuid_apply_policy() but that has been fixed now. Purge its use, and any possible confusion over its behaviour, by having Xen reject any attempts to use it. Forgo setting it up in libxl's hvm_set_conf_params(). The only backwards compatibility necessary is to ha= ve the HVM restore stream discard it if found. Signed-off-by: Andrew Cooper Acked-by: Julien Grall Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Ian Jackson CC: Wei Liu CC: Anthony PERARD --- tools/libxc/xc_sr_restore_x86_hvm.c | 10 ++++++++++ tools/libxc/xc_sr_save_x86_hvm.c | 1 - tools/libxl/libxl_x86.c | 8 +------- xen/arch/arm/hvm.c | 3 ++- xen/arch/x86/hvm/hvm.c | 2 ++ xen/include/public/hvm/params.h | 2 +- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/tools/libxc/xc_sr_restore_x86_hvm.c b/tools/libxc/xc_sr_restor= e_x86_hvm.c index 3f78248f32..da1574ce11 100644 --- a/tools/libxc/xc_sr_restore_x86_hvm.c +++ b/tools/libxc/xc_sr_restore_x86_hvm.c @@ -72,6 +72,16 @@ static int handle_hvm_params(struct xc_sr_context *ctx, case HVM_PARAM_BUFIOREQ_PFN: xc_clear_domain_page(xch, ctx->domid, entry->value); break; + + case HVM_PARAM_PAE_ENABLED: + /* + * This HVM_PARAM only ever existed a non-standard calling ABI= for + * xc_cpuid_apply_policy(). It has now been updated to use a + * regular calling convention, making the param obsolete. + * + * Discard if we find it in an old migration stream. + */ + continue; } =20 rc =3D xc_hvm_param_set(xch, ctx->domid, entry->index, entry->valu= e); diff --git a/tools/libxc/xc_sr_save_x86_hvm.c b/tools/libxc/xc_sr_save_x86_= hvm.c index d99efe65e5..7d3f3ddb8f 100644 --- a/tools/libxc/xc_sr_save_x86_hvm.c +++ b/tools/libxc/xc_sr_save_x86_hvm.c @@ -71,7 +71,6 @@ static int write_hvm_params(struct xc_sr_context *ctx) HVM_PARAM_ACPI_IOPORTS_LOCATION, HVM_PARAM_VIRIDIAN, HVM_PARAM_IDENT_PT, - HVM_PARAM_PAE_ENABLED, HVM_PARAM_VM_GENERATION_ID_ADDR, HVM_PARAM_IOREQ_SERVER_PFN, HVM_PARAM_NR_IOREQ_SERVER_PAGES, diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c index 1cae0e2b26..f8bc828e62 100644 --- a/tools/libxl/libxl_x86.c +++ b/tools/libxl/libxl_x86.c @@ -391,12 +391,10 @@ static int hvm_set_conf_params(libxl__gc *gc, uint32_= t domid, libxl_ctx *ctx =3D libxl__gc_owner(gc); xc_interface *xch =3D ctx->xch; int ret =3D ERROR_FAIL; - bool pae =3D true, altp2m =3D info->altp2m; + bool altp2m =3D info->altp2m; =20 switch(info->type) { case LIBXL_DOMAIN_TYPE_HVM: - pae =3D libxl_defbool_val(info->u.hvm.pae); - /* The config parameter "altp2m" replaces the parameter "altp2mhvm= ". For * legacy reasons, both parameters are accepted on x86 HVM guests. * @@ -425,10 +423,6 @@ static int hvm_set_conf_params(libxl__gc *gc, uint32_t= domid, =20 /* Fallthrough */ case LIBXL_DOMAIN_TYPE_PVH: - if (xc_hvm_param_set(xch, domid, HVM_PARAM_PAE_ENABLED, pae)) { - LOG(ERROR, "Couldn't set HVM_PARAM_PAE_ENABLED"); - goto out; - } if (xc_hvm_param_set(xch, domid, HVM_PARAM_TIMER_MODE, timer_mode(info))) { LOG(ERROR, "Couldn't set HVM_PARAM_TIMER_MODE"); diff --git a/xen/arch/arm/hvm.c b/xen/arch/arm/hvm.c index 76b27c9168..f3426f37fe 100644 --- a/xen/arch/arm/hvm.c +++ b/xen/arch/arm/hvm.c @@ -46,7 +46,8 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(v= oid) arg) if ( copy_from_guest(&a, arg, 1) ) return -EFAULT; =20 - if ( a.index >=3D HVM_NR_PARAMS ) + if ( a.index >=3D HVM_NR_PARAMS || + a.index =3D=3D HVM_PARAM_PAE_ENABLED ) return -EINVAL; =20 d =3D rcu_lock_domain_by_any_id(a.domid); diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 00a9e70b7c..2b869ac997 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -4104,6 +4104,7 @@ static int hvm_allow_set_param(struct domain *d, case HVM_PARAM_X87_FIP_WIDTH: break; /* The following parameters are deprecated. */ + case HVM_PARAM_PAE_ENABLED: case HVM_PARAM_DM_DOMAIN: case HVM_PARAM_BUFIOREQ_EVTCHN: rc =3D -EPERM; @@ -4410,6 +4411,7 @@ static int hvm_allow_get_param(struct domain *d, case HVM_PARAM_X87_FIP_WIDTH: break; /* The following parameters are deprecated. */ + case HVM_PARAM_PAE_ENABLED: case HVM_PARAM_DM_DOMAIN: case HVM_PARAM_BUFIOREQ_EVTCHN: rc =3D -ENODATA; diff --git a/xen/include/public/hvm/params.h b/xen/include/public/hvm/param= s.h index 36832e4b94..faa6bda095 100644 --- a/xen/include/public/hvm/params.h +++ b/xen/include/public/hvm/params.h @@ -86,7 +86,7 @@ #define HVM_PARAM_STORE_PFN 1 #define HVM_PARAM_STORE_EVTCHN 2 =20 -#define HVM_PARAM_PAE_ENABLED 4 +#define HVM_PARAM_PAE_ENABLED 4 /* Obsolete. Do not use. */ =20 #define HVM_PARAM_IOREQ_PFN 5 =20 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel