From nobody Thu Nov 14 07:12:39 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; dkim=pass; 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=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1675200594; cv=none; d=zohomail.com; s=zohoarc; b=eU9ljuGpxb39apBc1K0yXrEvdmPx9gLZgdDx6k9VuYeo+rRLoRekob30nnEgUhITGZGRKTxEbuPTeqfPws2E5kmxzf2ypEMEzZrKUxyiXASmYW6d0CeNnkBki9+cUA1TcarKio+x5dLKnABX164UwR1vRzhQvnan1KtYGMLDa7U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675200594; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bPrl3LvoPJwWnwsdtx7GCzhCQ37d4a0YyLuQtV49+Ao=; b=n3IF0VKGjTM/szXgvtrbs8wBM7KS4mwNtExeYjdarsJJNigduR7xIZ2R76AOQCXdObCKWUkFZT+4TtGfdlDFAyGaBXW3+Kq1/FF+q8dkhOYszh5IkXxgqtKVz2kjUjvHEy4Ih6ZXmKyebVyONLxfkoUrRrFv4tylidGFOV82WjI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1675200594843265.26454632503703; Tue, 31 Jan 2023 13:29:54 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.487850.755613 (Exim 4.92) (envelope-from ) id 1pMyC8-0001Xy-CO; Tue, 31 Jan 2023 21:29:36 +0000 Received: by outflank-mailman (output) from mailman id 487850.755613; Tue, 31 Jan 2023 21:29:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pMyC8-0001VA-1g; Tue, 31 Jan 2023 21:29:36 +0000 Received: by outflank-mailman (input) for mailman id 487850; Tue, 31 Jan 2023 21:29:33 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pMyC5-0000Nb-Kl for xen-devel@lists.xenproject.org; Tue, 31 Jan 2023 21:29:33 +0000 Received: from esa1.hc3370-68.iphmx.com (esa1.hc3370-68.iphmx.com [216.71.145.142]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 599ac36b-a1ae-11ed-933c-83870f6b2ba8; Tue, 31 Jan 2023 22:29:32 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 599ac36b-a1ae-11ed-933c-83870f6b2ba8 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1675200571; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YZc3Qe4tQu/04xfxAwG/P7vQhM7bvhY61z2fO5lZ86M=; b=FotiXju3+4liJe4vHjhgOMTCs9TVfB+zVgxBhtX9ltBoKjhWldW57DsF jgDX8ZTyCF3y2Py+klAHfyo7CvrW1UwBAUlmPKhiKZ/dBWo/swI09+eW7 gXS/5P7YIe+u3+XgvypS2cJw+GZJt1RIcTD3loiooBiPJ42kKPMbIxbeE c=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 95499183 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.123 X-Policy: $RELAYED IronPort-Data: A9a23:rHDd5a7tMly7k5beTkGK4QxRtDnHchMFZxGqfqrLsTDasY5as4F+v mEcD23TOqzfMWenftsnPozjpEkP6MLXztRrQQNs+CEzHi5G8cbLO4+Ufxz6V8+wwm8vb2o8t plDNYOQRCwQZiWBzvt4GuG59RGQ7YnRGvynTraBYnoqLeNdYH9JoQp5nOIkiZJfj9G8Agec0 fv/uMSaM1K+s9JOGjt8B5mr9VU+45wehBtC5gZlPakQ5QeF/5UoJMl3yZ+ZfiOQrrZ8RoZWd 86bpJml82XQ+QsaC9/Nut4XpWVTH9Y+lSDX4pZnc/DKbipq/0Te4Y5iXBYoUm9Fii3hojxE4 I4lWapc6+seFvakdOw1C3G0GszlVEFM0OevzXOX6aR/w6BaGpdFLjoH4EweZOUlFuhL7W5m3 OQ9cAJKTA66nuu7zJbgFsBetNUaBZy+VG8fkikIITDxCP8nRdbIQrnQ5M8e1zA17ixMNa+AP YxDM2MpNUmeJUQVYT/7C7pn9AusrlD5fydVtxS+oq0v7nKI5AdwzKLsIJzefdniqcB9zxvE9 zOfrz+R7hcyF/yP8zuL8niWr/b+kwL/ZL80T52V36s/6LGU7jNKU0BHPbehmtGph0j7V99BJ kg8/is1sbN05EGtVsP6XRCzvDiDpBF0c9ZZDeAS8gyGzavQpQGDCQA5oiVpMYJ88pVsHHpzi wHPxomybdByjFGLYVuF0++m6hGsADEcIGMmPnMtfzkU2vC29enfkSnzZtpkFae0iPj8Fjfx3 y2GoUACulkDsSIY//7lpA6a2lpAsrCMF1dovVuPAgpJ+ysjPOaYi5qUBU83BBqqBKKQVRG/s XcNgKByB8heXMjWx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lmPck frcAKDVfmotHrbJUMQqCKhJU/QRg== X-IronPort-AV: E=Sophos;i="5.97,261,1669093200"; d="scan'208";a="95499183" From: Andrew Cooper To: Xen-devel CC: =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= , Andrew Cooper , Christian Lindig , David Scott , Rob Hoes Subject: [PATCH 5/7] tools/ocaml/xc: Fix binding for xc_domain_assign_device() Date: Tue, 31 Jan 2023 21:29:11 +0000 Message-ID: <20230131212913.6199-6-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20230131212913.6199-1-andrew.cooper3@citrix.com> References: <20230131212913.6199-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1675200595965100001 From: Edwin T=C3=B6r=C3=B6k The patch adding this binding was plain broken, and unreviewed. It modified the C stub to add a 4th parameter without an equivalent adjustment in the Ocaml side of the bindings. In 64bit builds, this causes us to dereference whatever dead value is in %r= cx when trying to interpret the rflags parameter. This has gone unnoticed because Xapi doesn't use this binding (it has its own), but unbreak the binding by passing RDM_RELAXED unconditionally for now (matching the libxl default behaviour). Fixes: 9b34056cb4 ("tools: extend xc_assign_device() to support rdm reserva= tion policy") Signed-off-by: Edwin T=C3=B6r=C3=B6k Signed-off-by: Andrew Cooper --- CC: Christian Lindig CC: David Scott CC: Edwin T=C3=B6r=C3=B6k CC: Rob Hoes --- tools/ocaml/libs/xc/xenctrl_stubs.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenc= trl_stubs.c index fd1f306f0202..291663bb278a 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -1245,17 +1245,12 @@ CAMLprim value stub_xc_domain_test_assign_device(va= lue xch, value domid, value d CAMLreturn(Val_bool(ret =3D=3D 0)); } =20 -static int domain_assign_device_rdm_flag_table[] =3D { - XEN_DOMCTL_DEV_RDM_RELAXED, -}; - -CAMLprim value stub_xc_domain_assign_device(value xch, value domid, value = desc, - value rflag) +CAMLprim value stub_xc_domain_assign_device(value xch, value domid, value = desc) { - CAMLparam4(xch, domid, desc, rflag); + CAMLparam3(xch, domid, desc); int ret; int domain, bus, dev, func; - uint32_t sbdf, flag; + uint32_t sbdf; =20 domain =3D Int_val(Field(desc, 0)); bus =3D Int_val(Field(desc, 1)); @@ -1263,10 +1258,8 @@ CAMLprim value stub_xc_domain_assign_device(value xc= h, value domid, value desc, func =3D Int_val(Field(desc, 3)); sbdf =3D encode_sbdf(domain, bus, dev, func); =20 - ret =3D Int_val(Field(rflag, 0)); - flag =3D domain_assign_device_rdm_flag_table[ret]; - - ret =3D xc_assign_device(_H(xch), _D(domid), sbdf, flag); + ret =3D xc_assign_device(_H(xch), _D(domid), sbdf, + XEN_DOMCTL_DEV_RDM_RELAXED); =20 if (ret < 0) failwith_xc(_H(xch)); --=20 2.11.0