From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644141562362196.4215074908384; Sun, 6 Feb 2022 01:59:22 -0800 (PST) Received: from localhost ([::1]:55762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGeKG-00087c-AT for importer@patchew.org; Sun, 06 Feb 2022 04:59:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44580) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdzt-0000AW-45 for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:17 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:34479) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdzn-0003dD-7j for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:16 -0500 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-150-t7yI1fGXMqGrZ5SCDQk_kA-1; Sun, 06 Feb 2022 04:37:51 -0500 Received: by mail-wm1-f69.google.com with SMTP id r8-20020a7bc088000000b0037bbf779d26so527468wmh.7 for ; Sun, 06 Feb 2022 01:37:51 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id 16sm5813922wmj.12.2022.02.06.01.37.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:37:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140272; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EU2zPx6JC+R5DZIlP0yKSn9BYb3OIhPFICOQQCHTxuk=; b=DuTUg6W/EcFU/pIfTr9tpuSQwhsSVDXsnQWmWXlBWyG1Lx4w0570Gs2os9i8f4MX1DUwd3 rFM0pTxaQimn2nPjzd02zLK4gM0oGlYjkYxbLyb8p+Tb7wyKByPoqYDHY48pUDN2g7eToI ejQRwtM8XfBLlv5MNbaRZDX13anJSxo= X-MC-Unique: t7yI1fGXMqGrZ5SCDQk_kA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=EU2zPx6JC+R5DZIlP0yKSn9BYb3OIhPFICOQQCHTxuk=; b=G/RgEKh/wQUSvPcarFgYdC3vRXll2hfYwatK6nAOohJxUlVP/VcBHkXrikrG7DJ+q6 RSkl3t5hlHs6JymnLSHWJ83GKfISkFZyRjQXpVHk7Rt1+AqaaMl42vmoVhrI/ac9oEQ8 XUNdsecoTM15Rss1pCnNu8v7zg8c1MO3g4W865tzAdzxYGfhIEb4RPy1NNlVv1oVShOr l86DE9rF4yl2Z5SiR5UHlpTzU3b7wnFzcs/nrpkkHYHnkc0bWMbpeQ7saoO4/b0N1QFE bklbWg1C0wtfwa5qJskTKrwh7LOJtv6X9BBV/3Hc3aizmPoCAjABxC35BSOliL1zdOvE K1Ng== X-Gm-Message-State: AOAM5311InMByGz4xj9M30nVlKZ97A2uJs0o06K3mlcjTJ+g74ePEZUp hnq6WdTa41D8BsjgntbCE1p+UQrWLEaD+q+/au7Aq6iEh5DGoZRo3Q+8YMtH7svSnMqpLDtXG75 0f9VhXTYKmxokZ3NVmTYCBBkDcRQ9G5s+wwyzt3gCPImMjLjdMYLF4gVR6oVv X-Received: by 2002:a5d:588c:: with SMTP id n12mr5934781wrf.496.1644140269945; Sun, 06 Feb 2022 01:37:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJyhdzHuP6Xv50uPVIdzoXZeIQ+jSR57T2baOdDuIOZ9dm2teipDlOgdk2y3/o0sHvUU/sTAMQ== X-Received: by 2002:a5d:588c:: with SMTP id n12mr5934763wrf.496.1644140269701; Sun, 06 Feb 2022 01:37:49 -0800 (PST) Date: Sun, 6 Feb 2022 04:37:47 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 01/24] cpuid: use unsigned for max cpuid Message-ID: <20220206093702.1282676-2-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Richard Henderson , Richard Henderson , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644141563861100001 __get_cpuid_max returns an unsigned value. For consistency, store the result in an unsigned variable. Cc: Paolo Bonzini Cc: Richard Henderson Signed-off-by: Michael S. Tsirkin Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- configure | 2 +- util/bufferiszero.c | 2 +- tcg/i386/tcg-target.c.inc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure b/configure index e6cfc0e4be..dfb9019b24 100755 --- a/configure +++ b/configure @@ -2768,7 +2768,7 @@ cat > $TMPC << EOF #include int main(void) { unsigned a, b, c, d; - int max =3D __get_cpuid_max(0, 0); + unsigned max =3D __get_cpuid_max(0, 0); =20 if (max >=3D 1) { __cpuid(1, a, b, c, d); diff --git a/util/bufferiszero.c b/util/bufferiszero.c index 695bb4ce28..ec3cd4ca15 100644 --- a/util/bufferiszero.c +++ b/util/bufferiszero.c @@ -272,7 +272,7 @@ static void init_accel(unsigned cache) =20 static void __attribute__((constructor)) init_cpuid_cache(void) { - int max =3D __get_cpuid_max(0, NULL); + unsigned max =3D __get_cpuid_max(0, NULL); int a, b, c, d; unsigned cache =3D 0; =20 diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 875311f795..4dab09f265 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -3747,7 +3747,7 @@ static void tcg_target_init(TCGContext *s) { #ifdef CONFIG_CPUID_H unsigned a, b, c, d, b7 =3D 0; - int max =3D __get_cpuid_max(0, 0); + unsigned max =3D __get_cpuid_max(0, 0); =20 if (max >=3D 7) { /* BMI1 is available on AMD Piledriver and Intel Haswell CPUs. */ --=20 MST From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644140563764462.0655229636051; Sun, 6 Feb 2022 01:42:43 -0800 (PST) Received: from localhost ([::1]:57082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGe4A-0006Dr-ES for importer@patchew.org; Sun, 06 Feb 2022 04:42:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdzs-00009T-Je for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:16 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:32413) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdzn-0003dI-5k for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:15 -0500 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-245-sDS0FTHoPi6MOvsJJZ3QSg-1; Sun, 06 Feb 2022 04:37:54 -0500 Received: by mail-wm1-f70.google.com with SMTP id l4-20020a05600c4f0400b0037bb2ce79d8so1951558wmq.9 for ; Sun, 06 Feb 2022 01:37:54 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id n8sm5896605wmk.18.2022.02.06.01.37.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:37:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140276; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=djZWuMgvZEcanxSuVKi0jq5sfyl2x4cIrvJR3neBz+A=; b=VhxJIlo9HbY6QrD3+4N3j60l43HOA9GVjvtprTuPMmH0NMpBWc0O+L4Q9SePrHKDzkkUyM TimZO4GxjexDv3iABCWkDSjtG0Ihe/gOh+1Rt0xY93SDR1w0B+XSvYEs1y4jfF6Nv03I1e iTliQDBQ/7WIlYIyzjt3kLN92mFI1RU= X-MC-Unique: sDS0FTHoPi6MOvsJJZ3QSg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=djZWuMgvZEcanxSuVKi0jq5sfyl2x4cIrvJR3neBz+A=; b=XCTr29AVKhjjnSNQfI/Cf47kHd470PwMcwqAoMnETL1i/GCd6KbbD4SKUgK51AeMCR 2Z7oiF6GQ85LdYwI4/KZjhdjKpHG1x4DNN0/rng1WL/HypR5mk6y+1FDT9wwZ9flXXk8 wDXn7yJnwWxFC7gR8m2LBZ1nwbdJXttUblZkIFx/qCSrQ+QAL7IV4YeHvfsc3KD3OTp8 +Eo70yNv6l/W9Qn/WhjfzSpI+YU0NWMJYK4u5FyrlaB13l28KCeIAsY79FNXGyqTtb+f B8x49nK30hOCVCvXCIr4Jw3iESup3+hODAiyWe+i3SvSGlldrCxefsNHsX5Tva51CtzO tImQ== X-Gm-Message-State: AOAM530lFLPBZSEKkuWRkS0JvAO7rkGFa/SmWQzOUL8m46O7FTAUjIeh J+xaRRqicLo788yw9TxhSGRF+mlDOHKfbWazqHCRRIc8BfpYITsJPSGa+tlooxfqqjmt9I6Tcy6 /Nv6c7ysXgRGTkYyWHc/4nlEGbSrOmTQh4TrtY/3Gk9vkxOi6HW6y27V2HZ5k X-Received: by 2002:adf:eb05:: with SMTP id s5mr5934204wrn.298.1644140272971; Sun, 06 Feb 2022 01:37:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJz5MxbZoHnBjb3rlieL3eSYbIOyVpnUWPU2Fbrxu2Lrz3rydC9lafWoRnbqYGcllMTTRJZx6w== X-Received: by 2002:adf:eb05:: with SMTP id s5mr5934184wrn.298.1644140272763; Sun, 06 Feb 2022 01:37:52 -0800 (PST) Date: Sun, 6 Feb 2022 04:37:49 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 02/24] hw/i386: Add the possibility to disable the 'isapc' machine Message-ID: <20220206093702.1282676-3-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Peter Maydell , Thomas Huth , qemu-block@nongnu.org, Laurent Vivier , Richard Henderson , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Paolo Bonzini , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644140564519100001 From: Thomas Huth We already have a CONFIG_ISAPC switch - but we're not using it yet. Add some "#ifdefs" to make it possible to disable this machine now. Signed-off-by: Thomas Huth Message-Id: <20220107160713.235918-1-thuth@redhat.com> Acked-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/pc_piix.c | 5 ++++- tests/qtest/cdrom-test.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 7c7790a5ce..d9b344248d 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -357,10 +357,12 @@ static void pc_compat_1_4_fn(MachineState *machine) pc_compat_1_5_fn(machine); } =20 +#ifdef CONFIG_ISAPC static void pc_init_isa(MachineState *machine) { pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, TYPE_I440FX_PCI_DEVICE); } +#endif =20 #ifdef CONFIG_XEN static void pc_xen_hvm_init_pci(MachineState *machine) @@ -916,6 +918,7 @@ void igd_passthrough_isa_bridge_create(PCIBus *bus, uin= t16_t gpu_dev_id) pci_config_set_revision(bridge_dev->config, pch_rev_id); } =20 +#ifdef CONFIG_ISAPC static void isapc_machine_options(MachineClass *m) { PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); @@ -935,7 +938,7 @@ static void isapc_machine_options(MachineClass *m) =20 DEFINE_PC_MACHINE(isapc, "isapc", pc_init_isa, isapc_machine_options); - +#endif =20 #ifdef CONFIG_XEN static void xenfv_4_2_machine_options(MachineClass *m) diff --git a/tests/qtest/cdrom-test.c b/tests/qtest/cdrom-test.c index cfca24fa94..fdd889a487 100644 --- a/tests/qtest/cdrom-test.c +++ b/tests/qtest/cdrom-test.c @@ -138,7 +138,7 @@ static void add_x86_tests(void) * Unstable CI test under load * See https://lists.gnu.org/archive/html/qemu-devel/2019-02/msg05509.= html */ - if (g_test_slow()) { + if (g_test_slow() && qtest_has_machine("isapc")) { qtest_add_data_func("cdrom/boot/isapc", "-M isapc " "-drive if=3Dide,media=3Dcdrom,file=3D", test_= cdboot); } --=20 MST From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644140636655855.004686394181; Sun, 6 Feb 2022 01:43:56 -0800 (PST) Received: from localhost ([::1]:60552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGe5L-0008VJ-Lx for importer@patchew.org; Sun, 06 Feb 2022 04:43:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44564) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdzs-00009R-K0 for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:16 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:55934) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdzn-0003dR-7J for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:16 -0500 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-613-7E-Xi93BOpm2H9fvr9TvGw-1; Sun, 06 Feb 2022 04:37:57 -0500 Received: by mail-wm1-f70.google.com with SMTP id bg16-20020a05600c3c9000b0034bea12c043so10235109wmb.7 for ; Sun, 06 Feb 2022 01:37:56 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id o10sm339582wrq.63.2022.02.06.01.37.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:37:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Cys7fA3V9JqsHSWEFuxYME8lo9Xx2jeY6AGCu56+bB4=; b=Z5de8+naCJV+36fnlJRmxk+jqARjF3UQwB6wvywR5L59rzKEdiLVF2tHqp2Ui8lUjjb+vC ffHHUfkkP4s/sv5c2mY+wC4qRLHyCWBVDwK1TTxzAMtCmPMdL4s2YYLPWV7zXc6/45N3UW e9GJKwmzj2mpSoE966akjrnkcKn37a8= X-MC-Unique: 7E-Xi93BOpm2H9fvr9TvGw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Cys7fA3V9JqsHSWEFuxYME8lo9Xx2jeY6AGCu56+bB4=; b=fiaeCQfjEpgXugGvjWlpW8JMQw+WXFn4rWBIeVMOpITK8gS1SjKMjdhqMmPTcSkUK/ bMIDpzNpcBFNNZlLjHo8L4I8oEG0YPKzVxmfFACmZgowDbAfaEpq8Qq3t52p8scdDySc p4gpRxlYq1yLeWb9+XBDghdh6nZx89taRytDA7K2gZJT8towZNscn/DxYW5nGP6kBYuZ MKqzteod1jY8yvTWi/t627tkrXGj2BxB1l2D/IraGdeDex7E+fUGgZgNnpUv1c0+DaCL L03YjZLNm0dJzxg28CSSmEymKkN7an7rN5EMLJq4KIG6/cEw8hLdRgNyxJsIAUM48bo3 TrYw== X-Gm-Message-State: AOAM530y9tR/Q9CefIqlD3vUhj2G43t2pb79/T6OhZoHRDrV4As3wKSe lz0E02Bw7A5TD6JMkAKS28LbVIIl7BAqFNYhRV3uMPblQhcJkVYgEKC1y21t92wQDh7J0+dWZxu EXkXblez8x6DUlhYKhLP/lISSS3dh+OPnQzi/KReMmLiAzfZndsv7TxN8ziFc X-Received: by 2002:a5d:584a:: with SMTP id i10mr5867060wrf.75.1644140275483; Sun, 06 Feb 2022 01:37:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJyR/IS8ZNdu1u4MY1tit4KaMPXEprd6Xxq6l+5UlooXIZhOakQ9sCQonHYOzYKFVNZfio3UPQ== X-Received: by 2002:a5d:584a:: with SMTP id i10mr5867038wrf.75.1644140275239; Sun, 06 Feb 2022 01:37:55 -0800 (PST) Date: Sun, 6 Feb 2022 04:37:52 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 03/24] tests: acpi: manually pad OEM_ID/OEM_TABLE_ID for test_oem_fields() test Message-ID: <20220206093702.1282676-4-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644140637692100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov The next commit will revert OEM fields padding with whitespace to padding with '\0' as it was before [1]. As result test_oem_fields() will fail due to unexpectedly smaller ID sizes read from QEMU ACPI tables. Pad OEM_ID/OEM_TABLE_ID manually with spaces so that values the test puts on QEMU CLI and expected values match. 1) 602b458201 ("acpi: Permit OEM ID and OEM table ID fields to be changed") Signed-off-by: Igor Mammedov Message-Id: <20220112130332.1648664-2-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index e6b72d9026..90c9f6a0a2 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -71,9 +71,10 @@ =20 #define ACPI_REBUILD_EXPECTED_AML "TEST_ACPI_REBUILD_AML" =20 -#define OEM_ID "TEST" -#define OEM_TABLE_ID "OEM" -#define OEM_TEST_ARGS "-machine x-oem-id=3D"OEM_ID",x-oem-table-id=3D= "OEM_TABLE_ID +#define OEM_ID "TEST " +#define OEM_TABLE_ID "OEM " +#define OEM_TEST_ARGS "-machine x-oem-id=3D'" OEM_ID "',x-oem-table-i= d=3D'" \ + OEM_TABLE_ID "'" =20 typedef struct { bool tcg_only; @@ -1519,11 +1520,7 @@ static void test_acpi_q35_slic(void) static void test_oem_fields(test_data *data) { int i; - char oem_id[6]; - char oem_table_id[8]; =20 - strpadcpy(oem_id, sizeof oem_id, OEM_ID, ' '); - strpadcpy(oem_table_id, sizeof oem_table_id, OEM_TABLE_ID, ' '); for (i =3D 0; i < data->tables->len; ++i) { AcpiSdtTable *sdt; =20 @@ -1533,8 +1530,8 @@ static void test_oem_fields(test_data *data) continue; } =20 - g_assert(memcmp(sdt->aml + 10, oem_id, 6) =3D=3D 0); - g_assert(memcmp(sdt->aml + 16, oem_table_id, 8) =3D=3D 0); + g_assert(memcmp(sdt->aml + 10, OEM_ID, 6) =3D=3D 0); + g_assert(memcmp(sdt->aml + 16, OEM_TABLE_ID, 8) =3D=3D 0); } } =20 --=20 MST From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644140893431891.1563405593951; Sun, 6 Feb 2022 01:48:13 -0800 (PST) Received: from localhost ([::1]:39018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGe9U-0004hM-AD for importer@patchew.org; Sun, 06 Feb 2022 04:48:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44522) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdzr-00009Q-7x for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:16 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37704) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdzn-0003dV-3p for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:14 -0500 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-532-BSnAjnb2NKSQhyMffYc0kg-1; Sun, 06 Feb 2022 04:37:59 -0500 Received: by mail-wr1-f70.google.com with SMTP id q4-20020adfbb84000000b001dd3cfddb2dso3785056wrg.11 for ; Sun, 06 Feb 2022 01:37:59 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id t1sm8014997wre.45.2022.02.06.01.37.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:37:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140280; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+T8qucJ387ei/9dUQXGMLrCgzMKuOac0iEv5x3VIdi8=; b=gsvUSHKU13W+I6WcwrCd6JXKa1UKcktONWDyan8AUNTKcRbSPrGe8l2EZHX6QnUCq+42XH TbNFL+qCz91Mnxb9W8mYdrqJEv2B+YPkJXrpMw+4A9A3gd0G/s0M+xQSxjQSxgc4pr3m5M MNV9kzdIW7vH6eAe+lOz5ACKK76ILJI= X-MC-Unique: BSnAjnb2NKSQhyMffYc0kg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=+T8qucJ387ei/9dUQXGMLrCgzMKuOac0iEv5x3VIdi8=; b=mKsDKlGRSOcx21jicZy8Ssvqtxd/0EyaIZUmYrqw1VLeFSQiE2H73Jv4qnOJVCpjSk 98q/Eqi2VkkBQqcI5t63j4X2rU1NSvz0Mr0DmXf/iXJkQvSy3AxsIkHBrJTzH7v5A3lg WzdjgHyu6h/BcsjxQWoTdBd3SHEbO7aKEOK7ohmgn6/i6KSvUe4jvPQCRadDIXZiPzLA UjlpDkELS1dLQUWcNaAWXQR1vowRTJmWlpGtRqsS5AYDZOzjliHxyWVPuldqiwdZMGxG 2vqbxdPgUVvftaOUgqqqSjpPj7w0B6QTg0r5zcgK4XTeT0cVTtf+1p9An1aN6qpcdf8T ketw== X-Gm-Message-State: AOAM530eUJOli5+TpwA7+kxV4ZJDzPtk+G7Qcn7TA/yqj7X17HXa3Mac ULewQGyW5/WrwQrubYbcjYOGVu+cwTkm+Ty66TT6t7IU6dgj/XabNRyU4Fr3XBKcWdyDZE136Iy GfdixZffcfLBFIx2JGgorkLo4OPC1U+4lQpnvd/wC7Ns+8VSw0zQQ0NGaf0jQ X-Received: by 2002:a5d:4dcc:: with SMTP id f12mr994129wru.598.1644140277809; Sun, 06 Feb 2022 01:37:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJzbewlkIsGqZlE/zpO5BJ9FW5pKJnEX146ZV+hkDr5W9u/4yC9Mr6J9i+8aweqEbOr/x4Z7ug== X-Received: by 2002:a5d:4dcc:: with SMTP id f12mr994114wru.598.1644140277617; Sun, 06 Feb 2022 01:37:57 -0800 (PST) Date: Sun, 6 Feb 2022 04:37:55 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 04/24] tests: acpi: whitelist nvdimm's SSDT and FACP.slic expected blobs Message-ID: <20220206093702.1282676-5-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644140894953100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov The next commit will revert OEM fields whitespace padding to padding with '\0' as it was before [1]. That will change OEM Table ID for: * SSDT.*: where it was padded from 6 characters to 8 * FACP.slic: where it was padded from 2 characters to 8 after reverting whitespace padding, it will be replaced with '\0' which effectively will shorten OEM table ID to 6 and 2 characters. Whitelist affected tables before introducing the change. 1) 602b458201 ("acpi: Permit OEM ID and OEM table ID fields to be changed") Signed-off-by: Igor Mammedov Message-Id: <20220112130332.1648664-3-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index dfb8523c8b..7faa8f53be 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,5 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/virt/SSDT.memhp", +"tests/data/acpi/pc/SSDT.dimmpxm", +"tests/data/acpi/q35/SSDT.dimmpxm", +"tests/data/acpi/q35/FACP.slic", --=20 MST From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644141281149961.2611394639008; Sun, 6 Feb 2022 01:54:41 -0800 (PST) Received: from localhost ([::1]:49798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGeFk-0003zB-1y for importer@patchew.org; Sun, 06 Feb 2022 04:54:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44566) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdzs-00009S-Jq for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:16 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:34977) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdzn-0003en-7e for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:16 -0500 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-503-CIi5Aj_3PZaedtDrSDjEKA-1; Sun, 06 Feb 2022 04:38:02 -0500 Received: by mail-wr1-f71.google.com with SMTP id d14-20020adfa40e000000b001e31d239d25so18504wra.14 for ; Sun, 06 Feb 2022 01:38:02 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id o12sm7625807wry.115.2022.02.06.01.37.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:37:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140283; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7KcsN9wh78ObpWmFzT4JOGjUX5sRs+uFsgg22ySvULc=; b=ZLJTC/c8ePpzscFZ0q5RC7wrlldiib47nTM+N5by5LYemGEyjSLCRWLhp3t4U3yYa6aQzV qcG0vaRA3XYyt8XuSX/r41DLE7gRm7SistKoX/o+bymc8ntt7/zq27x0b9ba9rnRwWwbbd WsoicaYKLpTF6N7m7hQ+h4PVZFJ+5C0= X-MC-Unique: CIi5Aj_3PZaedtDrSDjEKA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=7KcsN9wh78ObpWmFzT4JOGjUX5sRs+uFsgg22ySvULc=; b=DqKQYNj0bjERdlxhG9EvPPEnZiKYhVgYQkY1iu1vvN/rklbKJqpkBFsrEDdTr1XRko jmay3WeP89hfIe9BuIpJYVuzR1no+WephdRwBIDb7aGlYc044tVgdFDADiwZveZ5BB46 nRyRNLVC58jkwEvOwAdxiRcr/9IMtdLqgMC7yeL0HO0zhKtylf5MLgQRA0HZfr4yMQcy 55ybFks52VJZNjWMmiDja8mm8oRM9n88DrvcxU9CY9Poiw26mJ6yU1jEPmepeBFQ+ru+ tgb7fNT2BJYSrbwidm50CU5WPS0m8rX5tEGdgufyt5WcILS/vBGr8jBBFUGUoNfeNrjd F/aQ== X-Gm-Message-State: AOAM530P5y6HtZiZMDgxYDWyfLW+b45JfrXqS1kAhbZ+jzqCNkt6ZIRf yc5JZs0TP0AdtBHAi4TWKX9VsSwl7blcEPEAJTesl4ozbbFBu3jOK1hNvR260ckAfn9A8IfJto4 NUy6ewIKK8orpineLL3SJ+8V4/E/iZ2Ma5fewlSRkvMsVUkoP/aBZB1kJ9Af9 X-Received: by 2002:a5d:6486:: with SMTP id o6mr5727473wri.636.1644140280551; Sun, 06 Feb 2022 01:38:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJySYc8GUUyi2HKLco9knqZosFJaz0AeQX/MDCMHYFFvYG+pRmDIDYhDrWfaeSWSNdKzAyyToA== X-Received: by 2002:a5d:6486:: with SMTP id o6mr5727456wri.636.1644140280290; Sun, 06 Feb 2022 01:38:00 -0800 (PST) Date: Sun, 6 Feb 2022 04:37:57 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 05/24] acpi: fix OEM ID/OEM Table ID padding Message-ID: <20220206093702.1282676-6-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , qemu-stable@nongnu.org, "Dmitry V . Orekhov" , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644141294215100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov Commit [2] broke original '\0' padding of OEM ID and OEM Table ID fields in headers of ACPI tables. While it doesn't have impact on default values since QEMU uses 6 and 8 characters long values respectively, it broke usecase where IDs are provided on QEMU CLI. It shouldn't affect guest (but may cause licensing verification issues in guest OS). One of the broken usecases is user supplied SLIC table with IDs shorter than max possible length, where [2] mangles IDs with extra spaces in RSDT and FADT tables whereas guest OS expects those to mirror the respective values of the used SLIC table. Fix it by replacing whitespace padding with '\0' padding in accordance with [1] and expectations of guest OS 1) ACPI spec, v2.0b 17.2 AML Grammar Definition ... //OEM ID of up to 6 characters. If the OEM ID is //shorter than 6 characters, it can be terminated //with a NULL character. 2) Fixes: 602b458201 ("acpi: Permit OEM ID and OEM table ID fields to be chang= ed") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/707 Reported-by: Dmitry V. Orekhov Signed-off-by: Igor Mammedov Cc: qemu-stable@nongnu.org Message-Id: <20220112130332.1648664-4-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Ani Sinha Tested-by: Dmitry V. Orekhov dima.orekhov@gmail.com --- hw/acpi/aml-build.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index bb2cad63b5..8966e16320 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1724,9 +1724,9 @@ void acpi_table_begin(AcpiTable *desc, GArray *array) build_append_int_noprefix(array, 0, 4); /* Length */ build_append_int_noprefix(array, desc->rev, 1); /* Revision */ build_append_int_noprefix(array, 0, 1); /* Checksum */ - build_append_padded_str(array, desc->oem_id, 6, ' '); /* OEMID */ + build_append_padded_str(array, desc->oem_id, 6, '\0'); /* OEMID */ /* OEM Table ID */ - build_append_padded_str(array, desc->oem_table_id, 8, ' '); + build_append_padded_str(array, desc->oem_table_id, 8, '\0'); build_append_int_noprefix(array, 1, 4); /* OEM Revision */ g_array_append_vals(array, ACPI_BUILD_APPNAME8, 4); /* Creator ID */ build_append_int_noprefix(array, 1, 4); /* Creator Revision */ --=20 MST From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644140644382225.46972725945034; Sun, 6 Feb 2022 01:44:04 -0800 (PST) Received: from localhost ([::1]:60948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGe5T-0000Kj-DP for importer@patchew.org; Sun, 06 Feb 2022 04:44:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44570) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdzs-00009U-K8 for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:16 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:28918) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdzn-0003f4-78 for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:16 -0500 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-616-9foYImM_NtKHpSS81m5gKQ-1; Sun, 06 Feb 2022 04:38:05 -0500 Received: by mail-wm1-f71.google.com with SMTP id h82-20020a1c2155000000b003552c13626cso5868818wmh.3 for ; Sun, 06 Feb 2022 01:38:05 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id l29sm10218404wms.1.2022.02.06.01.38.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:38:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140286; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ALRDgS1o8czRYC4IeFcfTwDqPAZgH2apoiLtTHvcCYM=; b=MufczOmqgyqQ3gNUquGfexLL4PJiN2mpTtkyZuf95noYEJ7SG75aE/SD+Lg9fTOEwu6oVp cscFVf+CCK0oSDA0ylDeco1mwr5WuVRtbyDRpnFH5T4Of1OQ+MbI39bLmPmuI+XmBCkVL2 TDlafkldKBBOLC6K2pqe7pa3bh9zNdI= X-MC-Unique: 9foYImM_NtKHpSS81m5gKQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ALRDgS1o8czRYC4IeFcfTwDqPAZgH2apoiLtTHvcCYM=; b=74L8J14vfzztpUhmTYmql6TKwzG0Z7rbwBYhoS2KFQ42jk2tgyNHQo+zS7fkr4LXDV UfszCe3LPl6BxY96BmhssLyERybGYrq02Gy5bElmN5UjoFZQOcvrep5+qu2Qqdosjt8B SVCRqpx3RhrRl5pTwIlJf1Xtj5myTGa8zpmiC9kWOPrt//OWlhYqjq2HF2zE+F9xLgVZ rLinC5hD/OuIY2ZlKBJcrf99M6l6Mgx1bJlML9O62iSSHmZUpYzedxdkeatnHURuOL/H 3cot1rp06hoRZrplj4ja2QoKwDMfa+zGhfEpz4EW0vbTPgZ+jlvIcJr8yGRI2fyVqL/x X+bg== X-Gm-Message-State: AOAM533zyCcM0Ui5JzqP0QJG/m5xDjhyspqnSxm1jJ+9ggRG6P/IelAC TxienRlqsGaBitKorsDpuaOArNlgI4VE+h/ba9miXpF4YqHBmo3PBhVF//eO3G2C2V1ZZQBja/C NfqTCDuzvfm7abrE9VNbq5K6VtYShHDTUnp8rBIlM+okkSGXD72PQWUt/YUrZ X-Received: by 2002:a5d:588c:: with SMTP id n12mr4978188wrf.529.1644140284202; Sun, 06 Feb 2022 01:38:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJyR9YNauYAWY0Cf9sClLDTJpSaoc42AVCmYG65wCyC3RHxIxL5wkyWYQZ2CYv3rhu95VX97bw== X-Received: by 2002:a5d:588c:: with SMTP id n12mr4978171wrf.529.1644140283910; Sun, 06 Feb 2022 01:38:03 -0800 (PST) Date: Sun, 6 Feb 2022 04:38:00 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 06/24] tests: acpi: update expected blobs Message-ID: <20220206093702.1282676-7-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644140645913100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov Expected changes caused by previous commit: nvdimm ssdt (q35/pc/virt): - * OEM Table ID "NVDIMM " + * OEM Table ID "NVDIMM" SLIC test FADT (tests/data/acpi/q35/FACP.slic): -[010h 0016 8] Oem Table ID : "ME " +[010h 0016 8] Oem Table ID : "ME" Signed-off-by: Igor Mammedov Message-Id: <20220112130332.1648664-5-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 4 ---- tests/data/acpi/pc/SSDT.dimmpxm | Bin 734 -> 734 bytes tests/data/acpi/q35/FACP.slic | Bin 244 -> 244 bytes tests/data/acpi/q35/SSDT.dimmpxm | Bin 734 -> 734 bytes tests/data/acpi/virt/SSDT.memhp | Bin 736 -> 736 bytes 5 files changed, 4 deletions(-) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index 7faa8f53be..dfb8523c8b 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1,5 +1 @@ /* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/virt/SSDT.memhp", -"tests/data/acpi/pc/SSDT.dimmpxm", -"tests/data/acpi/q35/SSDT.dimmpxm", -"tests/data/acpi/q35/FACP.slic", diff --git a/tests/data/acpi/pc/SSDT.dimmpxm b/tests/data/acpi/pc/SSDT.dimm= pxm index a50a961fa1d9b0dd8ea4096d652c83bcf04db20b..ac55387d57e48adb99eb738a102= 308688a262fb8 100644 GIT binary patch delta 33 ocmcb|dXH5iIM^lR9uortW0;e_vq!LkUzm%huP+0`Mu}rg0HzrUKL7v# delta 33 ocmcb|dXH5iIM^lR9uortqnMMwvq!LkUzm%hudjl_Mu}rg0HV1GKL7v# diff --git a/tests/data/acpi/q35/FACP.slic b/tests/data/acpi/q35/FACP.slic index 891fd4b784b7b6b3ea303976db7ecd5b669bc84b..15986e095cf2db7ee92f7ce113c= 1d46d54018c62 100644 GIT binary patch delta 32 lcmeyu_=3DQoz&CxmF3j+fK^CjmX$6yZyUsoUp2qsG00RW!Z2#x>% delta 32 kcmeyu_=3DQoz&CxmF3j+fKvygL;W3Y#Uud4zWOq93-0G2oijsO4v diff --git a/tests/data/acpi/q35/SSDT.dimmpxm b/tests/data/acpi/q35/SSDT.di= mmpxm index 617a1c911c7d6753bcedc8ecc52e3027a5259ad6..98e6f0e3f3bb02dd419e36bdd1d= b9b94c728c406 100644 GIT binary patch delta 33 ocmcb|dXH5iIM^lR9uortqnnezvq!LkUzm%huP+0`Mu}rg0Ho;&F8}}l delta 33 ocmcb|dXH5iIM^lR9uortBb$@Ivq!LkUzm%hudjl_Mu}rg0HKKqF8}}l diff --git a/tests/data/acpi/virt/SSDT.memhp b/tests/data/acpi/virt/SSDT.me= mhp index e8b850ae2239d8f496b12de672c2a1268e2f269d..375d7b6fc85a484f492a26ccd35= 5c205f2c34473 100644 GIT binary patch delta 33 ocmaFB`hZm;IM^lR0TTlQqrH>Avq!LkUzm%huP+0`Mu`(l0HqiSFaQ7m delta 33 ocmaFB`hZm;IM^lR0TTlQ<9{cAXOCb7zc3e1Uta} Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644140494020526.450332278044; Sun, 6 Feb 2022 01:41:34 -0800 (PST) Received: from localhost ([::1]:53542 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGe32-0003kA-Hk for importer@patchew.org; Sun, 06 Feb 2022 04:41:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdzq-00009C-Vu for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:16 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:33171) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdzn-0003fA-78 for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:14 -0500 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-610-5sJEmhkUM0a2jYEtgbOcBg-1; Sun, 06 Feb 2022 04:38:08 -0500 Received: by mail-wm1-f70.google.com with SMTP id l20-20020a05600c1d1400b0035153bf34c3so10258132wms.2 for ; Sun, 06 Feb 2022 01:38:08 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id l28sm3839152wrz.90.2022.02.06.01.38.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:38:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140289; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Pdwtg4YsnAYbmN/x8hq/7VP0oKua1VQsoEaxNXs2NSc=; b=C6+9OvKfdumKW2zFevEz5UtK4Y+3Msqc3KD78h+AhRWN3ql2IbY6j2MmKCGhjAIpQGas/3 CYUQZXogBinDV/2DyXY+tnj+Ih5JQhTPEzrg56FFHuS7x7ElzWLkoqsZiNdAiNcRQ6TZEC BgG9mT6CsSDMyAA1CMI4YfZBgd4Tn94= X-MC-Unique: 5sJEmhkUM0a2jYEtgbOcBg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Pdwtg4YsnAYbmN/x8hq/7VP0oKua1VQsoEaxNXs2NSc=; b=cw9HLPW+vQusxdisTBWpThb+bnWdz3fkvuxq07Cm4A0SFg2OmXYdn9sMP8+gn8MP0b rF8+Txmtv3MZSbGKH1IG6NYHBJ3JA6O9lxehw9gQXkVUXm/u4dAH9nDmD8qe7xkaB0i7 n8vOPVUr5U+zNfJoETWp+++/ejgypuFjWLMBbVE89QkBvGxD8uKRCoXfLO/28FKOvLPc pDQrA0qgm3T2Fsgh+481ctxRLRRbh/SuSU8CLjHgSWN9DgWWztKwHIciRyDJtWncVuIU NVAVKS+JJos3GpeSDTNGAYtuI3/p2RGKccY23yDsw4zFSWh/HZgv90vlRBn6SIf+EPIa Ed+g== X-Gm-Message-State: AOAM53296Qtcjld4FHamEY/gm4uOEgNomi0UEDajRrgPZ6ut7CqJeNSL 5wgDTvIoOsTrvyukEnZtimSjcHlOdE5Z2s7AGao3Jtm+Ehdd6LHboYwJTbgMjvTTbW+medmqfiy YHAcL5ke+ZbJbL0zFikkpkSG3/QyJQUguEZnL6s2A3yMr43UIQnhQHQAxmp6X X-Received: by 2002:adf:dc08:: with SMTP id t8mr5850324wri.40.1644140286692; Sun, 06 Feb 2022 01:38:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJyLKGnb4GW93mb2cBOhhx4yvb0tEiA+yN3BY2I5YoKlD1fmpgrdNRv01LvzIpI88aQ0mqtDyg== X-Received: by 2002:adf:dc08:: with SMTP id t8mr5850306wri.40.1644140286521; Sun, 06 Feb 2022 01:38:06 -0800 (PST) Date: Sun, 6 Feb 2022 04:38:04 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 07/24] tests: acpi: test short OEM_ID/OEM_TABLE_ID values in test_oem_fields() Message-ID: <20220206093702.1282676-8-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644140494883100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov Previous patch [1] added explicit whitespace padding to OEM_ID/OEM_TABLE_ID values used in test_oem_fields() testcase to avoid false positive and bisection issues when QEMU is switched to \0' padding. As result testcase ceased to test values that were shorter than max possible length values. Update testcase to make sure that it's testing shorter IDs like it used to before [2]. 1) "tests: acpi: manually pad OEM_ID/OEM_TABLE_ID for test_oem_fields() te= st" 2) 602b458201 ("acpi: Permit OEM ID and OEM table ID fields to be changed") Signed-off-by: Igor Mammedov Message-Id: <20220114142641.1727679-1-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 90c9f6a0a2..ad536fd7b1 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -71,10 +71,10 @@ =20 #define ACPI_REBUILD_EXPECTED_AML "TEST_ACPI_REBUILD_AML" =20 -#define OEM_ID "TEST " -#define OEM_TABLE_ID "OEM " -#define OEM_TEST_ARGS "-machine x-oem-id=3D'" OEM_ID "',x-oem-table-i= d=3D'" \ - OEM_TABLE_ID "'" +#define OEM_ID "TEST" +#define OEM_TABLE_ID "OEM" +#define OEM_TEST_ARGS "-machine x-oem-id=3D" OEM_ID ",x-oem-table-id= =3D" \ + OEM_TABLE_ID =20 typedef struct { bool tcg_only; @@ -1530,8 +1530,8 @@ static void test_oem_fields(test_data *data) continue; } =20 - g_assert(memcmp(sdt->aml + 10, OEM_ID, 6) =3D=3D 0); - g_assert(memcmp(sdt->aml + 16, OEM_TABLE_ID, 8) =3D=3D 0); + g_assert(strncmp((char *)sdt->aml + 10, OEM_ID, 6) =3D=3D 0); + g_assert(strncmp((char *)sdt->aml + 16, OEM_TABLE_ID, 8) =3D=3D 0); } } =20 --=20 MST From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644141787102470.9755091128907; Sun, 6 Feb 2022 02:03:07 -0800 (PST) Received: from localhost ([::1]:34446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGeNu-0004RV-2R for importer@patchew.org; Sun, 06 Feb 2022 05:03:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44598) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdzu-0000DJ-QD for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:21884) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdzo-0003fa-5w for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:17 -0500 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-5-IfAQe1qVOleG0EFg6GEiwg-1; Sun, 06 Feb 2022 04:38:10 -0500 Received: by mail-wm1-f71.google.com with SMTP id l20-20020a05600c1d1400b0035153bf34c3so10258187wms.2 for ; Sun, 06 Feb 2022 01:38:10 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id q140sm3482835wme.16.2022.02.06.01.38.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:38:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140291; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=FMY8xR93DQQSXRTh9cIog6ZkSuUw4ea/EPUUeaxLWQ8=; b=GNPmD85euDZqyVlA8JfIv0ZkHLO313Y0K1XhmzFTP9Z+TzrUUQw9Z448YwF1Pwj71Ar+Yn A1o4/MI+Rjq8an1cmz+Tw+U8uQEVQfUcdzIBmaHiWU+tn3R366DzIW6zQjwy9TOYfVPJTn gvSQAVN57Cf7Wj7yr1ajlAKFuTW39ZU= X-MC-Unique: IfAQe1qVOleG0EFg6GEiwg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=FMY8xR93DQQSXRTh9cIog6ZkSuUw4ea/EPUUeaxLWQ8=; b=k0qTRF7JyHNypIT973ndpjSA2SyKF0vwa0JXKaghVeZn8ZCsU6nmbmvOz/YJHK8EVj QLwR9Hv3kAIoMaj0cYYM4dlauVltz+nZt5q7hNllrHIAsgMFTBPO3kFkC+7wYKF4OQ9p opsAZijhDc9ePZQWTzrqAC08gQZjAm1Gjhe/4T3W2/0q+wI3Vc6ogUpj54/g2e4+rB5U LKDJRYuToTQ+Wvmx8UtWzP0N8d+vMAHAtU3sffDI1Em2fvvcYHcy24YCCMV5VtDQnN1y gXOni+Zk0EtaEID7qcmwlzfAaT2UN64UyL47zymTbfD25rnyg0qHw5gVPvSZVgifk9oo mlXw== X-Gm-Message-State: AOAM531N+UVcTsBwVaiNQKKgUSDvqxwCU3AwadgLHeD67RhPDYOBTF05 6jzPFb+gT4dlEL+mPM9t8RDHPr5oRB+dMFXDAUiS9pKTCB7aMZK7HIGS9mvjj+yR6/x45ZPQ4Ka UfSgtAwZjzWzXgFJKuRHmTybycIlzjt1URhRt5Jwqo3HbEZPwjJjH0xjsYZy5 X-Received: by 2002:a05:6000:2c6:: with SMTP id o6mr5945702wry.585.1644140289318; Sun, 06 Feb 2022 01:38:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwQesS3uYwSKU85LrBMRrj8fTsTDlP1Fx2QS6RSYM8TH5nbtEO+qDz4/RtiZD+yT+1Mk/r4yQ== X-Received: by 2002:a05:6000:2c6:: with SMTP id o6mr5945684wry.585.1644140289131; Sun, 06 Feb 2022 01:38:09 -0800 (PST) Date: Sun, 6 Feb 2022 04:38:06 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 08/24] libvhost-user: Add vu_rem_mem_reg input validation Message-ID: <20220206093702.1282676-9-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , David Hildenbrand , Paolo Bonzini , Stefan Hajnoczi , Raphael Norwitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644141788780100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Raphael Norwitz Today if multiple FDs are sent from the VMM to the backend in a VHOST_USER_REM_MEM_REG message, one FD will be unmapped and the remaining FDs will be leaked. Therefore if multiple FDs are sent we report an error and fail the operation, closing all FDs in the message. Likewise in case the VMM sends a message with a size less than that of a memory region descriptor, we add a check to gracefully report an error and fail the operation rather than crashing. Signed-off-by: Raphael Norwitz Message-Id: <20220117041050.19718-2-raphael.norwitz@nutanix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: David Hildenbrand --- subprojects/libvhost-user/libvhost-user.h | 2 ++ subprojects/libvhost-user/libvhost-user.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/subprojects/libvhost-user/libvhost-user.h b/subprojects/libvho= st-user/libvhost-user.h index 3d13dfadde..cde9f07bb3 100644 --- a/subprojects/libvhost-user/libvhost-user.h +++ b/subprojects/libvhost-user/libvhost-user.h @@ -129,6 +129,8 @@ typedef struct VhostUserMemoryRegion { uint64_t mmap_offset; } VhostUserMemoryRegion; =20 +#define VHOST_USER_MEM_REG_SIZE (sizeof(VhostUserMemoryRegion)) + typedef struct VhostUserMemory { uint32_t nregions; uint32_t padding; diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvho= st-user/libvhost-user.c index 787f4d2d4f..b09b1c269e 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -801,6 +801,21 @@ vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) { VuDevRegion shadow_regions[VHOST_USER_MAX_RAM_SLOTS] =3D {}; VhostUserMemoryRegion m =3D vmsg->payload.memreg.region, *msg_region = =3D &m; =20 + if (vmsg->fd_num !=3D 1) { + vmsg_close_fds(vmsg); + vu_panic(dev, "VHOST_USER_REM_MEM_REG received %d fds - only 1 fd " + "should be sent for this message type", vmsg->fd_num= ); + return false; + } + + if (vmsg->size < VHOST_USER_MEM_REG_SIZE) { + close(vmsg->fds[0]); + vu_panic(dev, "VHOST_USER_REM_MEM_REG requires a message size of a= t " + "least %d bytes and only %d bytes were received", + VHOST_USER_MEM_REG_SIZE, vmsg->size); + return false; + } + DPRINT("Removing region:\n"); DPRINT(" guest_phys_addr: 0x%016"PRIx64"\n", msg_region->guest_phys_addr); --=20 MST From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644140890438837.0600445919888; Sun, 6 Feb 2022 01:48:10 -0800 (PST) Received: from localhost ([::1]:38852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGe9Q-0004bD-PE for importer@patchew.org; Sun, 06 Feb 2022 04:48:08 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdzu-0000DI-Po for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:25650) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdzq-0003g7-UD for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:17 -0500 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-77-jUJflfQ8NPqkwivACYCfSg-1; Sun, 06 Feb 2022 04:38:13 -0500 Received: by mail-wm1-f69.google.com with SMTP id r205-20020a1c44d6000000b0037bb51b549aso1802493wma.4 for ; Sun, 06 Feb 2022 01:38:13 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id d7sm8574323wri.117.2022.02.06.01.38.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:38:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140294; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=PBmM0KuFSdatxXqXavJnWM1XP+AlL96uwaW9+q+ldEs=; b=I1zfdC4PZnNHaEY4RUqFDRf99FSB0CCYd57G1vo5Hj9B746lO1VXKaktyEHbEhGmYn6kQ/ WZ8M+fB3Bg8kbMsC1UcFgc5FmWCYAiGYXrzolrO4IH+fIDNPr51Pvgwv54laSFH70r0xb4 gyfPDZ3KoeB3rK1kavOYRn7gTox+mUI= X-MC-Unique: jUJflfQ8NPqkwivACYCfSg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=PBmM0KuFSdatxXqXavJnWM1XP+AlL96uwaW9+q+ldEs=; b=WZrhdT3+y91c8NOK5QGNVUu0nMKbinK+UlO2WsHMdsAFcxhpJcQ/qwoATA3ItSsIX2 JNUDoVISK8sZHuUJ2yXzKCvzCMfd6HyC47qeADjHCtAnSpON/iuUHgRdyVjX30/9sEPD A45CykNHk+ZU9InoUSXpqOab7WotmX72ypw7YG+bhca/84fBKnv5wMwIHgfyOEPQMD+q JJaGpM+mPglhFLfIsicLAxK5H21jOaK0ktZH4SnWfIW2GMESd1H7QkTObhPldqHOIqXM PZUBAdZBPqiYRJYZcQVBiIYanmC5WUw3PvLMyfb1UuwfAEIPLCkznS5pxv5jpUEuWtMh G++w== X-Gm-Message-State: AOAM530S93hF8cYzJctnn+nooUzq1YkNGXIMG6pKnJyn9E4bHDr8Q2dw ITq6xpmLCjSEfxiv1gDW7/onVEiKg03gdqN/Ok4fTvznmjPoOkQJAb+Zu3QeTbC/gX/X9hxwpF5 yJm00ha5SA6gPogmypM7sYPxx+nwgwG3g2JQHSP4ti5Gc+rgsTPSQJWqcPcrv X-Received: by 2002:a5d:64ad:: with SMTP id m13mr5882467wrp.671.1644140291990; Sun, 06 Feb 2022 01:38:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7l4rOabKnCahlz8F0hwEcj2JGhAZ6QLcuFwJFwcDz7Eh0C2YVeTPFf4Ml9pc3mwvtY5F0Og== X-Received: by 2002:a5d:64ad:: with SMTP id m13mr5882450wrp.671.1644140291762; Sun, 06 Feb 2022 01:38:11 -0800 (PST) Date: Sun, 6 Feb 2022 04:38:09 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 09/24] libvhost-user: Add vu_add_mem_reg input validation Message-ID: <20220206093702.1282676-10-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , David Hildenbrand , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Paolo Bonzini , Raphael Norwitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644140890956100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Raphael Norwitz Today if multiple FDs are sent from the VMM to the backend in a VHOST_USER_ADD_MEM_REG message, one FD will be mapped and the remaining FDs will be leaked. Therefore if multiple FDs are sent we report an error and fail the operation, closing all FDs in the message. Likewise in case the VMM sends a message with a size less than that of a memory region descriptor, we add a check to gracefully report an error and fail the operation rather than crashing. Signed-off-by: Raphael Norwitz Message-Id: <20220117041050.19718-3-raphael.norwitz@nutanix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: David Hildenbrand --- subprojects/libvhost-user/libvhost-user.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvho= st-user/libvhost-user.c index b09b1c269e..1a8fc9d600 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -690,6 +690,21 @@ vu_add_mem_reg(VuDev *dev, VhostUserMsg *vmsg) { VuDevRegion *dev_region =3D &dev->regions[dev->nregions]; void *mmap_addr; =20 + if (vmsg->fd_num !=3D 1) { + vmsg_close_fds(vmsg); + vu_panic(dev, "VHOST_USER_ADD_MEM_REG received %d fds - only 1 fd " + "should be sent for this message type", vmsg->fd_num= ); + return false; + } + + if (vmsg->size < VHOST_USER_MEM_REG_SIZE) { + close(vmsg->fds[0]); + vu_panic(dev, "VHOST_USER_ADD_MEM_REG requires a message size of a= t " + "least %d bytes and only %d bytes were received", + VHOST_USER_MEM_REG_SIZE, vmsg->size); + return false; + } + /* * If we are in postcopy mode and we receive a u64 payload with a 0 va= lue * we know all the postcopy client bases have been received, and we --=20 MST From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644141101735982.5318021155445; Sun, 6 Feb 2022 01:51:41 -0800 (PST) Received: from localhost ([::1]:44138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGeCl-0008L5-CO for importer@patchew.org; Sun, 06 Feb 2022 04:51:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44610) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdzx-0000Ec-L7 for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:21 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:21582) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdzu-0003gv-Gs for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:20 -0500 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-297-9uWwqGg0PN2dcMm3UD0P3Q-1; Sun, 06 Feb 2022 04:38:16 -0500 Received: by mail-wm1-f71.google.com with SMTP id z2-20020a05600c220200b0034d2eb95f27so3956583wml.1 for ; Sun, 06 Feb 2022 01:38:15 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id h8sm6627057wre.89.2022.02.06.01.38.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:38:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140296; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=MGPknzL0C8w670Ju8z58GoLCBmhEaNx8SyVY6OxEVhw=; b=LL20BMpES7bsXWxWihO/9+e3Bu5FgZx1IUwixTXbm5dEaQbS/C9msMFh6tht5b83azqYaH PM/ZmMbfzsxmQbONAC4FArzDHf6NC9ahOCwCjW4bmI20YgqGNadQQXFmt9S93hkEMKHkHK GT8Y+UfdKOWvkXWsKAlg7h4zkaxMKoc= X-MC-Unique: 9uWwqGg0PN2dcMm3UD0P3Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=MGPknzL0C8w670Ju8z58GoLCBmhEaNx8SyVY6OxEVhw=; b=4c1+p1Aken0E4NEr5wyqeNlvKDv1wuwZj+n9zTPmPoMnED3PsAUP8WH26dhN/MxVol plYHBFzL7NhkpOe/uIot/FPBTPO5xQ9gWb1S3zcxdY6PoqMAmKowmy+TIzb4axvHDtyM K5aB7A8ThHmgqqD5Gti+rIQ+ydEt9AnUSW2/cAIOV0CO0waAHJKkqcu+DyxUHUKfk8kW 5LAEgQAPc2LgSAPbzI9PnR0EwBLyWNMPXtHdeWsCcYCOE9ylxxY2hqQrDDy7mp5LhtdK lVdeoVyiQ03TAKIq3tRXonmXJXvlXEa0D5M2NSoRaonMOb7PMRxwuVf7wIhMg4bF7BWM mb7w== X-Gm-Message-State: AOAM530wiFXzI3wJTr72gd/xN+QQXxtXzF193sgZ3lhOgftNwIMahfgz DB8tfUHnG3c5HO9qVkRcd7GIZXtlCPRc98ST+9ow6/kL2FWjn1VwWoRcrSW4ZkyoOPCwpvaLlDB BNaz2HFPsfvIRLH1RiX9QBbLhcy9H+6dwIIKw5YIgdWHhFX6aIMd65979dc1A X-Received: by 2002:adf:e4cb:: with SMTP id v11mr5661467wrm.139.1644140294657; Sun, 06 Feb 2022 01:38:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJxNgornKFIbhYZFT/bGGH9SDF8qgMvgwKL5rn41Hb18hFqNTkC6Xq1eq6XjAJbcAs2GNz+QqQ== X-Received: by 2002:adf:e4cb:: with SMTP id v11mr5661452wrm.139.1644140294462; Sun, 06 Feb 2022 01:38:14 -0800 (PST) Date: Sun, 6 Feb 2022 04:38:11 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 10/24] libvhost-user: Simplify VHOST_USER_REM_MEM_REG Message-ID: <20220206093702.1282676-11-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Raphael Norwitz , Paolo Bonzini , Stefan Hajnoczi , David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644141103483100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: David Hildenbrand Let's avoid having to manually copy all elements. Copy only the ones necessary to close the hole and perform the operation in-place without a second array. Reviewed-by: Stefan Hajnoczi Signed-off-by: David Hildenbrand Signed-off-by: Raphael Norwitz Message-Id: <20220117041050.19718-4-raphael.norwitz@nutanix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- subprojects/libvhost-user/libvhost-user.c | 30 +++++++++++------------ 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvho= st-user/libvhost-user.c index 1a8fc9d600..7dd8e918b4 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -811,10 +811,8 @@ static inline bool reg_equal(VuDevRegion *vudev_reg, =20 static bool vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) { - int i, j; - bool found =3D false; - VuDevRegion shadow_regions[VHOST_USER_MAX_RAM_SLOTS] =3D {}; VhostUserMemoryRegion m =3D vmsg->payload.memreg.region, *msg_region = =3D &m; + int i; =20 if (vmsg->fd_num !=3D 1) { vmsg_close_fds(vmsg); @@ -841,28 +839,28 @@ vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) { DPRINT(" mmap_offset 0x%016"PRIx64"\n", msg_region->mmap_offset); =20 - for (i =3D 0, j =3D 0; i < dev->nregions; i++) { - if (!reg_equal(&dev->regions[i], msg_region)) { - shadow_regions[j].gpa =3D dev->regions[i].gpa; - shadow_regions[j].size =3D dev->regions[i].size; - shadow_regions[j].qva =3D dev->regions[i].qva; - shadow_regions[j].mmap_addr =3D dev->regions[i].mmap_addr; - shadow_regions[j].mmap_offset =3D dev->regions[i].mmap_offset; - j++; - } else { - found =3D true; + for (i =3D 0; i < dev->nregions; i++) { + if (reg_equal(&dev->regions[i], msg_region)) { VuDevRegion *r =3D &dev->regions[i]; void *m =3D (void *) (uintptr_t) r->mmap_addr; =20 if (m) { munmap(m, r->size + r->mmap_offset); } + + break; } } =20 - if (found) { - memcpy(dev->regions, shadow_regions, - sizeof(VuDevRegion) * VHOST_USER_MAX_RAM_SLOTS); + if (i < dev->nregions) { + /* + * Shift all affected entries by 1 to close the hole at index i and + * zero out the last entry. + */ + memmove(dev->regions + i, dev->regions + i + 1, + sizeof(VuDevRegion) * (dev->nregions - i - 1)); + memset(dev->regions + dev->nregions - 1, 0, + sizeof(VuDevRegion)); DPRINT("Successfully removed a region\n"); dev->nregions--; vmsg_set_reply_u64(vmsg, 0); --=20 MST From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644142692287783.5374402076069; Sun, 6 Feb 2022 02:18:12 -0800 (PST) Received: from localhost ([::1]:59820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGecV-00053M-Md for importer@patchew.org; Sun, 06 Feb 2022 05:18:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44908) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe0v-0002Bo-Ux for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:39:21 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:60884) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe0t-0003nU-Lj for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:39:21 -0500 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-652-WB3k6PcKNGGeRehhWQm_-w-1; Sun, 06 Feb 2022 04:38:19 -0500 Received: by mail-wm1-f69.google.com with SMTP id z2-20020a05600c220200b0034d2eb95f27so3956627wml.1 for ; Sun, 06 Feb 2022 01:38:18 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id g7sm6907360wmq.3.2022.02.06.01.38.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:38:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140359; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Eumjoy2b3JuV2CT6O4JwajdWx+yglD5Kzegw38RNJ0M=; b=aOMkPRaSSGHKY4KsZtrKTSRgueaKtz/FuPXtz3X71fRfPX5pYtVMO3VJpOJCcgXTJc1Ulg hE+kowjMLSyjf/FXqzBRqW8gCsTMrcGZIuJQpDdjpcMRoc3TZy++A5ImDS3I+0YZIZyu0F B5A2L+2Kxur/ghet40pdD40J9XxDHX4= X-MC-Unique: WB3k6PcKNGGeRehhWQm_-w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=Eumjoy2b3JuV2CT6O4JwajdWx+yglD5Kzegw38RNJ0M=; b=tW/2/w6Scq9TKbvLeA4loal768fPEs5OyMadnGo+wmZh9k8nv0ZhaBxNaM/nWYkuPt N5E5KixiD6YDn44yt00cS9L+jMIgmdHtbOCyWeR71EE/8bllYw+gorOyKZYCdlqegcJV 4DtmDvLPISd6WdG10woqH4LliwM9H5GiKT0zYmaq/XzdIh8qEEc57WiZ7qalt5J7o6FC Rf4ebb0wOwaKC/UvSWC1caqoD8g2vBEzt4o15DaV3GDAs7XMWHztPyYUEl2qaCwpG+6Z SZM40bESeGVU6gUc+wGKNbniXD7x+r1zinWckT46ZxhkoCEAX2Xolqld7riwQk0UDUnM XqtQ== X-Gm-Message-State: AOAM5338EQfHMvJEqb81ZTl1KZ0TsgcnI7tCgXBGMPEAHOGFVKiVkZqb H2PajEnhbve7viInQvD3yLQtKvNdmC811lj80Nb7gFrQAKbnMWm8bpV3e1/oJL3MvWeAEFtGzzT DIeiJo9C/6VE6sKeffxlxcCKoM9b9xtpHGzBEcwXempfh2qVa3AjzPlX76Spj X-Received: by 2002:a05:600c:1d85:: with SMTP id p5mr6307612wms.36.1644140297567; Sun, 06 Feb 2022 01:38:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6uXurDT7ayBROU9yrIKFz4IAqvYUyzY4D08P984I5DgNBM8PTod2f+ljLxFCxBEgu65L7zw== X-Received: by 2002:a05:600c:1d85:: with SMTP id p5mr6307588wms.36.1644140297327; Sun, 06 Feb 2022 01:38:17 -0800 (PST) Date: Sun, 6 Feb 2022 04:38:14 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 11/24] libvhost-user: fix VHOST_USER_REM_MEM_REG not closing the fd Message-ID: <20220206093702.1282676-12-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , David Hildenbrand , Coiby Xu , Raphael Norwitz , Stefan Hajnoczi , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644142711419100001 From: David Hildenbrand We end up not closing the file descriptor, resulting in leaking one file descriptor for each VHOST_USER_REM_MEM_REG message. Fixes: 875b9fd97b34 ("Support individual region unmap in libvhost-user") Cc: Michael S. Tsirkin Cc: Raphael Norwitz Cc: "Marc-Andr=C3=A9 Lureau" Cc: Stefan Hajnoczi Cc: Paolo Bonzini Cc: Coiby Xu Signed-off-by: David Hildenbrand Signed-off-by: Raphael Norwitz Message-Id: <20220117041050.19718-5-raphael.norwitz@nutanix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- subprojects/libvhost-user/libvhost-user.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvho= st-user/libvhost-user.c index 7dd8e918b4..3f4d7221ca 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -868,6 +868,8 @@ vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) { vu_panic(dev, "Specified region not found\n"); } =20 + close(vmsg->fds[0]); + return true; } =20 --=20 MST From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644142264702929.4895741765079; Sun, 6 Feb 2022 02:11:04 -0800 (PST) Received: from localhost ([::1]:45802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGeVb-0003kq-Vi for importer@patchew.org; Sun, 06 Feb 2022 05:11:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe01-0000J6-71 for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49860) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdzz-0003hi-7x for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:24 -0500 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-262-nnvAwZIaO_291mY9RmH-2Q-1; Sun, 06 Feb 2022 04:38:21 -0500 Received: by mail-wm1-f70.google.com with SMTP id l16-20020a7bcf10000000b0034ffdd81e7aso3946822wmg.4 for ; Sun, 06 Feb 2022 01:38:21 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id z1sm14132589wmk.32.2022.02.06.01.38.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:38:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140302; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y7OKSfT1V8bnQJ29ZyLRYs/eX2kJnKtsDQ8zfEcJa6g=; b=edHr5dJgJiM6B48DShnAqGQUfdL6y4Ptqgvp4EiGKWyCiyELChAinOVNQhcDRrd3IdoxTN DPqbakEi5xmnD0F9orkbw9YpDJ+kLpVFf8ySQGLAM+vWJtI1q6uF9nOBO79Qi9MpVQYgJN kZeCuBbK/iPC0PlJnqBhSpNdMPfAMSE= X-MC-Unique: nnvAwZIaO_291mY9RmH-2Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=y7OKSfT1V8bnQJ29ZyLRYs/eX2kJnKtsDQ8zfEcJa6g=; b=0158c1ndl8Bf4xzs2jz4b3SQp5tENsXC+spiwswlrJMYav5NTm32anVwiK8GuGkEam fpI9msIxcFiG3q++JAsSB3EY2NT29rXU4vnOoqvD3Xzv74a9jKQD2DFzp1aO00IhuCn0 6L55vdebr0O2V/wGV5Ap78W0tcY/y9CkIVgJT9jKQn/E1uMepH7S7mPVWr1nbb+mnHzd QAcLhFk+9/o4zjpEQlVq60yJppvu1/JxaG5i8Vo4itSn4X9xpSD3gJ5y8gZw8yrPdk3W tFubnztGvOJW4dX1zyMMbl0qQjTIclxi12nAoYYCeUxfD8IK7JzEWvXUUrydAqflLJnG D98Q== X-Gm-Message-State: AOAM533PSjH5+iQyha6Fk7qhEBbMJyBcQ0zS8ome28RaTvi0TjSi2W+8 i0yoqR9tX15WiuAGziHK6HQm7rkwhs/1tv8LTEN84Omv/Vp0I5EP0o1iz9Nre2yI1YoZPS30b4A UJIpwzpzt7QeedFMyXP/TWn7DPFzWVKd3yUzZzq2BOVZaZpRtvU1ims57M81e X-Received: by 2002:a5d:548d:: with SMTP id h13mr5871360wrv.28.1644140300470; Sun, 06 Feb 2022 01:38:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwST1/AD6tWCTXkGdltt77b2csUNgZUwM+xFu4/YAQyjdGe2ERn35XpnDqmlrbOuw7nbSLUfQ== X-Received: by 2002:a5d:548d:: with SMTP id h13mr5871333wrv.28.1644140300240; Sun, 06 Feb 2022 01:38:20 -0800 (PST) Date: Sun, 6 Feb 2022 04:38:17 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 12/24] libvhost-user: prevent over-running max RAM slots Message-ID: <20220206093702.1282676-13-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , David Hildenbrand , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Raphael Norwitz , Stefan Hajnoczi , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644142266206100001 From: Raphael Norwitz When VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS support was added to libvhost-user, no guardrails were added to protect against QEMU attempting to hot-add too many RAM slots to a VM with a libvhost-user based backed attached. This change adds the missing error handling by introducing a check on the number of RAM slots the device has available before proceeding to process the VHOST_USER_ADD_MEM_REG message. Suggested-by: Stefan Hajnoczi Signed-off-by: Raphael Norwitz Message-Id: <20220117041050.19718-6-raphael.norwitz@nutanix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: David Hildenbrand Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- subprojects/libvhost-user/libvhost-user.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvho= st-user/libvhost-user.c index 3f4d7221ca..2a1fa00a44 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -705,6 +705,14 @@ vu_add_mem_reg(VuDev *dev, VhostUserMsg *vmsg) { return false; } =20 + if (dev->nregions =3D=3D VHOST_USER_MAX_RAM_SLOTS) { + close(vmsg->fds[0]); + vu_panic(dev, "failing attempt to hot add memory via " + "VHOST_USER_ADD_MEM_REG message because the backend = has " + "no free ram slots available"); + return false; + } + /* * If we are in postcopy mode and we receive a u64 payload with a 0 va= lue * we know all the postcopy client bases have been received, and we --=20 MST From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644142576901308.4197282804687; Sun, 6 Feb 2022 02:16:16 -0800 (PST) Received: from localhost ([::1]:52796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGead-0000D3-En for importer@patchew.org; Sun, 06 Feb 2022 05:16:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44644) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe04-0000Nf-Eh for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:29 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36240) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe02-0003i3-Hy for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:28 -0500 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-356-pZPHmoqjOdKAFJftvsoHQg-1; Sun, 06 Feb 2022 04:38:25 -0500 Received: by mail-wm1-f71.google.com with SMTP id l20-20020a05600c1d1400b0035153bf34c3so10258521wms.2 for ; Sun, 06 Feb 2022 01:38:24 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id n22sm3122442wmc.48.2022.02.06.01.38.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:38:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140306; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WK+YLETmqJAgpCmbHz21EJfyUutFVg3g9CSFBrfdweQ=; b=BV6DeGdEjWt3VgCuZXR2lttHPGUZFcqURkW0MoHoNNku6AZCA6SwxRBoFdAtDdbGNzUhly 2JctP3Xe3pRUkaE9C8j0ypiRUsdhZ+kBzF7bHQ4kbO7MoUkiSYNEQzFNfI18knOHYcUXMF ZOWYVoYYmeKpnuhZOsknpPGCBSr0S1o= X-MC-Unique: pZPHmoqjOdKAFJftvsoHQg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=WK+YLETmqJAgpCmbHz21EJfyUutFVg3g9CSFBrfdweQ=; b=7S9hqQ+2O0r5YkaxNKz6NSEOgn5xDm5ORmtcOSj2c1M6iPlcF5U8RYapeE2DK2OyND Tkdo9Vx/FnGYz5B+CYPnBGf03518s/RHog+EPSuyPMqaicoRtVQAoGfmUkuIzD9gwQs2 tfpuEvbXB7HOc69Oo5LNoqI2kDERevJ+LcgHKEwPPfIWgnIMJY3pNgkKHxSHru7ekfSE 9CitCpSl/PEKyk4QrV0pyBwuRIVtS+cEkAMudJ0GSYMQm54ugE2klYNq1bGY3tHNKSsc oA9GpDm1VSEBKdaFH3y+BI514hSqdyyiUmDsV5JhSRxck46CuhfkwSQe0mClyI5eZQV1 +pOQ== X-Gm-Message-State: AOAM531jIyUyskm6mqDw0Zn/0EFvB8SAx9ltYlS2gmquJGYgO+VEXUUy 7bD83nUxjkGbawO4dLt20uFp1gLiZFr5Y5RqzK08j7AbnHIteO1a34bkivC9ZNAemIDT/yGRdDX tgSv43ocNBebiNjP33M+hGhze8yywaGAFur74VONkssHEyDHzMDR4xpr5Avvj X-Received: by 2002:a7b:c841:: with SMTP id c1mr6502481wml.136.1644140303371; Sun, 06 Feb 2022 01:38:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2F8UrPT0CLSAJIxnWhMMfq91pjR0ZkxT9RCuW9hf0fG2eDxLZ3Pq7oBCOK3cnh0KqAov9fw== X-Received: by 2002:a7b:c841:: with SMTP id c1mr6502465wml.136.1644140303174; Sun, 06 Feb 2022 01:38:23 -0800 (PST) Date: Sun, 6 Feb 2022 04:38:20 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 13/24] libvhost-user: handle removal of identical regions Message-ID: <20220206093702.1282676-14-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , David Hildenbrand , Raphael Norwitz , Stefan Hajnoczi , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644142577500100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Raphael Norwitz Today if QEMU (or any other VMM) has sent multiple copies of the same region to a libvhost-user based backend and then attempts to remove the region, only one instance of the region will be removed, leaving stale copies of the region in dev->regions[]. This change resolves this by having vu_rem_mem_reg() iterate through all regions in dev->regions[] and delete all matching regions. Suggested-by: Stefan Hajnoczi Signed-off-by: Raphael Norwitz Message-Id: <20220117041050.19718-7-raphael.norwitz@nutanix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: David Hildenbrand --- subprojects/libvhost-user/libvhost-user.c | 28 +++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvho= st-user/libvhost-user.c index 2a1fa00a44..0ee43b8e93 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -821,6 +821,7 @@ static bool vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) { VhostUserMemoryRegion m =3D vmsg->payload.memreg.region, *msg_region = =3D &m; int i; + bool found =3D false; =20 if (vmsg->fd_num !=3D 1) { vmsg_close_fds(vmsg); @@ -856,21 +857,24 @@ vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) { munmap(m, r->size + r->mmap_offset); } =20 - break; + /* + * Shift all affected entries by 1 to close the hole at index = i and + * zero out the last entry. + */ + memmove(dev->regions + i, dev->regions + i + 1, + sizeof(VuDevRegion) * (dev->nregions - i - 1)); + memset(dev->regions + dev->nregions - 1, 0, sizeof(VuDevRegion= )); + DPRINT("Successfully removed a region\n"); + dev->nregions--; + i--; + + found =3D true; + + /* Continue the search for eventual duplicates. */ } } =20 - if (i < dev->nregions) { - /* - * Shift all affected entries by 1 to close the hole at index i and - * zero out the last entry. - */ - memmove(dev->regions + i, dev->regions + i + 1, - sizeof(VuDevRegion) * (dev->nregions - i - 1)); - memset(dev->regions + dev->nregions - 1, 0, - sizeof(VuDevRegion)); - DPRINT("Successfully removed a region\n"); - dev->nregions--; + if (found) { vmsg_set_reply_u64(vmsg, 0); } else { vu_panic(dev, "Specified region not found\n"); --=20 MST From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644142093406961.3122904323046; Sun, 6 Feb 2022 02:08:13 -0800 (PST) Received: from localhost ([::1]:41632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGeSq-0000vi-3v for importer@patchew.org; Sun, 06 Feb 2022 05:08:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe08-0000TZ-8R for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:32 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:50222) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe05-0003iI-Ab for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:31 -0500 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-422-9wlL8k47MlykyRf1clINlA-1; Sun, 06 Feb 2022 04:38:27 -0500 Received: by mail-wm1-f70.google.com with SMTP id h82-20020a1c2155000000b003552c13626cso5869377wmh.3 for ; Sun, 06 Feb 2022 01:38:27 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id v3sm6553358wru.15.2022.02.06.01.38.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:38:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140308; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M3jUSaSk62Y68RwsubSnE/d3+Hfgk3zd4sX5M9Po2zk=; b=hBOKKJgpeA6H5ulXzd17ZpXqqOwqjmfkUGPM4uxmlQ5idNH6kXGfp1DYzqtwG10Nsdgax5 xhar5ORczgljuxx1YhTof/8f2kIdzFSz/oxASDmeyMGPhni/cOxNKzQbj/7iygQrlDmL1v of+yzG2DPCJynaNVtMkd4uj8PkTHFQM= X-MC-Unique: 9wlL8k47MlykyRf1clINlA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=M3jUSaSk62Y68RwsubSnE/d3+Hfgk3zd4sX5M9Po2zk=; b=8BqyLtp6c3ATwzFzyvX9kaxvyeMq5Xre/wJUHmYkS9IxPe4un9JRTmU+8W1UJLL0kg OvJ2dsBkqZrglYHOoIGBIedWaX1qTkZGOn5Gu1EdWhzdOEG6JCqoTkVyZ/fEnTvA+94c TFH71UE42Cqo2QldY8MmIC5GD3vgPRNCsPjVvWRZZEVMEvUrhN/IYHGKtbLFy13RAqhR EDaJwu+ixFhfaNaI9mMVz9g+JJNFVLiNKZ9mBUg27zmPo4jNvmfxOWdkZ+jfDcRACbQK fVrgILQ/O6h3qk/R9kb/foFqYuU4TpART+U+1Oa2PnAZG/pY4b2yYgUOJoB01adJa9kE k8hQ== X-Gm-Message-State: AOAM530ABu5oLIH8M1+7N+QGS2axKvulSpLvtGUAeTA4CIGBaoQNwzcI Yf/U7/2BSrvwAbihNsl2TKKY4Q711SQay1eI/emWYPGewfDtbnyrYXazLDTlYkS8LctUTSb8z65 kVF2YKgWUnKl9UNynPdBqmIKyQT5n2W0lxDLtiKkl5kKDDwBDuMnUuP5qSi46 X-Received: by 2002:adf:e750:: with SMTP id c16mr5496399wrn.431.1644140306213; Sun, 06 Feb 2022 01:38:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJztChWgn3V37dleqFQmaCkCAOMoyxRVtwOfuZ/K18Xa4RSYUzO9AAp262GiIEFgcIdEocBbHw== X-Received: by 2002:adf:e750:: with SMTP id c16mr5496376wrn.431.1644140305952; Sun, 06 Feb 2022 01:38:25 -0800 (PST) Date: Sun, 6 Feb 2022 04:38:23 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 14/24] libvhost-user: Map shared RAM with MAP_NORESERVE to support virtio-mem with hugetlb Message-ID: <20220206093702.1282676-15-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , David Hildenbrand , "Dr . David Alan Gilbert" , Raphael Norwitz , Stefan Hajnoczi , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644142095327100001 From: David Hildenbrand For fd-based shared memory, MAP_NORESERVE is only effective for hugetlb, otherwise it's ignored. Older Linux versions that didn't support reservation of huge pages ignored MAP_NORESERVE completely. The first client to mmap a hugetlb fd without MAP_NORESERVE will trigger reservation of huge pages for the whole mmapped range. There are two cases to consider: 1) QEMU mapped RAM without MAP_NORESERVE We're not dealing with a sparse mapping, huge pages for the whole range have already been reserved by QEMU. An additional mmap() without MAP_NORESERVE won't have any effect on the reservation. 2) QEMU mapped RAM with MAP_NORESERVE We're delaing with a sparse mapping, no huge pages should be reserved. Further mappings without MAP_NORESERVE should be avoided. For 1), it doesn't matter if we set MAP_NORESERVE or not, so we can simply set it. For 2), we'd be overriding QEMUs decision and trigger reservation of huge pages, which might just fail if there are not sufficient huge pages around. We must map with MAP_NORESERVE. This change is required to support virtio-mem with hugetlb: a virtio-mem device mapped into the guest physical memory corresponds to a sparse memory mapping and QEMU maps this memory with MAP_NORESERVE. Whenever memory in that sparse region will be accessed by the VM, QEMU populates huge pages for the affected range by preallocating memory and handling any preallocation errors gracefully. So let's map shared RAM with MAP_NORESERVE. As libvhost-user only supports Linux, there shouldn't be anything to take care of in regard of other OS support. Without this change, libvhost-user will fail mapping the region if there are currently not enough huge pages to perform the reservation: fv_panic: libvhost-user: region mmap error: Cannot allocate memory Cc: "Marc-Andr=C3=A9 Lureau" Cc: "Michael S. Tsirkin" Cc: Paolo Bonzini Cc: Raphael Norwitz Cc: Stefan Hajnoczi Cc: Dr. David Alan Gilbert Signed-off-by: David Hildenbrand Message-Id: <20220111123939.132659-1-david@redhat.com> Acked-by: Raphael Norwitz --- subprojects/libvhost-user/libvhost-user.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvho= st-user/libvhost-user.c index 0ee43b8e93..47d2efc60f 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -751,12 +751,12 @@ vu_add_mem_reg(VuDev *dev, VhostUserMsg *vmsg) { * accessing it before we userfault. */ mmap_addr =3D mmap(0, dev_region->size + dev_region->mmap_offset, - PROT_NONE, MAP_SHARED, + PROT_NONE, MAP_SHARED | MAP_NORESERVE, vmsg->fds[0], 0); } else { mmap_addr =3D mmap(0, dev_region->size + dev_region->mmap_offset, - PROT_READ | PROT_WRITE, MAP_SHARED, vmsg->fds[0], - 0); + PROT_READ | PROT_WRITE, MAP_SHARED | MAP_NORESERV= E, + vmsg->fds[0], 0); } =20 if (mmap_addr =3D=3D MAP_FAILED) { @@ -920,7 +920,7 @@ vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg= *vmsg) * accessing it before we userfault */ mmap_addr =3D mmap(0, dev_region->size + dev_region->mmap_offset, - PROT_NONE, MAP_SHARED, + PROT_NONE, MAP_SHARED | MAP_NORESERVE, vmsg->fds[i], 0); =20 if (mmap_addr =3D=3D MAP_FAILED) { @@ -1007,7 +1007,7 @@ vu_set_mem_table_exec(VuDev *dev, VhostUserMsg *vmsg) * mapped address has to be page aligned, and we use huge * pages. */ mmap_addr =3D mmap(0, dev_region->size + dev_region->mmap_offset, - PROT_READ | PROT_WRITE, MAP_SHARED, + PROT_READ | PROT_WRITE, MAP_SHARED | MAP_NORESERV= E, vmsg->fds[i], 0); =20 if (mmap_addr =3D=3D MAP_FAILED) { --=20 MST From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644142700756963.274817049689; Sun, 6 Feb 2022 02:18:20 -0800 (PST) Received: from localhost ([::1]:60412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGecd-0005RY-E1 for importer@patchew.org; Sun, 06 Feb 2022 05:18:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44716) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe0F-0000gI-DU for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:32294) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe0D-0003il-Cv for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:39 -0500 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-412-bPuoYse1OxGB0rzig_dqcQ-1; Sun, 06 Feb 2022 04:38:30 -0500 Received: by mail-wm1-f71.google.com with SMTP id 130-20020a1c0288000000b0037bc5cbd027so66082wmc.8 for ; Sun, 06 Feb 2022 01:38:30 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id b6sm7621637wrd.29.2022.02.06.01.38.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:38:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140316; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9SAeYk6Qwn6EXatjRomDHKxEpW2B7uuJLKwuu/8IMtM=; b=KWHHnJlW45dZbf5KsRwgMKglxKTm4pp1TYJsbd/+7U5WgYAO1Wj4OlggviO7ieOoPxvvdV ibkL1ILqNZhbl2vo9E128G6NP+qF2mlpfsnAYS4pDWP5Kf8MJgXOhYg0um/0lmbkw6bpna rel/IdhiNYtJK9tCt/68wmdxU+qIXCc= X-MC-Unique: bPuoYse1OxGB0rzig_dqcQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=9SAeYk6Qwn6EXatjRomDHKxEpW2B7uuJLKwuu/8IMtM=; b=5bQKeP2ZTs+C7EJW7LygXkeOL9CKsp0k1VyrAQcebFQcRKs/Yp8aijWth5Hahkrh2k 6UcQEh/g0PfBQKGNzeOHbWpZSXAaogIV8ese3+U5zALI66WP1sqVB8GfAPFud0dnu1Gq eJcRWh8ise3om0wwHeL4xVAd6TX+zFWxPtWswXO8v4u1VeifPjdGhpzJ6BUovqRIM5da YeN7p2rCPKNfNxEAEPpiBLoo+JdOw1VHhuZrYTagqFkhaLxI3abGz7YS2ARRyVW3TZs9 LbCdprxJ7PgHWhkcl5VP8IZcYYcw2Z2GLbK5/pDeCwS8E3RhSpnl28IPLjeNAA078TGl lY6A== X-Gm-Message-State: AOAM530XhcugT4IHEkUB/wO/IRfOhaiMmDZimwMtfGZHkaqz/BhjZTPw ejNs/jGdODHX9Chcn1QzyikCe4cXWgVJ9fquC/zP9GoZ/kGoK3IYONEx7OZ5zm4rpiwZUsNKBg4 GobO72bCAJMKrGjKOlOn/M7fLGwQNR6SNNBykG80Xdzl5aD9mxKeOoRXIP+qY X-Received: by 2002:a5d:548d:: with SMTP id h13mr5871755wrv.28.1644140308686; Sun, 06 Feb 2022 01:38:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJwags1fy5d+i7Mx1QyPT7OH625JEKJx5fNgvBd809Fd5g18u75+ge4IT1XkalUMVY7YP4rW+g== X-Received: by 2002:a5d:548d:: with SMTP id h13mr5871737wrv.28.1644140308443; Sun, 06 Feb 2022 01:38:28 -0800 (PST) Date: Sun, 6 Feb 2022 04:38:26 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 15/24] ACPI ERST: bios-tables-test.c steps 1 and 2 Message-ID: <20220206093702.1282676-16-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Eric DeVolder , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644142701308100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric DeVolder Following the guidelines in tests/qtest/bios-tables-test.c, this change adds empty placeholder files per step 1 for the new ERST table, and excludes resulting changed files in bios-tables-test-allowed-dif= f.h per step 2. Signed-off-by: Eric DeVolder Acked-by: Igor Mammedov Message-Id: <1643402289-22216-2-git-send-email-eric.devolder@oracle.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 5 +++++ tests/data/acpi/microvm/ERST.pcie | 0 tests/data/acpi/pc/DSDT.acpierst | 0 tests/data/acpi/pc/ERST.acpierst | 0 tests/data/acpi/q35/DSDT.acpierst | 0 tests/data/acpi/q35/ERST.acpierst | 0 6 files changed, 5 insertions(+) create mode 100644 tests/data/acpi/microvm/ERST.pcie create mode 100644 tests/data/acpi/pc/DSDT.acpierst create mode 100644 tests/data/acpi/pc/ERST.acpierst create mode 100644 tests/data/acpi/q35/DSDT.acpierst create mode 100644 tests/data/acpi/q35/ERST.acpierst diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index dfb8523c8b..603db07711 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,6 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/pc/DSDT.acpierst", +"tests/data/acpi/pc/ERST.acpierst", +"tests/data/acpi/q35/DSDT.acpierst", +"tests/data/acpi/q35/ERST.acpierst", +"tests/data/acpi/microvm/ERST.pcie", diff --git a/tests/data/acpi/microvm/ERST.pcie b/tests/data/acpi/microvm/ER= ST.pcie new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/pc/DSDT.acpierst b/tests/data/acpi/pc/DSDT.acp= ierst new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/pc/ERST.acpierst b/tests/data/acpi/pc/ERST.acp= ierst new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/q35/DSDT.acpierst b/tests/data/acpi/q35/DSDT.a= cpierst new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/q35/ERST.acpierst b/tests/data/acpi/q35/ERST.a= cpierst new file mode 100644 index 0000000000..e69de29bb2 --=20 MST From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644142360169455.72918091088025; Sun, 6 Feb 2022 02:12:40 -0800 (PST) Received: from localhost ([::1]:48124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGeX8-0005Qi-SJ for importer@patchew.org; Sun, 06 Feb 2022 05:12:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44700) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe0D-0000cU-NX for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:35536) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe0B-0003id-Tw for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:37 -0500 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-158-ZA9-c8DCPdmE9Vs1B_xPww-1; Sun, 06 Feb 2022 04:38:32 -0500 Received: by mail-wm1-f71.google.com with SMTP id s187-20020a1ca9c4000000b0037bb8547d64so1531927wme.0 for ; Sun, 06 Feb 2022 01:38:32 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id ay29sm6008532wmb.38.2022.02.06.01.38.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:38:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140315; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DiaDZ6Jg6Wr7fQiD4I2/sd6NrZXyOewN/eKa4S/4RBc=; b=Nl+ofOjj48y52w8sKVxabdtNzK2sAo7RjYOx/nOODSV7gtLZttNU4gOKJZEEpwtpgXlHzD vcfZ4P/dOOYVnpwGLqpb2Tev3S7ISETHMU2A4Qy9BixxAKX+zjZTZhD74W+p8uUsoR7TdU 3n4ZSy3kyVaSt68CyY5kOwpXoJekyfA= X-MC-Unique: ZA9-c8DCPdmE9Vs1B_xPww-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=DiaDZ6Jg6Wr7fQiD4I2/sd6NrZXyOewN/eKa4S/4RBc=; b=zt7+txLuMZ+Hz6tkmY+wOcNlQfnxj4bmNKmFaYv99B4JHP/LvkxVXYgpcg5RNzFiJR bSu/HgKUBd39PwZeKYpkENfOepZEWwnwXndJZViIVuRO9U5lDabH6Wt2DwpRLv2z9rmi NrR8P2So3LOb6u5mBfWNm7tCCy8K84wpux6aZaVG9YV9Tl43pCPnB+gOTxdaQV241xJk puLPX6LRa5m+LJN19KTa4hN0Ps4CIDrGBktZMmE+4zcn0tcREVsO+8vYJG90pp3Z1Grf JYwJoZ4AaSaX/1YC1SqYvgWhz/Ay0cKu0sf1UslpGDa6Bc9ttwC6LbOdG/b4xWQXw4ym yieg== X-Gm-Message-State: AOAM530RQXfgQ2xFVe8eiV90JOC3mF2DNitP+Ei0JxakDjsADx0+Lb2q ORuLO1VQ6mymJToS11KdFaHAamfwa/De+bWni0HFrgN6KZzIG3sxriaC/RMItoE813w+5gWz7NQ OldQz5m8mLPPIc3M1FMX0wiwcd+5OjXawc4d4ZffdCFVLdthAPvOp7+g4ZOLH X-Received: by 2002:a05:600c:5118:: with SMTP id o24mr6493111wms.153.1644140311194; Sun, 06 Feb 2022 01:38:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJy8vsEGRLnYH3MvENUfb39jKztYhyXJq46Bn52TVU0T8AV9roM42TxmWazXaT+aPVAptsJCNg== X-Received: by 2002:a05:600c:5118:: with SMTP id o24mr6493093wms.153.1644140311008; Sun, 06 Feb 2022 01:38:31 -0800 (PST) Date: Sun, 6 Feb 2022 04:38:28 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 16/24] ACPI ERST: PCI device_id for ERST Message-ID: <20220206093702.1282676-17-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Eric DeVolder , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644142360886100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric DeVolder This change reserves the PCI device_id for the new ACPI ERST device. Signed-off-by: Eric DeVolder Acked-by: Igor Mammedov Acked-by: Ani Sinha Message-Id: <1643402289-22216-4-git-send-email-eric.devolder@oracle.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/pci/pci.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 023abc0f79..c3f3c90473 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -108,6 +108,7 @@ extern bool pci_available; #define PCI_DEVICE_ID_REDHAT_MDPY 0x000f #define PCI_DEVICE_ID_REDHAT_NVME 0x0010 #define PCI_DEVICE_ID_REDHAT_PVPANIC 0x0011 +#define PCI_DEVICE_ID_REDHAT_ACPI_ERST 0x0012 #define PCI_DEVICE_ID_REDHAT_QXL 0x0100 =20 #define FMT_PCIBUS PRIx64 --=20 MST From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644141439829378.11669490389784; Sun, 6 Feb 2022 01:57:19 -0800 (PST) Received: from localhost ([::1]:51374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGeII-00053O-ID for importer@patchew.org; Sun, 06 Feb 2022 04:57:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44710) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe0E-0000dJ-Kk for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:48290) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe0C-0003ih-O2 for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:38 -0500 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-208-0MHdMMGMNhCUXofGYt3zhw-1; Sun, 06 Feb 2022 04:38:35 -0500 Received: by mail-wm1-f71.google.com with SMTP id c7-20020a1c3507000000b0034a0dfc86aaso10239449wma.6 for ; Sun, 06 Feb 2022 01:38:35 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id f16sm6846640wmg.28.2022.02.06.01.38.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:38:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140316; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dqIW4HOXDQJl70JpvdUs1dPT+8Qw8RjLjhx0buPuD7M=; b=BpRWvCPfzutWBmRzTLI4eufKGeMbkghveMxHUr+9QBAhPpPrckw4zsL1UallhnH6ry0HbP nA2V1XPolmYYDcfMNZwE2cMJ1n2QLF5bYRTINme5VlU/PgJPectYzAZJRWePwGHtyqZ4E3 XQ5o+KgsnjkpFME1lMcXCjp7RKFQn4E= X-MC-Unique: 0MHdMMGMNhCUXofGYt3zhw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=dqIW4HOXDQJl70JpvdUs1dPT+8Qw8RjLjhx0buPuD7M=; b=yT60NTTjtP6/4jyMzq8LAK02gsXAlyRGfvDVQrLcQespelXYPsoLVY4y1YsYvsU8lU PSmiSuXBNJjCj+W+HCRrcyV6f4bvUUgSgxQmESbCiXvEs4rvfOvq2uhBNK6SSHASppXl Pi/j4dr+oeb27hN2dcK56pTAKceug4oFidyoWa4YW4a4SI3E6PdMSirZDaqZqh7rsheJ 0R8GdGmIfc7JLVaDKVRaOoHmUTsIiRx8DtLwmj3TnqiKvFJF4603A2d8NjKGAjjeY3ns tD+YhFtA+UtSg9nENjG2Wo1UzPidVaH6f4LyjKCmNuSzlvq7S4HwdBmIguvDftDaXqe1 pe7g== X-Gm-Message-State: AOAM530CzTAM07CQcOi6vTjkcHffEPeiyAI8oi5JA3H9Q9b5eIUEz6jO Y3bZQed2RYMgexILjRVvgtNC5jQceqS/fM5x1d7Ty6fpAhdvlw9jq+VyfnKwiG1oKDG3BNhvpvi 07ilDFJSxxONWt0HJ/hFECz6mQjvy4VmePRWaFVAl56PagJp5cW+y9GzqeC4Z X-Received: by 2002:a05:600c:646:: with SMTP id p6mr6411976wmm.3.1644140313779; Sun, 06 Feb 2022 01:38:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJxY7za4wVg3S8pE3unnGO2o5szTepoT4yRPRt58sCaZuVdTYyuyu2EQgkCFLen+yTee2N4eMw== X-Received: by 2002:a05:600c:646:: with SMTP id p6mr6411957wmm.3.1644140313519; Sun, 06 Feb 2022 01:38:33 -0800 (PST) Date: Sun, 6 Feb 2022 04:38:31 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 17/24] ACPI ERST: header file for ERST Message-ID: <20220206093702.1282676-18-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Eric DeVolder , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644141441587100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric DeVolder This change introduces the public defintions for ACPI ERST. Signed-off-by: Eric DeVolder Reviewed-by: Ani Sinha Message-Id: <1643402289-22216-5-git-send-email-eric.devolder@oracle.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/erst.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 include/hw/acpi/erst.h diff --git a/include/hw/acpi/erst.h b/include/hw/acpi/erst.h new file mode 100644 index 0000000000..9d637179fe --- /dev/null +++ b/include/hw/acpi/erst.h @@ -0,0 +1,19 @@ +/* + * ACPI Error Record Serialization Table, ERST, Implementation + * + * ACPI ERST introduced in ACPI 4.0, June 16, 2009. + * ACPI Platform Error Interfaces : Error Serialization + * + * Copyright (c) 2021 Oracle and/or its affiliates. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#ifndef HW_ACPI_ERST_H +#define HW_ACPI_ERST_H + +void build_erst(GArray *table_data, BIOSLinker *linker, Object *erst_dev, + const char *oem_id, const char *oem_table_id); + +#define TYPE_ACPI_ERST "acpi-erst" + +#endif --=20 MST From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644142651394244.50132582820288; Sun, 6 Feb 2022 02:17:31 -0800 (PST) Received: from localhost ([::1]:56140 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGebq-0002ZN-1i for importer@patchew.org; Sun, 06 Feb 2022 05:17:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44750) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe0K-00010X-Uz for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:44 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:30459) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe0G-0003jG-Vk for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:44 -0500 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-605-mz7UtRCpNl-goXO-RaY5GQ-1; Sun, 06 Feb 2022 04:38:38 -0500 Received: by mail-wm1-f71.google.com with SMTP id 130-20020a1c0288000000b0037bc5cbd027so66255wmc.8 for ; Sun, 06 Feb 2022 01:38:38 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id n15sm6181650wmr.26.2022.02.06.01.38.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:38:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140320; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=J02YeX85DN5PdPxuS+0emk3q81FQ7EQCmvYPrZoDeSQ=; b=SB6R/TSDACMZu7M9l7ZjD2ZfvgJQ8yize5dIKmg8mChzKxa6cOqt/uaIjLZggggL7WDCsx cNYjoEGU1aKIZfp1QQXYzRF4B+QfQYfgRWXT1gxPOE+Xb09qnrPWGLU5Ww/YdcbIVb5wRj HrQarWILRjEWhCRawqAqkmwz6w8akNQ= X-MC-Unique: mz7UtRCpNl-goXO-RaY5GQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=J02YeX85DN5PdPxuS+0emk3q81FQ7EQCmvYPrZoDeSQ=; b=nlhD13qTQKgjc+BK4aS/2rkAmwxGAmVZxI503MbkievzrUg74/w6j55zY8EcyNCl3w r632Kh+RASUi0oKHXVwS24L9COyE86dhm6jIGYxM46m7NMMozdD1aAwYeJ6aaEpv8qPf P7FE9HhIXCAMUMiz86mghtZLjJc4M3gmUXrWb0vTB9AvizBCBxlMiTxcS9do/T2GGidd TJppfc7PUIOQYpC8cUWZD0Vh3WP6TIUiF3M34IWA5wrJYTyQjjqN6jTc//njrs2tXOdY LRZnjcg04x2syUcVrYNU6g7hl1X+dlIUGohoCvKIqFaCnjBoS3DarxJnrsK7Ugg+4p/k 1LvQ== X-Gm-Message-State: AOAM533LCKRryvaGizkkafJ+oiN5i0CNPAnsPfPp/yAq9P4A1wToMYoV qGUpaUdcURUE2MLeIyM6H7vgqFin1/O8MSXq2tP0llujHVfEKN5g2EiA8Palp4eW4SaiVJpGssO mYE6JjDzV9PV1ogBoVK2edZBU8/qSY3/6pNrAr+/yY3XPREqL/NAzq7nIJZWs X-Received: by 2002:a7b:c20d:: with SMTP id x13mr9383755wmi.47.1644140316926; Sun, 06 Feb 2022 01:38:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJwjzqj4kLCya7JmegZ8/uKVEljf9k+vWY97aEN8GegRPqcjbA2QdE98yKC2a0EE26mGgfi+gw== X-Received: by 2002:a7b:c20d:: with SMTP id x13mr9383716wmi.47.1644140316294; Sun, 06 Feb 2022 01:38:36 -0800 (PST) Date: Sun, 6 Feb 2022 04:38:33 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 18/24] ACPI ERST: support for ACPI ERST feature Message-ID: <20220206093702.1282676-19-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Eric DeVolder , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644142652760100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric DeVolder This implements a PCI device for ACPI ERST. This implements the non-NVRAM "mode" of operation for ERST as it is supported by Linux and Windows. Signed-off-by: Eric DeVolder Reviewed-by: Ani Sinha Message-Id: <1643402289-22216-6-git-send-email-eric.devolder@oracle.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/erst.c | 840 +++++++++++++++++++++++++++++++++++++++++++ hw/acpi/Kconfig | 6 + hw/acpi/meson.build | 1 + hw/acpi/trace-events | 15 + 4 files changed, 862 insertions(+) create mode 100644 hw/acpi/erst.c diff --git a/hw/acpi/erst.c b/hw/acpi/erst.c new file mode 100644 index 0000000000..8a691cb5fe --- /dev/null +++ b/hw/acpi/erst.c @@ -0,0 +1,840 @@ +/* + * ACPI Error Record Serialization Table, ERST, Implementation + * + * ACPI ERST introduced in ACPI 4.0, June 16, 2009. + * ACPI Platform Error Interfaces : Error Serialization + * + * Copyright (c) 2021 Oracle and/or its affiliates. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "hw/qdev-core.h" +#include "exec/memory.h" +#include "qom/object.h" +#include "hw/pci/pci.h" +#include "qom/object_interfaces.h" +#include "qemu/error-report.h" +#include "migration/vmstate.h" +#include "hw/qdev-properties.h" +#include "hw/acpi/acpi.h" +#include "hw/acpi/acpi-defs.h" +#include "hw/acpi/aml-build.h" +#include "hw/acpi/bios-linker-loader.h" +#include "exec/address-spaces.h" +#include "sysemu/hostmem.h" +#include "hw/acpi/erst.h" +#include "trace.h" + +/* ACPI 4.0: Table 17-16 Serialization Actions */ +#define ACTION_BEGIN_WRITE_OPERATION 0x0 +#define ACTION_BEGIN_READ_OPERATION 0x1 +#define ACTION_BEGIN_CLEAR_OPERATION 0x2 +#define ACTION_END_OPERATION 0x3 +#define ACTION_SET_RECORD_OFFSET 0x4 +#define ACTION_EXECUTE_OPERATION 0x5 +#define ACTION_CHECK_BUSY_STATUS 0x6 +#define ACTION_GET_COMMAND_STATUS 0x7 +#define ACTION_GET_RECORD_IDENTIFIER 0x8 +#define ACTION_SET_RECORD_IDENTIFIER 0x9 +#define ACTION_GET_RECORD_COUNT 0xA +#define ACTION_BEGIN_DUMMY_WRITE_OPERATION 0xB +#define ACTION_RESERVED 0xC +#define ACTION_GET_ERROR_LOG_ADDRESS_RANGE 0xD +#define ACTION_GET_ERROR_LOG_ADDRESS_LENGTH 0xE +#define ACTION_GET_ERROR_LOG_ADDRESS_RANGE_ATTRIBUTES 0xF +#define ACTION_GET_EXECUTE_OPERATION_TIMINGS 0x10 /* ACPI 6.3 */ + +/* ACPI 4.0: Table 17-17 Command Status Definitions */ +#define STATUS_SUCCESS 0x00 +#define STATUS_NOT_ENOUGH_SPACE 0x01 +#define STATUS_HARDWARE_NOT_AVAILABLE 0x02 +#define STATUS_FAILED 0x03 +#define STATUS_RECORD_STORE_EMPTY 0x04 +#define STATUS_RECORD_NOT_FOUND 0x05 + +/* UEFI 2.1: Appendix N Common Platform Error Record */ +#define UEFI_CPER_RECORD_MIN_SIZE 128U +#define UEFI_CPER_RECORD_LENGTH_OFFSET 20U +#define UEFI_CPER_RECORD_ID_OFFSET 96U +#define IS_UEFI_CPER_RECORD(ptr) \ + (((ptr)[0] =3D=3D 'C') && \ + ((ptr)[1] =3D=3D 'P') && \ + ((ptr)[2] =3D=3D 'E') && \ + ((ptr)[3] =3D=3D 'R')) + +/* + * NOTE that when accessing CPER fields within a record, memcpy() + * is utilized to avoid a possible misaligned access on the host. + */ + +/* + * This implementation is an ACTION (cmd) and VALUE (data) + * interface consisting of just two 64-bit registers. + */ +#define ERST_REG_SIZE (16UL) +#define ERST_ACTION_OFFSET (0UL) /* action (cmd) */ +#define ERST_VALUE_OFFSET (8UL) /* argument/value (data) */ + +/* + * ERST_RECORD_SIZE is the buffer size for exchanging ERST + * record contents. Thus, it defines the maximum record size. + * As this is mapped through a PCI BAR, it must be a power of + * two and larger than UEFI_CPER_RECORD_MIN_SIZE. + * The backing storage is divided into fixed size "slots", + * each ERST_RECORD_SIZE in length, and each "slot" + * storing a single record. No attempt at optimizing storage + * through compression, compaction, etc is attempted. + * NOTE that slot 0 is reserved for the backing storage header. + * Depending upon the size of the backing storage, additional + * slots will be part of the slot 0 header in order to account + * for a record_id for each available remaining slot. + */ +/* 8KiB records, not too small, not too big */ +#define ERST_RECORD_SIZE (8192UL) + +#define ACPI_ERST_MEMDEV_PROP "memdev" +#define ACPI_ERST_RECORD_SIZE_PROP "record_size" + +/* + * From the ACPI ERST spec sections: + * A record id of all 0s is used to indicate 'unspecified' record id. + * A record id of all 1s is used to indicate empty or end. + */ +#define ERST_UNSPECIFIED_RECORD_ID (0UL) +#define ERST_EMPTY_END_RECORD_ID (~0UL) + +#define ERST_IS_VALID_RECORD_ID(rid) \ + ((rid !=3D ERST_UNSPECIFIED_RECORD_ID) && \ + (rid !=3D ERST_EMPTY_END_RECORD_ID)) + +/* + * Implementation-specific definitions and types. + * Values are arbitrary and chosen for this implementation. + * See erst.rst documentation for details. + */ +#define ERST_EXECUTE_OPERATION_MAGIC 0x9CUL +#define ERST_STORE_MAGIC 0x524F545354535245UL /* ERSTSTOR */ +typedef struct { + uint64_t magic; + uint32_t record_size; + uint32_t storage_offset; /* offset to record storage beyond header */ + uint16_t version; + uint16_t reserved; + uint32_t record_count; + uint64_t map[]; /* contains record_ids, and position indicates index */ +} __attribute__((packed)) ERSTStorageHeader; + +/* + * Object cast macro + */ +#define ACPIERST(obj) \ + OBJECT_CHECK(ERSTDeviceState, (obj), TYPE_ACPI_ERST) + +/* + * Main ERST device state structure + */ +typedef struct { + PCIDevice parent_obj; + + /* Backend storage */ + HostMemoryBackend *hostmem; + MemoryRegion *hostmem_mr; + uint32_t storage_size; + uint32_t default_record_size; + + /* Programming registers */ + MemoryRegion iomem_mr; + + /* Exchange buffer */ + MemoryRegion exchange_mr; + + /* Interface state */ + uint8_t operation; + uint8_t busy_status; + uint8_t command_status; + uint32_t record_offset; + uint64_t reg_action; + uint64_t reg_value; + uint64_t record_identifier; + ERSTStorageHeader *header; + unsigned first_record_index; + unsigned last_record_index; + unsigned next_record_index; + +} ERSTDeviceState; + +/*******************************************************************/ +/*******************************************************************/ +static uint8_t *get_nvram_ptr_by_index(ERSTDeviceState *s, unsigned index) +{ + uint8_t *rc =3D NULL; + off_t offset =3D (index * le32_to_cpu(s->header->record_size)); + + g_assert(offset < s->storage_size); + + rc =3D memory_region_get_ram_ptr(s->hostmem_mr); + rc +=3D offset; + + return rc; +} + +static void make_erst_storage_header(ERSTDeviceState *s) +{ + ERSTStorageHeader *header =3D s->header; + unsigned mapsz, headersz; + + header->magic =3D cpu_to_le64(ERST_STORE_MAGIC); + header->record_size =3D cpu_to_le32(s->default_record_size); + header->version =3D cpu_to_le16(0x0100); + header->reserved =3D cpu_to_le16(0x0000); + + /* Compute mapsize */ + mapsz =3D s->storage_size / s->default_record_size; + mapsz *=3D sizeof(uint64_t); + /* Compute header+map size */ + headersz =3D sizeof(ERSTStorageHeader) + mapsz; + /* Round up to nearest integer multiple of ERST_RECORD_SIZE */ + headersz =3D QEMU_ALIGN_UP(headersz, s->default_record_size); + header->storage_offset =3D cpu_to_le32(headersz); + + /* + * The HostMemoryBackend initializes contents to zero, + * so all record_ids stashed in the map are zero'd. + * As well the record_count is zero. Properly initialized. + */ +} + +static void check_erst_backend_storage(ERSTDeviceState *s, Error **errp) +{ + ERSTStorageHeader *header; + uint32_t record_size; + + header =3D memory_region_get_ram_ptr(s->hostmem_mr); + s->header =3D header; + + /* Ensure pointer to header is 64-bit aligned */ + g_assert(QEMU_PTR_IS_ALIGNED(header, sizeof(uint64_t))); + + /* + * Check if header is uninitialized; HostMemoryBackend inits to 0 + */ + if (le64_to_cpu(header->magic) =3D=3D 0UL) { + make_erst_storage_header(s); + } + + /* Validity check record_size */ + record_size =3D le32_to_cpu(header->record_size); + if (!( + (record_size) && /* non zero */ + (record_size >=3D UEFI_CPER_RECORD_MIN_SIZE) && + (((record_size - 1) & record_size) =3D=3D 0) && /* is power of 2 */ + (record_size >=3D 4096) /* PAGE_SIZE */ + )) { + error_setg(errp, "ERST record_size %u is invalid", record_size); + } + + /* Validity check header */ + if (!( + (le64_to_cpu(header->magic) =3D=3D ERST_STORE_MAGIC) && + ((le32_to_cpu(header->storage_offset) % record_size) =3D=3D 0) && + (le16_to_cpu(header->version) =3D=3D 0x0100) && + (le16_to_cpu(header->reserved) =3D=3D 0) + )) { + error_setg(errp, "ERST backend storage header is invalid"); + } + + /* Check storage_size against record_size */ + if (((s->storage_size % record_size) !=3D 0) || + (record_size > s->storage_size)) { + error_setg(errp, "ACPI ERST requires storage size be multiple of " + "record size (%uKiB)", record_size); + } + + /* Compute offset of first and last record storage slot */ + s->first_record_index =3D le32_to_cpu(header->storage_offset) + / record_size; + s->last_record_index =3D (s->storage_size / record_size); +} + +static void update_map_entry(ERSTDeviceState *s, unsigned index, + uint64_t record_id) +{ + if (index < s->last_record_index) { + s->header->map[index] =3D cpu_to_le64(record_id); + } +} + +static unsigned find_next_empty_record_index(ERSTDeviceState *s) +{ + unsigned rc =3D 0; /* 0 not a valid index */ + unsigned index =3D s->first_record_index; + + for (; index < s->last_record_index; ++index) { + if (le64_to_cpu(s->header->map[index]) =3D=3D ERST_UNSPECIFIED_REC= ORD_ID) { + rc =3D index; + break; + } + } + + return rc; +} + +static unsigned lookup_erst_record(ERSTDeviceState *s, + uint64_t record_identifier) +{ + unsigned rc =3D 0; /* 0 not a valid index */ + + /* Find the record_identifier in the map */ + if (record_identifier !=3D ERST_UNSPECIFIED_RECORD_ID) { + /* + * Count number of valid records encountered, and + * short-circuit the loop if identifier not found + */ + uint32_t record_count =3D le32_to_cpu(s->header->record_count); + unsigned count =3D 0; + unsigned index; + for (index =3D s->first_record_index; index < s->last_record_index= && + count < record_count; ++index) { + if (le64_to_cpu(s->header->map[index]) =3D=3D record_identifie= r) { + rc =3D index; + break; + } + if (le64_to_cpu(s->header->map[index]) !=3D + ERST_UNSPECIFIED_RECORD_ID) { + ++count; + } + } + } + + return rc; +} + +/* + * ACPI 4.0: 17.4.1.1 Serialization Actions, also see + * ACPI 4.0: 17.4.2.2 Operations - Reading 6.c and 2.c + */ +static unsigned get_next_record_identifier(ERSTDeviceState *s, + uint64_t *record_identifier, bool first) +{ + unsigned found =3D 0; + unsigned index; + + /* For operations needing to return 'first' record identifier */ + if (first) { + /* Reset initial index to beginning */ + s->next_record_index =3D s->first_record_index; + } + index =3D s->next_record_index; + + *record_identifier =3D ERST_EMPTY_END_RECORD_ID; + + if (le32_to_cpu(s->header->record_count)) { + for (; index < s->last_record_index; ++index) { + if (le64_to_cpu(s->header->map[index]) !=3D + ERST_UNSPECIFIED_RECORD_ID) { + /* where to start next time */ + s->next_record_index =3D index + 1; + *record_identifier =3D le64_to_cpu(s->header->map[inde= x]); + found =3D 1; + break; + } + } + } + if (!found) { + /* at end (ie scan complete), reset */ + s->next_record_index =3D s->first_record_index; + } + + return STATUS_SUCCESS; +} + +/* ACPI 4.0: 17.4.2.3 Operations - Clearing */ +static unsigned clear_erst_record(ERSTDeviceState *s) +{ + unsigned rc =3D STATUS_RECORD_NOT_FOUND; + unsigned index; + + /* Check for valid record identifier */ + if (!ERST_IS_VALID_RECORD_ID(s->record_identifier)) { + return STATUS_FAILED; + } + + index =3D lookup_erst_record(s, s->record_identifier); + if (index) { + /* No need to wipe record, just invalidate its map entry */ + uint32_t record_count; + update_map_entry(s, index, ERST_UNSPECIFIED_RECORD_ID); + record_count =3D le32_to_cpu(s->header->record_count); + record_count -=3D 1; + s->header->record_count =3D cpu_to_le32(record_count); + rc =3D STATUS_SUCCESS; + } + + return rc; +} + +/* ACPI 4.0: 17.4.2.2 Operations - Reading */ +static unsigned read_erst_record(ERSTDeviceState *s) +{ + unsigned rc =3D STATUS_RECORD_NOT_FOUND; + unsigned exchange_length; + unsigned index; + + /* Check if backend storage is empty */ + if (le32_to_cpu(s->header->record_count) =3D=3D 0) { + return STATUS_RECORD_STORE_EMPTY; + } + + exchange_length =3D memory_region_size(&s->exchange_mr); + + /* Check for record identifier of all 0s */ + if (s->record_identifier =3D=3D ERST_UNSPECIFIED_RECORD_ID) { + /* Set to 'first' record in storage */ + get_next_record_identifier(s, &s->record_identifier, true); + /* record_identifier is now a valid id, or all 1s */ + } + + /* Check for record identifier of all 1s */ + if (s->record_identifier =3D=3D ERST_EMPTY_END_RECORD_ID) { + return STATUS_FAILED; + } + + /* Validate record_offset */ + if (s->record_offset > (exchange_length - UEFI_CPER_RECORD_MIN_SIZE)) { + return STATUS_FAILED; + } + + index =3D lookup_erst_record(s, s->record_identifier); + if (index) { + uint8_t *nvram; + uint8_t *exchange; + uint32_t record_length; + + /* Obtain pointer to the exchange buffer */ + exchange =3D memory_region_get_ram_ptr(&s->exchange_mr); + exchange +=3D s->record_offset; + /* Obtain pointer to slot in storage */ + nvram =3D get_nvram_ptr_by_index(s, index); + /* Validate CPER record_length */ + memcpy((uint8_t *)&record_length, + &nvram[UEFI_CPER_RECORD_LENGTH_OFFSET], + sizeof(uint32_t)); + record_length =3D le32_to_cpu(record_length); + if (record_length < UEFI_CPER_RECORD_MIN_SIZE) { + rc =3D STATUS_FAILED; + } + if ((s->record_offset + record_length) > exchange_length) { + rc =3D STATUS_FAILED; + } + /* If all is ok, copy the record to the exchange buffer */ + if (rc !=3D STATUS_FAILED) { + memcpy(exchange, nvram, record_length); + rc =3D STATUS_SUCCESS; + } + } else { + /* + * See "Reading : 'The steps performed by the platform ...' 2.c" + * Set to 'first' record in storage + */ + get_next_record_identifier(s, &s->record_identifier, true); + } + + return rc; +} + +/* ACPI 4.0: 17.4.2.1 Operations - Writing */ +static unsigned write_erst_record(ERSTDeviceState *s) +{ + unsigned rc =3D STATUS_FAILED; + unsigned exchange_length; + unsigned index; + uint64_t record_identifier; + uint32_t record_length; + uint8_t *exchange; + uint8_t *nvram =3D NULL; + bool record_found =3D false; + + exchange_length =3D memory_region_size(&s->exchange_mr); + + /* Validate record_offset */ + if (s->record_offset > (exchange_length - UEFI_CPER_RECORD_MIN_SIZE)) { + return STATUS_FAILED; + } + + /* Obtain pointer to record in the exchange buffer */ + exchange =3D memory_region_get_ram_ptr(&s->exchange_mr); + exchange +=3D s->record_offset; + + /* Validate CPER record_length */ + memcpy((uint8_t *)&record_length, &exchange[UEFI_CPER_RECORD_LENGTH_OF= FSET], + sizeof(uint32_t)); + record_length =3D le32_to_cpu(record_length); + if (record_length < UEFI_CPER_RECORD_MIN_SIZE) { + return STATUS_FAILED; + } + if ((s->record_offset + record_length) > exchange_length) { + return STATUS_FAILED; + } + + /* Extract record identifier */ + memcpy((uint8_t *)&record_identifier, &exchange[UEFI_CPER_RECORD_ID_OF= FSET], + sizeof(uint64_t)); + record_identifier =3D le64_to_cpu(record_identifier); + + /* Check for valid record identifier */ + if (!ERST_IS_VALID_RECORD_ID(record_identifier)) { + return STATUS_FAILED; + } + + index =3D lookup_erst_record(s, record_identifier); + if (index) { + /* Record found, overwrite existing record */ + nvram =3D get_nvram_ptr_by_index(s, index); + record_found =3D true; + } else { + /* Record not found, not an overwrite, allocate for write */ + index =3D find_next_empty_record_index(s); + if (index) { + nvram =3D get_nvram_ptr_by_index(s, index); + } else { + /* All slots are occupied */ + rc =3D STATUS_NOT_ENOUGH_SPACE; + } + } + if (nvram) { + /* Write the record into the slot */ + memcpy(nvram, exchange, record_length); + memset(nvram + record_length, exchange_length - record_length, 0xF= F); + /* If a new record, increment the record_count */ + if (!record_found) { + uint32_t record_count; + record_count =3D le32_to_cpu(s->header->record_count); + record_count +=3D 1; /* writing new record */ + s->header->record_count =3D cpu_to_le32(record_count); + } + update_map_entry(s, index, record_identifier); + rc =3D STATUS_SUCCESS; + } + + return rc; +} + +/*******************************************************************/ + +static uint64_t erst_rd_reg64(hwaddr addr, + uint64_t reg, unsigned size) +{ + uint64_t rdval; + uint64_t mask; + unsigned shift; + + if (size =3D=3D sizeof(uint64_t)) { + /* 64b access */ + mask =3D 0xFFFFFFFFFFFFFFFFUL; + shift =3D 0; + } else { + /* 32b access */ + mask =3D 0x00000000FFFFFFFFUL; + shift =3D ((addr & 0x4) =3D=3D 0x4) ? 32 : 0; + } + + rdval =3D reg; + rdval >>=3D shift; + rdval &=3D mask; + + return rdval; +} + +static uint64_t erst_wr_reg64(hwaddr addr, + uint64_t reg, uint64_t val, unsigned size) +{ + uint64_t wrval; + uint64_t mask; + unsigned shift; + + if (size =3D=3D sizeof(uint64_t)) { + /* 64b access */ + mask =3D 0xFFFFFFFFFFFFFFFFUL; + shift =3D 0; + } else { + /* 32b access */ + mask =3D 0x00000000FFFFFFFFUL; + shift =3D ((addr & 0x4) =3D=3D 0x4) ? 32 : 0; + } + + val &=3D mask; + val <<=3D shift; + mask <<=3D shift; + wrval =3D reg; + wrval &=3D ~mask; + wrval |=3D val; + + return wrval; +} + +static void erst_reg_write(void *opaque, hwaddr addr, + uint64_t val, unsigned size) +{ + ERSTDeviceState *s =3D (ERSTDeviceState *)opaque; + + /* + * NOTE: All actions/operations/side effects happen on the WRITE, + * by this implementation's design. The READs simply return the + * reg_value contents. + */ + trace_acpi_erst_reg_write(addr, val, size); + + switch (addr) { + case ERST_VALUE_OFFSET + 0: + case ERST_VALUE_OFFSET + 4: + s->reg_value =3D erst_wr_reg64(addr, s->reg_value, val, size); + break; + case ERST_ACTION_OFFSET + 0: + /* + * NOTE: all valid values written to this register are of the + * ACTION_* variety. Thus there is no need to make this a 64-bit + * register, 32-bits is appropriate. As such ERST_ACTION_OFFSET+4 + * is not needed. + */ + switch (val) { + case ACTION_BEGIN_WRITE_OPERATION: + case ACTION_BEGIN_READ_OPERATION: + case ACTION_BEGIN_CLEAR_OPERATION: + case ACTION_BEGIN_DUMMY_WRITE_OPERATION: + case ACTION_END_OPERATION: + s->operation =3D val; + break; + case ACTION_SET_RECORD_OFFSET: + s->record_offset =3D s->reg_value; + break; + case ACTION_EXECUTE_OPERATION: + if ((uint8_t)s->reg_value =3D=3D ERST_EXECUTE_OPERATION_MAGIC)= { + s->busy_status =3D 1; + switch (s->operation) { + case ACTION_BEGIN_WRITE_OPERATION: + s->command_status =3D write_erst_record(s); + break; + case ACTION_BEGIN_READ_OPERATION: + s->command_status =3D read_erst_record(s); + break; + case ACTION_BEGIN_CLEAR_OPERATION: + s->command_status =3D clear_erst_record(s); + break; + case ACTION_BEGIN_DUMMY_WRITE_OPERATION: + s->command_status =3D STATUS_SUCCESS; + break; + case ACTION_END_OPERATION: + s->command_status =3D STATUS_SUCCESS; + break; + default: + s->command_status =3D STATUS_FAILED; + break; + } + s->busy_status =3D 0; + } + break; + case ACTION_CHECK_BUSY_STATUS: + s->reg_value =3D s->busy_status; + break; + case ACTION_GET_COMMAND_STATUS: + s->reg_value =3D s->command_status; + break; + case ACTION_GET_RECORD_IDENTIFIER: + s->command_status =3D get_next_record_identifier(s, + &s->reg_value, false); + break; + case ACTION_SET_RECORD_IDENTIFIER: + s->record_identifier =3D s->reg_value; + break; + case ACTION_GET_RECORD_COUNT: + s->reg_value =3D le32_to_cpu(s->header->record_count); + break; + case ACTION_GET_ERROR_LOG_ADDRESS_RANGE: + s->reg_value =3D (hwaddr)pci_get_bar_addr(PCI_DEVICE(s), 1); + break; + case ACTION_GET_ERROR_LOG_ADDRESS_LENGTH: + s->reg_value =3D le32_to_cpu(s->header->record_size); + break; + case ACTION_GET_ERROR_LOG_ADDRESS_RANGE_ATTRIBUTES: + s->reg_value =3D 0x0; /* intentional, not NVRAM mode */ + break; + case ACTION_GET_EXECUTE_OPERATION_TIMINGS: + s->reg_value =3D + (100ULL << 32) | /* 100us max time */ + (10ULL << 0) ; /* 10us min time */ + break; + default: + /* Unknown action/command, NOP */ + break; + } + break; + default: + /* This should not happen, but if it does, NOP */ + break; + } +} + +static uint64_t erst_reg_read(void *opaque, hwaddr addr, + unsigned size) +{ + ERSTDeviceState *s =3D (ERSTDeviceState *)opaque; + uint64_t val =3D 0; + + switch (addr) { + case ERST_ACTION_OFFSET + 0: + case ERST_ACTION_OFFSET + 4: + val =3D erst_rd_reg64(addr, s->reg_action, size); + break; + case ERST_VALUE_OFFSET + 0: + case ERST_VALUE_OFFSET + 4: + val =3D erst_rd_reg64(addr, s->reg_value, size); + break; + default: + break; + } + trace_acpi_erst_reg_read(addr, val, size); + return val; +} + +static const MemoryRegionOps erst_reg_ops =3D { + .read =3D erst_reg_read, + .write =3D erst_reg_write, + .endianness =3D DEVICE_NATIVE_ENDIAN, +}; + +/*******************************************************************/ +/*******************************************************************/ +static int erst_post_load(void *opaque, int version_id) +{ + ERSTDeviceState *s =3D opaque; + + /* Recompute pointer to header */ + s->header =3D (ERSTStorageHeader *)get_nvram_ptr_by_index(s, 0); + trace_acpi_erst_post_load(s->header, le32_to_cpu(s->header->record_siz= e)); + + return 0; +} + +static const VMStateDescription erst_vmstate =3D { + .name =3D "acpi-erst", + .version_id =3D 1, + .minimum_version_id =3D 1, + .post_load =3D erst_post_load, + .fields =3D (VMStateField[]) { + VMSTATE_UINT8(operation, ERSTDeviceState), + VMSTATE_UINT8(busy_status, ERSTDeviceState), + VMSTATE_UINT8(command_status, ERSTDeviceState), + VMSTATE_UINT32(record_offset, ERSTDeviceState), + VMSTATE_UINT64(reg_action, ERSTDeviceState), + VMSTATE_UINT64(reg_value, ERSTDeviceState), + VMSTATE_UINT64(record_identifier, ERSTDeviceState), + VMSTATE_UINT32(next_record_index, ERSTDeviceState), + VMSTATE_END_OF_LIST() + } +}; + +static void erst_realizefn(PCIDevice *pci_dev, Error **errp) +{ + ERSTDeviceState *s =3D ACPIERST(pci_dev); + + trace_acpi_erst_realizefn_in(); + + if (!s->hostmem) { + error_setg(errp, "'" ACPI_ERST_MEMDEV_PROP "' property is not set"= ); + return; + } else if (host_memory_backend_is_mapped(s->hostmem)) { + error_setg(errp, "can't use already busy memdev: %s", + object_get_canonical_path_component(OBJECT(s->hostmem))= ); + return; + } + + s->hostmem_mr =3D host_memory_backend_get_memory(s->hostmem); + + /* HostMemoryBackend size will be multiple of PAGE_SIZE */ + s->storage_size =3D object_property_get_int(OBJECT(s->hostmem), "size"= , errp); + + /* Initialize backend storage and record_count */ + check_erst_backend_storage(s, errp); + + /* BAR 0: Programming registers */ + memory_region_init_io(&s->iomem_mr, OBJECT(pci_dev), &erst_reg_ops, s, + TYPE_ACPI_ERST, ERST_REG_SIZE); + pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->iomem_= mr); + + /* BAR 1: Exchange buffer memory */ + memory_region_init_ram(&s->exchange_mr, OBJECT(pci_dev), + "erst.exchange", + le32_to_cpu(s->header->record_size), errp); + pci_register_bar(pci_dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY, + &s->exchange_mr); + + /* Include the backend storage in the migration stream */ + vmstate_register_ram_global(s->hostmem_mr); + + trace_acpi_erst_realizefn_out(s->storage_size); +} + +static void erst_reset(DeviceState *dev) +{ + ERSTDeviceState *s =3D ACPIERST(dev); + + trace_acpi_erst_reset_in(le32_to_cpu(s->header->record_count)); + s->operation =3D 0; + s->busy_status =3D 0; + s->command_status =3D STATUS_SUCCESS; + s->record_identifier =3D ERST_UNSPECIFIED_RECORD_ID; + s->record_offset =3D 0; + s->next_record_index =3D s->first_record_index; + /* NOTE: first/last_record_index are computed only once */ + trace_acpi_erst_reset_out(le32_to_cpu(s->header->record_count)); +} + +static Property erst_properties[] =3D { + DEFINE_PROP_LINK(ACPI_ERST_MEMDEV_PROP, ERSTDeviceState, hostmem, + TYPE_MEMORY_BACKEND, HostMemoryBackend *), + DEFINE_PROP_UINT32(ACPI_ERST_RECORD_SIZE_PROP, ERSTDeviceState, + default_record_size, ERST_RECORD_SIZE), + DEFINE_PROP_END_OF_LIST(), +}; + +static void erst_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); + + trace_acpi_erst_class_init_in(); + k->realize =3D erst_realizefn; + k->vendor_id =3D PCI_VENDOR_ID_REDHAT; + k->device_id =3D PCI_DEVICE_ID_REDHAT_ACPI_ERST; + k->revision =3D 0x00; + k->class_id =3D PCI_CLASS_OTHERS; + dc->reset =3D erst_reset; + dc->vmsd =3D &erst_vmstate; + dc->user_creatable =3D true; + dc->hotpluggable =3D false; + device_class_set_props(dc, erst_properties); + dc->desc =3D "ACPI Error Record Serialization Table (ERST) device"; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); + trace_acpi_erst_class_init_out(); +} + +static const TypeInfo erst_type_info =3D { + .name =3D TYPE_ACPI_ERST, + .parent =3D TYPE_PCI_DEVICE, + .class_init =3D erst_class_init, + .instance_size =3D sizeof(ERSTDeviceState), + .interfaces =3D (InterfaceInfo[]) { + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { } + } +}; + +static void erst_register_types(void) +{ + type_register_static(&erst_type_info); +} + +type_init(erst_register_types) diff --git a/hw/acpi/Kconfig b/hw/acpi/Kconfig index 622b0b50b7..19caebde6c 100644 --- a/hw/acpi/Kconfig +++ b/hw/acpi/Kconfig @@ -10,6 +10,7 @@ config ACPI_X86 select ACPI_HMAT select ACPI_PIIX4 select ACPI_PCIHP + select ACPI_ERST =20 config ACPI_X86_ICH bool @@ -60,3 +61,8 @@ config ACPI_HW_REDUCED select ACPI select ACPI_MEMORY_HOTPLUG select ACPI_NVDIMM + +config ACPI_ERST + bool + default y + depends on ACPI && PCI diff --git a/hw/acpi/meson.build b/hw/acpi/meson.build index adf6347bc4..f5b22983bb 100644 --- a/hw/acpi/meson.build +++ b/hw/acpi/meson.build @@ -22,6 +22,7 @@ acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_true: files('pc= ihp.c')) acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_false: files('acpi-pci-hotplug-s= tub.c')) acpi_ss.add(when: 'CONFIG_ACPI_VIOT', if_true: files('viot.c')) acpi_ss.add(when: 'CONFIG_ACPI_X86_ICH', if_true: files('ich9.c', 'tco.c')) +acpi_ss.add(when: 'CONFIG_ACPI_ERST', if_true: files('erst.c')) acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c'), if_false: files= ('ipmi-stub.c')) acpi_ss.add(when: 'CONFIG_PC', if_false: files('acpi-x86-stub.c')) acpi_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c')) diff --git a/hw/acpi/trace-events b/hw/acpi/trace-events index 974d770e8b..2250126a22 100644 --- a/hw/acpi/trace-events +++ b/hw/acpi/trace-events @@ -55,3 +55,18 @@ piix4_gpe_writeb(uint64_t addr, unsigned width, uint64_t= val) "addr: 0x%" PRIx64 # tco.c tco_timer_reload(int ticks, int msec) "ticks=3D%d (%d ms)" tco_timer_expired(int timeouts_no, bool strap, bool no_reboot) "timeouts_n= o=3D%d no_reboot=3D%d/%d" + +# erst.c +acpi_erst_reg_write(uint64_t addr, uint64_t val, unsigned size) "addr: 0x%= 04" PRIx64 " <=3D=3D 0x%016" PRIx64 " (size: %u)" +acpi_erst_reg_read(uint64_t addr, uint64_t val, unsigned size) " addr: 0x%= 04" PRIx64 " =3D=3D> 0x%016" PRIx64 " (size: %u)" +acpi_erst_mem_write(uint64_t addr, uint64_t val, unsigned size) "addr: 0x%= 06" PRIx64 " <=3D=3D 0x%016" PRIx64 " (size: %u)" +acpi_erst_mem_read(uint64_t addr, uint64_t val, unsigned size) " addr: 0x%= 06" PRIx64 " =3D=3D> 0x%016" PRIx64 " (size: %u)" +acpi_erst_pci_bar_0(uint64_t addr) "BAR0: 0x%016" PRIx64 +acpi_erst_pci_bar_1(uint64_t addr) "BAR1: 0x%016" PRIx64 +acpi_erst_realizefn_in(void) +acpi_erst_realizefn_out(unsigned size) "total nvram size %u bytes" +acpi_erst_reset_in(unsigned record_count) "record_count %u" +acpi_erst_reset_out(unsigned record_count) "record_count %u" +acpi_erst_post_load(void *header, unsigned slot_size) "header: 0x%p slot_s= ize %u" +acpi_erst_class_init_in(void) +acpi_erst_class_init_out(void) --=20 MST From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 164414157787412.809393200537784; Sun, 6 Feb 2022 01:59:37 -0800 (PST) Received: from localhost ([::1]:56620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGeKW-0000Gs-OM for importer@patchew.org; Sun, 06 Feb 2022 04:59:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44748) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe0K-0000zp-Na for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:44 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:27070) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe0I-0003jK-8y for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:44 -0500 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-625-CdMVMhUZMA2dx73YVKfnpg-1; Sun, 06 Feb 2022 04:38:40 -0500 Received: by mail-wm1-f70.google.com with SMTP id f7-20020a1cc907000000b0034b63f314ccso3941862wmb.6 for ; Sun, 06 Feb 2022 01:38:40 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id t4sm1823720wrx.65.2022.02.06.01.38.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:38:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140321; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oudt/FBonwg9JyTuwLEnFya3I69aaC2gWjL/G+/psDs=; b=ivKeQ73WR2D0hL/Ru21jrGEUNG8kiI2FrjLmk0pZWkS3Wx2Py+GDR+N4H0uA2UFE7oS4/1 5M7FmscmMPX8LPn+oALVfKmUm6ieOdG8REJmgTMiBdiDQJOST5HTQmM6FQUARu0M1IIbEw ArLt9iVkt491xqecOYJUdD0Uh5gyw1s= X-MC-Unique: CdMVMhUZMA2dx73YVKfnpg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=oudt/FBonwg9JyTuwLEnFya3I69aaC2gWjL/G+/psDs=; b=C0yjNiy8TUrkg4nE/TYgESQLhfgioewQ6jpnwHtl1CJnQ45Q45ypTcCOqzDZIU7aNZ FKTcKIQxGID1cExX6TnSURukFK6EAfYuw60Sc2x+H5T3dzGs2Q7qXfrWKEnuI1eoR0kv LnU3d/GxcjS9Z8b7DzIz6hc1ic90Zst8Hj60GIIIpO9syht6E9L5zDS5lULOEnIY032n heJ1iC0u4I1LTb/MbRZLhWRXF/xvz4EDsI+BbN6SEcIaQn8zUULveMu0btlJfBJC5H38 j/S5iXN9qWO1QrGIHa2pvj2lGTAnt8urNJJbyQaiaIFZ44DLfDP8km3+xCMtGAnVytzP d74g== X-Gm-Message-State: AOAM530TP95vcMrZ0nYeMmnjBkgBfwpZM9HaaUZ9PrhX5EsYyKVzvseH JfCiQrrwr5qLy2JZE2BRG7jlUFJ1QkQJbaJ2B9u9fI02q2BZX5Z67BLJWYfMUaGNJdk/k5UUx0V RqfS4Cm/Pevsu4VMM2w1mh7DLancTmQYfPeXubl62DevWxLa24jjWAyQGqakB X-Received: by 2002:a7b:c8d1:: with SMTP id f17mr2940970wml.167.1644140319260; Sun, 06 Feb 2022 01:38:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJxu1wl1WmqQ/8NlcxqBxE90KF1L48Oztbp/6HAH6HUDZT1S5SL0+ToMsB+qMoTu1tFqN2f6oQ== X-Received: by 2002:a7b:c8d1:: with SMTP id f17mr2940950wml.167.1644140318976; Sun, 06 Feb 2022 01:38:38 -0800 (PST) Date: Sun, 6 Feb 2022 04:38:36 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 19/24] ACPI ERST: build the ACPI ERST table Message-ID: <20220206093702.1282676-20-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Eric DeVolder , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644141578825100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric DeVolder This builds the ACPI ERST table to inform OSPM how to communicate with the acpi-erst device. Signed-off-by: Eric DeVolder Reviewed-by: Ani Sinha Message-Id: <1643402289-22216-7-git-send-email-eric.devolder@oracle.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/erst.c | 211 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 211 insertions(+) diff --git a/hw/acpi/erst.c b/hw/acpi/erst.c index 8a691cb5fe..c0a23cf467 100644 --- a/hw/acpi/erst.c +++ b/hw/acpi/erst.c @@ -55,6 +55,27 @@ #define STATUS_RECORD_STORE_EMPTY 0x04 #define STATUS_RECORD_NOT_FOUND 0x05 =20 +/* ACPI 4.0: Table 17-19 Serialization Instructions */ +#define INST_READ_REGISTER 0x00 +#define INST_READ_REGISTER_VALUE 0x01 +#define INST_WRITE_REGISTER 0x02 +#define INST_WRITE_REGISTER_VALUE 0x03 +#define INST_NOOP 0x04 +#define INST_LOAD_VAR1 0x05 +#define INST_LOAD_VAR2 0x06 +#define INST_STORE_VAR1 0x07 +#define INST_ADD 0x08 +#define INST_SUBTRACT 0x09 +#define INST_ADD_VALUE 0x0A +#define INST_SUBTRACT_VALUE 0x0B +#define INST_STALL 0x0C +#define INST_STALL_WHILE_TRUE 0x0D +#define INST_SKIP_NEXT_INSTRUCTION_IF_TRUE 0x0E +#define INST_GOTO 0x0F +#define INST_SET_SRC_ADDRESS_BASE 0x10 +#define INST_SET_DST_ADDRESS_BASE 0x11 +#define INST_MOVE_DATA 0x12 + /* UEFI 2.1: Appendix N Common Platform Error Record */ #define UEFI_CPER_RECORD_MIN_SIZE 128U #define UEFI_CPER_RECORD_LENGTH_OFFSET 20U @@ -166,6 +187,196 @@ typedef struct { =20 } ERSTDeviceState; =20 +/*******************************************************************/ +/*******************************************************************/ +typedef struct { + GArray *table_data; + pcibus_t bar; + uint8_t instruction; + uint8_t flags; + uint8_t register_bit_width; + pcibus_t register_offset; +} BuildSerializationInstructionEntry; + +/* ACPI 4.0: 17.4.1.2 Serialization Instruction Entries */ +static void build_serialization_instruction( + BuildSerializationInstructionEntry *e, + uint8_t serialization_action, + uint64_t value) +{ + /* ACPI 4.0: Table 17-18 Serialization Instruction Entry */ + struct AcpiGenericAddress gas; + uint64_t mask; + + /* Serialization Action */ + build_append_int_noprefix(e->table_data, serialization_action, 1); + /* Instruction */ + build_append_int_noprefix(e->table_data, e->instruction, 1); + /* Flags */ + build_append_int_noprefix(e->table_data, e->flags, 1); + /* Reserved */ + build_append_int_noprefix(e->table_data, 0, 1); + /* Register Region */ + gas.space_id =3D AML_SYSTEM_MEMORY; + gas.bit_width =3D e->register_bit_width; + gas.bit_offset =3D 0; + gas.access_width =3D (uint8_t)ctz32(e->register_bit_width) - 2; + gas.address =3D (uint64_t)(e->bar + e->register_offset); + build_append_gas_from_struct(e->table_data, &gas); + /* Value */ + build_append_int_noprefix(e->table_data, value, 8); + /* Mask */ + mask =3D (1ULL << (e->register_bit_width - 1) << 1) - 1; + build_append_int_noprefix(e->table_data, mask, 8); +} + +/* ACPI 4.0: 17.4.1 Serialization Action Table */ +void build_erst(GArray *table_data, BIOSLinker *linker, Object *erst_dev, + const char *oem_id, const char *oem_table_id) +{ + /* + * Serialization Action Table + * The serialization action table must be generated first + * so that its size can be known in order to populate the + * Instruction Entry Count field. + */ + unsigned action; + GArray *table_instruction_data =3D g_array_new(FALSE, FALSE, sizeof(ch= ar)); + pcibus_t bar0 =3D pci_get_bar_addr(PCI_DEVICE(erst_dev), 0); + AcpiTable table =3D { .sig =3D "ERST", .rev =3D 1, .oem_id =3D oem_id, + .oem_table_id =3D oem_table_id }; + /* Contexts for the different ways ACTION and VALUE are accessed */ + BuildSerializationInstructionEntry rd_value_32_val =3D { + .table_data =3D table_instruction_data, .bar =3D bar0, .flags =3D = 0, + .instruction =3D INST_READ_REGISTER_VALUE, + .register_bit_width =3D 32, + .register_offset =3D ERST_VALUE_OFFSET, + }; + BuildSerializationInstructionEntry rd_value_32 =3D { + .table_data =3D table_instruction_data, .bar =3D bar0, .flags =3D = 0, + .instruction =3D INST_READ_REGISTER, + .register_bit_width =3D 32, + .register_offset =3D ERST_VALUE_OFFSET, + }; + BuildSerializationInstructionEntry rd_value_64 =3D { + .table_data =3D table_instruction_data, .bar =3D bar0, .flags =3D = 0, + .instruction =3D INST_READ_REGISTER, + .register_bit_width =3D 64, + .register_offset =3D ERST_VALUE_OFFSET, + }; + BuildSerializationInstructionEntry wr_value_32_val =3D { + .table_data =3D table_instruction_data, .bar =3D bar0, .flags =3D = 0, + .instruction =3D INST_WRITE_REGISTER_VALUE, + .register_bit_width =3D 32, + .register_offset =3D ERST_VALUE_OFFSET, + }; + BuildSerializationInstructionEntry wr_value_32 =3D { + .table_data =3D table_instruction_data, .bar =3D bar0, .flags =3D = 0, + .instruction =3D INST_WRITE_REGISTER, + .register_bit_width =3D 32, + .register_offset =3D ERST_VALUE_OFFSET, + }; + BuildSerializationInstructionEntry wr_value_64 =3D { + .table_data =3D table_instruction_data, .bar =3D bar0, .flags =3D = 0, + .instruction =3D INST_WRITE_REGISTER, + .register_bit_width =3D 64, + .register_offset =3D ERST_VALUE_OFFSET, + }; + BuildSerializationInstructionEntry wr_action =3D { + .table_data =3D table_instruction_data, .bar =3D bar0, .flags =3D = 0, + .instruction =3D INST_WRITE_REGISTER_VALUE, + .register_bit_width =3D 32, + .register_offset =3D ERST_ACTION_OFFSET, + }; + + trace_acpi_erst_pci_bar_0(bar0); + + /* Serialization Instruction Entries */ + action =3D ACTION_BEGIN_WRITE_OPERATION; + build_serialization_instruction(&wr_action, action, action); + + action =3D ACTION_BEGIN_READ_OPERATION; + build_serialization_instruction(&wr_action, action, action); + + action =3D ACTION_BEGIN_CLEAR_OPERATION; + build_serialization_instruction(&wr_action, action, action); + + action =3D ACTION_END_OPERATION; + build_serialization_instruction(&wr_action, action, action); + + action =3D ACTION_SET_RECORD_OFFSET; + build_serialization_instruction(&wr_value_32, action, 0); + build_serialization_instruction(&wr_action, action, action); + + action =3D ACTION_EXECUTE_OPERATION; + build_serialization_instruction(&wr_value_32_val, action, + ERST_EXECUTE_OPERATION_MAGIC); + build_serialization_instruction(&wr_action, action, action); + + action =3D ACTION_CHECK_BUSY_STATUS; + build_serialization_instruction(&wr_action, action, action); + build_serialization_instruction(&rd_value_32_val, action, 0x01); + + action =3D ACTION_GET_COMMAND_STATUS; + build_serialization_instruction(&wr_action, action, action); + build_serialization_instruction(&rd_value_32, action, 0); + + action =3D ACTION_GET_RECORD_IDENTIFIER; + build_serialization_instruction(&wr_action, action, action); + build_serialization_instruction(&rd_value_64, action, 0); + + action =3D ACTION_SET_RECORD_IDENTIFIER; + build_serialization_instruction(&wr_value_64, action, 0); + build_serialization_instruction(&wr_action, action, action); + + action =3D ACTION_GET_RECORD_COUNT; + build_serialization_instruction(&wr_action, action, action); + build_serialization_instruction(&rd_value_32, action, 0); + + action =3D ACTION_BEGIN_DUMMY_WRITE_OPERATION; + build_serialization_instruction(&wr_action, action, action); + + action =3D ACTION_GET_ERROR_LOG_ADDRESS_RANGE; + build_serialization_instruction(&wr_action, action, action); + build_serialization_instruction(&rd_value_64, action, 0); + + action =3D ACTION_GET_ERROR_LOG_ADDRESS_LENGTH; + build_serialization_instruction(&wr_action, action, action); + build_serialization_instruction(&rd_value_64, action, 0); + + action =3D ACTION_GET_ERROR_LOG_ADDRESS_RANGE_ATTRIBUTES; + build_serialization_instruction(&wr_action, action, action); + build_serialization_instruction(&rd_value_32, action, 0); + + action =3D ACTION_GET_EXECUTE_OPERATION_TIMINGS; + build_serialization_instruction(&wr_action, action, action); + build_serialization_instruction(&rd_value_64, action, 0); + + /* Serialization Header */ + acpi_table_begin(&table, table_data); + + /* Serialization Header Size */ + build_append_int_noprefix(table_data, 48, 4); + + /* Reserved */ + build_append_int_noprefix(table_data, 0, 4); + + /* + * Instruction Entry Count + * Each instruction entry is 32 bytes + */ + g_assert((table_instruction_data->len) % 32 =3D=3D 0); + build_append_int_noprefix(table_data, + (table_instruction_data->len / 32), 4); + + /* Serialization Instruction Entries */ + g_array_append_vals(table_data, table_instruction_data->data, + table_instruction_data->len); + g_array_free(table_instruction_data, TRUE); + + acpi_table_end(linker, &table); +} + /*******************************************************************/ /*******************************************************************/ static uint8_t *get_nvram_ptr_by_index(ERSTDeviceState *s, unsigned index) --=20 MST From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644142860137271.1613226430492; Sun, 6 Feb 2022 02:21:00 -0800 (PST) Received: from localhost ([::1]:38696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGefD-0001rl-Lp for importer@patchew.org; Sun, 06 Feb 2022 05:20:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44798) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe0R-0001GZ-05 for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:51 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:46690) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe0O-0003k8-Ag for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:50 -0500 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-111-c6V3DAGtMTmOdhFdDU9JYg-1; Sun, 06 Feb 2022 04:38:45 -0500 Received: by mail-wm1-f69.google.com with SMTP id z2-20020a05600c220200b0034d2eb95f27so3956972wml.1 for ; Sun, 06 Feb 2022 01:38:44 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id e10sm7506404wrq.53.2022.02.06.01.38.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:38:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140325; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Xdn3hH7GYkmOyJreuMxMec/MdQOpS7XbSzRxBzQ41Cg=; b=X4o2OAoxQI1PV+ESlhmqPTxvnrqn2UH+OzqJG0GRwncUrZ5Y/r9CmoD6PpBwPBHwb9MpWh 66HISlZJSzjLGUsMnt1D9B1jbGMn+Z2GaWcLYqw/W9CoQcooC/ItqlCApgLdB80xkrZaPi UrQwrBz3TjGejWfdJpZp3EzsD13weSs= X-MC-Unique: c6V3DAGtMTmOdhFdDU9JYg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Xdn3hH7GYkmOyJreuMxMec/MdQOpS7XbSzRxBzQ41Cg=; b=E4QvJalH25o9AzyAjtuyV72iprGZF93ZeCpRiiIYoGSkNg9m5PZJJJd/QAVQvJNnvO s65BhuyCFDfvUI4F7c74SowuEXDmunys57rE430ViMiS01lpfYz8t0JxrUAzANLfSFgO MmaQO1Reaq9c/RXxYWo47WXFm/uFrMtPphFy+vavopvAx33rLsRpjLY8P7CRfDADZ1mV c3mElA4vTzh/g8bCQhPAAMD4NU2/wyP45gsiZetaJmPFwZSCKaN+SycTuoH6onSiKj1F GXE0eCpsHgjqMtN39SFvj+0O4jEVMM6EcNtdJMqc+irH4C/KdtXnclhx7RiAFH+BOYuV ebIA== X-Gm-Message-State: AOAM533X8rBR0rHO0sAr2zOaJu7AMPPkRSXrjZGUcuTV2BS3yTI/E1+b r0Cwn7d7lfdq9O0SeZ9CfzHRJ2F35So45Szo4RYC3aGr8N5T0iooDqfreZ9MFijc2kevHwMY5ww ZkVWLe69sqMF54i1hsHKlR8uqhfpxBJtV1YVsD8JyzpzptUy4dHp4p6CfmrHP X-Received: by 2002:adf:f001:: with SMTP id j1mr4113435wro.48.1644140322397; Sun, 06 Feb 2022 01:38:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJwP/bf5qKZfE1bquerEidiYi41CmG8JqRXwdrFMFwiSjk9VOz/h1kiTcCKkptCJ7TLlJno0AA== X-Received: by 2002:adf:f001:: with SMTP id j1mr4113404wro.48.1644140322104; Sun, 06 Feb 2022 01:38:42 -0800 (PST) Date: Sun, 6 Feb 2022 04:38:39 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 20/24] ACPI ERST: create ACPI ERST table for pc/x86 machines Message-ID: <20220206093702.1282676-21-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Peter Maydell , Richard Henderson , Igor Mammedov , Ani Sinha , Paolo Bonzini , Eric DeVolder Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644142861799100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric DeVolder This change exposes ACPI ERST support for x86 guests. Signed-off-by: Eric DeVolder Reviewed-by: Ani Sinha Message-Id: <1643402289-22216-8-git-send-email-eric.devolder@oracle.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/erst.h | 5 +++++ hw/i386/acpi-build.c | 15 +++++++++++++++ hw/i386/acpi-microvm.c | 15 +++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/include/hw/acpi/erst.h b/include/hw/acpi/erst.h index 9d637179fe..b747fe7739 100644 --- a/include/hw/acpi/erst.h +++ b/include/hw/acpi/erst.h @@ -16,4 +16,9 @@ void build_erst(GArray *table_data, BIOSLinker *linker, O= bject *erst_dev, =20 #define TYPE_ACPI_ERST "acpi-erst" =20 +/* returns NULL unless there is exactly one device */ +static inline Object *find_erst_dev(void) +{ + return object_resolve_path_type("", TYPE_ACPI_ERST, NULL); +} #endif diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index ce823e8fcb..ebd47aa26f 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -43,6 +43,7 @@ #include "sysemu/tpm.h" #include "hw/acpi/tpm.h" #include "hw/acpi/vmgenid.h" +#include "hw/acpi/erst.h" #include "sysemu/tpm_backend.h" #include "hw/rtc/mc146818rtc_regs.h" #include "migration/vmstate.h" @@ -74,6 +75,8 @@ #include "hw/acpi/hmat.h" #include "hw/acpi/viot.h" =20 +#include CONFIG_DEVICES + /* These are used to size the ACPI tables for -M pc-i440fx-1.7 and * -M pc-i440fx-2.0. Even if the actual amount of AML generated grows * a little bit, there should be plenty of free space since the DSDT @@ -2575,6 +2578,18 @@ void acpi_build(AcpiBuildTables *tables, MachineStat= e *machine) ACPI_DEVICE_IF(x86ms->acpi_dev), x86ms->oem_id, x86ms->oem_table_id); =20 +#ifdef CONFIG_ACPI_ERST + { + Object *erst_dev; + erst_dev =3D find_erst_dev(); + if (erst_dev) { + acpi_add_table(table_offsets, tables_blob); + build_erst(tables_blob, tables->linker, erst_dev, + x86ms->oem_id, x86ms->oem_table_id); + } + } +#endif + vmgenid_dev =3D find_vmgenid_dev(); if (vmgenid_dev) { acpi_add_table(table_offsets, tables_blob); diff --git a/hw/i386/acpi-microvm.c b/hw/i386/acpi-microvm.c index 196d318499..68ca7e7fc2 100644 --- a/hw/i386/acpi-microvm.c +++ b/hw/i386/acpi-microvm.c @@ -30,6 +30,7 @@ #include "hw/acpi/bios-linker-loader.h" #include "hw/acpi/generic_event_device.h" #include "hw/acpi/utils.h" +#include "hw/acpi/erst.h" #include "hw/i386/fw_cfg.h" #include "hw/i386/microvm.h" #include "hw/pci/pci.h" @@ -40,6 +41,8 @@ #include "acpi-common.h" #include "acpi-microvm.h" =20 +#include CONFIG_DEVICES + static void acpi_dsdt_add_virtio(Aml *scope, MicrovmMachineState *mms) { @@ -207,6 +210,18 @@ static void acpi_build_microvm(AcpiBuildTables *tables, ACPI_DEVICE_IF(x86ms->acpi_dev), x86ms->oem_id, x86ms->oem_table_id); =20 +#ifdef CONFIG_ACPI_ERST + { + Object *erst_dev; + erst_dev =3D find_erst_dev(); + if (erst_dev) { + acpi_add_table(table_offsets, tables_blob); + build_erst(tables_blob, tables->linker, erst_dev, + x86ms->oem_id, x86ms->oem_table_id); + } + } +#endif + xsdt =3D tables_blob->len; build_xsdt(tables_blob, tables->linker, table_offsets, x86ms->oem_id, x86ms->oem_table_id); --=20 MST From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644142737891144.29445713402822; Sun, 6 Feb 2022 02:18:57 -0800 (PST) Received: from localhost ([::1]:34718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGedE-00079d-T5 for importer@patchew.org; Sun, 06 Feb 2022 05:18:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44822) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe0S-0001IN-FX for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:54 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:20035) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe0O-0003kJ-Jt for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:52 -0500 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-364-_kWfime3PWiYKeo3UGcmFw-1; Sun, 06 Feb 2022 04:38:47 -0500 Received: by mail-wm1-f72.google.com with SMTP id l20-20020a05600c1d1400b0035153bf34c3so10259034wms.2 for ; Sun, 06 Feb 2022 01:38:46 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id u15sm6749066wrn.48.2022.02.06.01.38.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:38:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140328; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=FhxRLp0KDAzhtQmUioW0yaEQwWt+iaD8ezq+xiFdg2E=; b=EWusp4i4W6Abake3eAF3OvtCEJg/Noo2HtN9l/DkZHbakdAxDTVf+aeA+JPBcigNrtKk89 EXxUFoNGDnygCxGqYMaM4EDfsQPEugDfn2tuY+XrIpizm68TSg0iymVTmTfMrwBFYwg9v0 T+oKLnIRYpErgX+BkUl5Ic+unopwfps= X-MC-Unique: _kWfime3PWiYKeo3UGcmFw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=FhxRLp0KDAzhtQmUioW0yaEQwWt+iaD8ezq+xiFdg2E=; b=qeUE7NoahSppZMBGFYqllMrMuz116QNVoqEblGy2PkcLLC3jxIJfStdgTcTMrxXuYJ f1bdQ8iaahcZKnOVV906zrgHSD/Z1Hey97GMHWXK41A/UNEt3J8UYGNDYdeE18/6QxWP Ziy8KMiaXBbB3oR2vvwOmxwNMHrrIYEPimPR+YRC8PQWDjN88BxuqUEV+Mu9HoZq965E xmdDqNdwY2uCcwkPXQ5nqjsLehe6FB6JRO9HOHFyOMvj9dWLHFMzI6JOI9lgUgURi41n DGYoj+5wViMjspJgXqSTjDaDTOWxtIcLpvAQ2K43dDWgH8elaIV1Z5QsOYHL3uvPAUAL AW/w== X-Gm-Message-State: AOAM532PsDSr1c5LXe8dkJTgmpICRmDD3LI/pxJEAhh9eILvw2Qrfc59 UasOkI1o9Q2d1OPomMaJll4zCfrT06DIIK38bQMtYvW1b9YJkPqv2mPUqGve53ywUB+9031zs3W krUNLqdTap/usdxZOIp7afZJ37nWfi2DBP3mGNZPQGcydREbO9+1xjSmcTEwW X-Received: by 2002:a5d:64c3:: with SMTP id f3mr5683415wri.123.1644140325366; Sun, 06 Feb 2022 01:38:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJy/RfdbVNouDWB9GdbxEqZrkpgZAOZUfqD/dy+jiAeTscTJoyUE+FmzwyxAPVPtJZAs2ug2yw== X-Received: by 2002:a5d:64c3:: with SMTP id f3mr5683385wri.123.1644140324964; Sun, 06 Feb 2022 01:38:44 -0800 (PST) Date: Sun, 6 Feb 2022 04:38:42 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 21/24] ACPI ERST: qtest for ERST Message-ID: <20220206093702.1282676-22-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Ani Sinha , Paolo Bonzini , Eric DeVolder Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644142738791100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric DeVolder This change provides a qtest that locates and then does a simple interrogation of the ERST feature within the guest. Signed-off-by: Eric DeVolder Reviewed-by: Ani Sinha Message-Id: <1643402289-22216-9-git-send-email-eric.devolder@oracle.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/erst-test.c | 164 ++++++++++++++++++++++++++++++++++++++++ tests/qtest/meson.build | 2 + 2 files changed, 166 insertions(+) create mode 100644 tests/qtest/erst-test.c diff --git a/tests/qtest/erst-test.c b/tests/qtest/erst-test.c new file mode 100644 index 0000000000..c6a0ae4013 --- /dev/null +++ b/tests/qtest/erst-test.c @@ -0,0 +1,164 @@ +/* + * QTest testcase for acpi-erst + * + * Copyright (c) 2021 Oracle + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include +#include "libqos/libqos-pc.h" +#include "libqos/libqtest.h" +#include "qemu-common.h" + +#include "hw/pci/pci.h" + +static void save_fn(QPCIDevice *dev, int devfn, void *data) +{ + QPCIDevice **pdev =3D (QPCIDevice **) data; + + *pdev =3D dev; +} + +static QPCIDevice *get_erst_device(QPCIBus *pcibus) +{ + QPCIDevice *dev; + + dev =3D NULL; + qpci_device_foreach(pcibus, + PCI_VENDOR_ID_REDHAT, + PCI_DEVICE_ID_REDHAT_ACPI_ERST, + save_fn, &dev); + g_assert(dev !=3D NULL); + + return dev; +} + +typedef struct _ERSTState { + QOSState *qs; + QPCIBar reg_bar, mem_bar; + uint64_t reg_barsize, mem_barsize; + QPCIDevice *dev; +} ERSTState; + +#define ACTION 0 +#define VALUE 8 + +static const char *reg2str(unsigned reg) +{ + switch (reg) { + case 0: + return "ACTION"; + case 8: + return "VALUE"; + default: + return NULL; + } +} + +static inline uint32_t in_reg32(ERSTState *s, unsigned reg) +{ + const char *name =3D reg2str(reg); + uint32_t res; + + res =3D qpci_io_readl(s->dev, s->reg_bar, reg); + g_test_message("*%s -> %08x", name, res); + + return res; +} + +static inline uint64_t in_reg64(ERSTState *s, unsigned reg) +{ + const char *name =3D reg2str(reg); + uint64_t res; + + res =3D qpci_io_readq(s->dev, s->reg_bar, reg); + g_test_message("*%s -> %016llx", name, (unsigned long long)res); + + return res; +} + +static inline void out_reg32(ERSTState *s, unsigned reg, uint32_t v) +{ + const char *name =3D reg2str(reg); + + g_test_message("%08x -> *%s", v, name); + qpci_io_writel(s->dev, s->reg_bar, reg, v); +} + +static void cleanup_vm(ERSTState *s) +{ + g_free(s->dev); + qtest_shutdown(s->qs); +} + +static void setup_vm_cmd(ERSTState *s, const char *cmd) +{ + const char *arch =3D qtest_get_arch(); + + if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { + s->qs =3D qtest_pc_boot(cmd); + } else { + g_printerr("erst-test tests are only available on x86\n"); + exit(EXIT_FAILURE); + } + s->dev =3D get_erst_device(s->qs->pcibus); + + s->reg_bar =3D qpci_iomap(s->dev, 0, &s->reg_barsize); + g_assert_cmpuint(s->reg_barsize, =3D=3D, 16); + + s->mem_bar =3D qpci_iomap(s->dev, 1, &s->mem_barsize); + g_assert_cmpuint(s->mem_barsize, =3D=3D, 0x2000); + + qpci_device_enable(s->dev); +} + +static void test_acpi_erst_basic(void) +{ + ERSTState state; + uint64_t log_address_range; + uint64_t log_address_length; + uint32_t log_address_attr; + + setup_vm_cmd(&state, + "-object memory-backend-file," + "mem-path=3Dacpi-erst.XXXXXX," + "size=3D64K," + "share=3Don," + "id=3Dnvram " + "-device acpi-erst," + "memdev=3Dnvram"); + + out_reg32(&state, ACTION, 0xD); + log_address_range =3D in_reg64(&state, VALUE); + out_reg32(&state, ACTION, 0xE); + log_address_length =3D in_reg64(&state, VALUE); + out_reg32(&state, ACTION, 0xF); + log_address_attr =3D in_reg32(&state, VALUE); + + /* Check log_address_range is not 0, ~0 or base */ + g_assert_cmpuint(log_address_range, !=3D, 0ULL); + g_assert_cmpuint(log_address_range, !=3D, ~0ULL); + g_assert_cmpuint(log_address_range, !=3D, state.reg_bar.addr); + g_assert_cmpuint(log_address_range, =3D=3D, state.mem_bar.addr); + + /* Check log_address_length is bar1_size */ + g_assert_cmpuint(log_address_length, =3D=3D, state.mem_barsize); + + /* Check log_address_attr is 0 */ + g_assert_cmpuint(log_address_attr, =3D=3D, 0); + + cleanup_vm(&state); +} + +int main(int argc, char **argv) +{ + int ret; + + g_test_init(&argc, &argv, NULL); + qtest_add_func("/acpi-erst/basic", test_acpi_erst_basic); + ret =3D g_test_run(); + return ret; +} diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 842b1df420..762f6adcd5 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -68,6 +68,7 @@ qtests_i386 =3D \ (config_all_devices.has_key('CONFIG_RTL8139_PCI') ? ['rtl8139-test'] : [= ]) + \ (config_all_devices.has_key('CONFIG_E1000E_PCI_EXPRESS') ? ['fuzz-e1000e= -test'] : []) + \ (config_all_devices.has_key('CONFIG_ESP_PCI') ? ['am53c974-test'] : []) = + \ + (config_all_devices.has_key('CONFIG_ACPI_ERST') ? ['erst-test'] : []) + = \ (config_all_devices.has_key('CONFIG_VIRTIO_NET') and = \ config_all_devices.has_key('CONFIG_Q35') and = \ config_all_devices.has_key('CONFIG_VIRTIO_PCI') and = \ @@ -278,6 +279,7 @@ qtests =3D { 'bios-tables-test': [io, 'boot-sector.c', 'acpi-utils.c', 'tpm-emu.c'], 'cdrom-test': files('boot-sector.c'), 'dbus-vmstate-test': files('migration-helpers.c') + dbus_vmstate1, + 'erst-test': files('erst-test.c'), 'ivshmem-test': [rt, '../../contrib/ivshmem-server/ivshmem-server.c'], 'migration-test': files('migration-helpers.c'), 'pxe-test': files('boot-sector.c'), --=20 MST From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644141962806858.5255317004896; Sun, 6 Feb 2022 02:06:02 -0800 (PST) Received: from localhost ([::1]:38524 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGeQj-0007B6-B1 for importer@patchew.org; Sun, 06 Feb 2022 05:06:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe0T-0001IV-2F for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:54 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:54169) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe0R-0003kR-3t for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:52 -0500 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-189-1ubf8qo5NlaKfX6cvkknxw-1; Sun, 06 Feb 2022 04:38:49 -0500 Received: by mail-wm1-f69.google.com with SMTP id h82-20020a1c2155000000b003552c13626cso5869874wmh.3 for ; Sun, 06 Feb 2022 01:38:49 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id z3sm6684243wmp.42.2022.02.06.01.38.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:38:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140330; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UMs3Bqr7ndxy424fwUSUxAviE1013bB9zLk/9skNKHQ=; b=APEYgOX9BhFWl5opYTy3zDbnJM5uT3eCEeBUCCLu/qMQhbWSN/hP/cZM2D2UZpl5a9OKWh dTFt6oFlMk9JW2m3HYYs/iWuFO1aL7QgWMG0pffSbJKewDrYPCJt6Bg9Bw/lnBCpmH4Hwn 2S7bolD5KWBeBlxQ5ojYPXy16tDm3DM= X-MC-Unique: 1ubf8qo5NlaKfX6cvkknxw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=UMs3Bqr7ndxy424fwUSUxAviE1013bB9zLk/9skNKHQ=; b=HtaRAnMjMGF8ReAt2HAG4Tl2VeiXiIIZSS+GbTeeOkqAQXKEtCvjPi7dHMhky7bAco eYZxh+5m/5LWTb/bkT6Udc7AzDbVzkeYjYNrIU0wGsAMmWXoYuMWBKHuEC7L4cchwu9N OUn2zwnl+XRdYOaSeO3I4F04qd3re1008LosGHsTYhPwoZB5lOMPS8sUKZjj5k/S3PgA KZ0x64FGpIdaJQDZUf5CV518aggENubWvBOwP4vzch7KBFw/oSulhkbI1SvhvMkiCqts xoGdFSny+qlbTPZ7vxZNLHVjsY/B9wWJ6LP4M2/TH4+ebtAKjTqnekDRkno0uQchTqIu Mw9Q== X-Gm-Message-State: AOAM531thEftLmm/l2we9lh4iaJcYrrLd2haknK0s1vDNPaj0if+gTi9 PZZzgg3OhAuChsUTI8g03bmb19SZPxxS58uxbtvwpnJBLcPUrfWkvNOYw6Vk+KaRhQt7Nrdh8oS dKGVAKTP8hHCcHZPVCkBGSDSuxE3LcS4Z2o5BUB+wHrbmTTpsyRfw9zTdH3Fn X-Received: by 2002:a05:600c:3b92:: with SMTP id n18mr6334772wms.86.1644140327722; Sun, 06 Feb 2022 01:38:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxVanRrCLhN+b06K6b0KpPNtHJphU7s1HRB6SjVHJx48QWsc8JcayM4833tR+Nnu8tv0PvOsA== X-Received: by 2002:a05:600c:3b92:: with SMTP id n18mr6334751wms.86.1644140327458; Sun, 06 Feb 2022 01:38:47 -0800 (PST) Date: Sun, 6 Feb 2022 04:38:45 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 22/24] ACPI ERST: bios-tables-test testcase Message-ID: <20220206093702.1282676-23-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Eric DeVolder , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644141963581100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric DeVolder This change implements the test suite checks for the ERST table. Signed-off-by: Eric DeVolder Reviewed-by: Ani Sinha Message-Id: <1643402289-22216-10-git-send-email-eric.devolder@oracle.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 54 ++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index ad536fd7b1..c4a2d1e166 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -1447,6 +1447,57 @@ static void test_acpi_piix4_tcg_acpi_hmat(void) test_acpi_tcg_acpi_hmat(MACHINE_PC); } =20 +static void test_acpi_erst(const char *machine) +{ + gchar *tmp_path =3D g_dir_make_tmp("qemu-test-erst.XXXXXX", NULL); + gchar *params; + test_data data; + + memset(&data, 0, sizeof(data)); + data.machine =3D machine; + data.variant =3D ".acpierst"; + params =3D g_strdup_printf( + " -object memory-backend-file,id=3Derstnvram," + "mem-path=3D%s,size=3D0x10000,share=3Don" + " -device acpi-erst,memdev=3Derstnvram", tmp_path); + test_acpi_one(params, &data); + free_test_data(&data); + g_free(params); + g_assert(g_rmdir(tmp_path) =3D=3D 0); + g_free(tmp_path); +} + +static void test_acpi_piix4_acpi_erst(void) +{ + test_acpi_erst(MACHINE_PC); +} + +static void test_acpi_q35_acpi_erst(void) +{ + test_acpi_erst(MACHINE_Q35); +} + +static void test_acpi_microvm_acpi_erst(void) +{ + gchar *tmp_path =3D g_dir_make_tmp("qemu-test-erst.XXXXXX", NULL); + gchar *params; + test_data data; + + test_acpi_microvm_prepare(&data); + data.variant =3D ".pcie"; + data.tcg_only =3D true; /* need constant host-phys-bits */ + params =3D g_strdup_printf(" -machine microvm," + "acpi=3Don,ioapic2=3Doff,rtc=3Doff,pcie=3Don" + " -object memory-backend-file,id=3Derstnvram," + "mem-path=3D%s,size=3D0x10000,share=3Don" + " -device acpi-erst,memdev=3Derstnvram", tmp_path); + test_acpi_one(params, &data); + g_free(params); + g_assert(g_rmdir(tmp_path) =3D=3D 0); + g_free(tmp_path); + free_test_data(&data); +} + static void test_acpi_virt_tcg(void) { test_data data =3D { @@ -1672,6 +1723,8 @@ int main(int argc, char *argv[]) qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm); qtest_add_func("acpi/piix4/acpihmat", test_acpi_piix4_tcg_acpi_hma= t); qtest_add_func("acpi/q35/acpihmat", test_acpi_q35_tcg_acpi_hmat); + qtest_add_func("acpi/piix4/acpierst", test_acpi_piix4_acpi_erst); + qtest_add_func("acpi/q35/acpierst", test_acpi_q35_acpi_erst); qtest_add_func("acpi/microvm", test_acpi_microvm_tcg); qtest_add_func("acpi/microvm/usb", test_acpi_microvm_usb_tcg); qtest_add_func("acpi/microvm/rtc", test_acpi_microvm_rtc_tcg); @@ -1681,6 +1734,7 @@ int main(int argc, char *argv[]) qtest_add_func("acpi/q35/ivrs", test_acpi_q35_tcg_ivrs); if (strcmp(arch, "x86_64") =3D=3D 0) { qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie= _tcg); + qtest_add_func("acpi/microvm/acpierst", test_acpi_microvm_= acpi_erst); } } if (has_kvm) { --=20 MST From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 164414255934857.95215391555621; Sun, 6 Feb 2022 02:15:59 -0800 (PST) Received: from localhost ([::1]:51912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGeaM-00082A-6C for importer@patchew.org; Sun, 06 Feb 2022 05:15:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44876) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe0Y-0001Kn-DW for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:39:01 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26070) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe0U-0003kw-Jk for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:58 -0500 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-214-C9fiTI0NMvyrNMYp9dfGig-1; Sun, 06 Feb 2022 04:38:52 -0500 Received: by mail-wm1-f69.google.com with SMTP id m189-20020a1c26c6000000b003508ba87dfbso1369607wmm.7 for ; Sun, 06 Feb 2022 01:38:52 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id h9sm6113749wmq.8.2022.02.06.01.38.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:38:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140334; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=i4ThjWuKIu1CMrgXakalQlwzWxwSWoat70hXPufy2EA=; b=UjKxnRx/viVMt4dhN7iyFkBPCBeNtZnHSSHVm05lVDOX2aTPqpzfPXzfs2v1AyA7/ueogr Y8n+4JssAXkPVHT3pWL4dASDoIe6BIdCNeX4naBi0Avz0VeTJCzDYZPYzBMGnLl/vdMqi9 01ummFG7a0XoIrzsA5WYcmnhUVuIqRY= X-MC-Unique: C9fiTI0NMvyrNMYp9dfGig-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=i4ThjWuKIu1CMrgXakalQlwzWxwSWoat70hXPufy2EA=; b=QKNCKuE488I5i/6wC7C7DManuiS3qCP5/75dcObEoAMtWraC9A9YsZiguuxwUV6xq2 Y7tkPbnibnxzCUvRk9kjuUuGF6n9nWbT7Z4EKsf73F5q2qfvugDrhVU1wf8E/YlTbS8E DYqKG72VWm0ZfGpd3x6WTdJWqEPwKXglLXJH6LXZgXrMH3trHCN84mGHvPUYs5D2rl/M orxSMpeWpdH5QiLGPHQ/bS3U8TcUQhh2QMDSdDXBfTsLW1wFoIsC/OmJAPcIaKZF8mya o1OyDA9LBkqViJLfhheRIPOxGOUSDeq9Y5iUJFiMgGreNvQBbr9F89Q1rz2VRr/F8CP6 TIFw== X-Gm-Message-State: AOAM531UhvcueINU87ZCzfS3/5zoFmgcwAmAf9Oh6ZiTzn9txTaDCcVK ZjtR3uclIqgLcPlkcrDfOQFvy8IUGe73KHkG/ARbDR16qOxqWMtLJxChU/6cazErnuDhJFcWq5n Z6PbY4HWcj/3s7X+lnMgyYALLes6DfI9L5Uc9/T/SIQbOOf0Jb0n9ieMgdpwB X-Received: by 2002:a5d:684a:: with SMTP id o10mr5765263wrw.196.1644140330870; Sun, 06 Feb 2022 01:38:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJydgJYRAmdw6YkE2JXB7yI2LUN55dcW8tPXv0UHt98ijC5E000FfnKx/kvWWeq39lYiodbmDg== X-Received: by 2002:a5d:684a:: with SMTP id o10mr5765237wrw.196.1644140330350; Sun, 06 Feb 2022 01:38:50 -0800 (PST) Date: Sun, 6 Feb 2022 04:38:47 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 23/24] ACPI ERST: step 6 of bios-tables-test.c Message-ID: <20220206093702.1282676-24-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Eric DeVolder , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644142560223100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric DeVolder Following the guidelines in tests/qtest/bios-tables-test.c, this is step 6. Below is the disassembly of tests/data/acpi/pc/ERST.acpierst. /* * Intel ACPI Component Architecture * AML/ASL+ Disassembler version 20180508 (64-bit version) * Copyright (c) 2000 - 2018 Intel Corporation * * Disassembly of tests/data/acpi/pc/ERST.acpierst, Thu Dec 2 13:32:07 20= 21 * * ACPI Data Table [ERST] * * Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue */ [000h 0000 4] Signature : "ERST" [Error Record Ser= ialization Table] [004h 0004 4] Table Length : 00000390 [008h 0008 1] Revision : 01 [009h 0009 1] Checksum : D6 [00Ah 0010 6] Oem ID : "BOCHS " [010h 0016 8] Oem Table ID : "BXPC " [018h 0024 4] Oem Revision : 00000001 [01Ch 0028 4] Asl Compiler ID : "BXPC" [020h 0032 4] Asl Compiler Revision : 00000001 [024h 0036 4] Serialization Header Length : 00000030 [028h 0040 4] Reserved : 00000000 [02Ch 0044 4] Instruction Entry Count : 0000001B [030h 0048 1] Action : 00 [Begin Write Operation] [031h 0049 1] Instruction : 03 [Write Register Value] [032h 0050 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [033h 0051 1] Reserved : 00 [034h 0052 12] Register Region : [Generic Address Structure] [034h 0052 1] Space ID : 00 [SystemMemory] [035h 0053 1] Bit Width : 20 [036h 0054 1] Bit Offset : 00 [037h 0055 1] Encoded Access Width : 03 [DWord Access:32] [038h 0056 8] Address : 00000000FEBF3000 [040h 0064 8] Value : 0000000000000000 [048h 0072 8] Mask : 00000000000000FF [050h 0080 1] Action : 01 [Begin Read Operation] [051h 0081 1] Instruction : 03 [Write Register Value] [052h 0082 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [053h 0083 1] Reserved : 00 [054h 0084 12] Register Region : [Generic Address Structure] [054h 0084 1] Space ID : 00 [SystemMemory] [055h 0085 1] Bit Width : 20 [056h 0086 1] Bit Offset : 00 [057h 0087 1] Encoded Access Width : 03 [DWord Access:32] [058h 0088 8] Address : 00000000FEBF3000 [060h 0096 8] Value : 0000000000000001 [068h 0104 8] Mask : 00000000000000FF [070h 0112 1] Action : 02 [Begin Clear Operation] [071h 0113 1] Instruction : 03 [Write Register Value] [072h 0114 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [073h 0115 1] Reserved : 00 [074h 0116 12] Register Region : [Generic Address Structure] [074h 0116 1] Space ID : 00 [SystemMemory] [075h 0117 1] Bit Width : 20 [076h 0118 1] Bit Offset : 00 [077h 0119 1] Encoded Access Width : 03 [DWord Access:32] [078h 0120 8] Address : 00000000FEBF3000 [080h 0128 8] Value : 0000000000000002 [088h 0136 8] Mask : 00000000000000FF [090h 0144 1] Action : 03 [End Operation] [091h 0145 1] Instruction : 03 [Write Register Value] [092h 0146 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [093h 0147 1] Reserved : 00 [094h 0148 12] Register Region : [Generic Address Structure] [094h 0148 1] Space ID : 00 [SystemMemory] [095h 0149 1] Bit Width : 20 [096h 0150 1] Bit Offset : 00 [097h 0151 1] Encoded Access Width : 03 [DWord Access:32] [098h 0152 8] Address : 00000000FEBF3000 [0A0h 0160 8] Value : 0000000000000003 [0A8h 0168 8] Mask : 00000000000000FF [0B0h 0176 1] Action : 04 [Set Record Offset] [0B1h 0177 1] Instruction : 02 [Write Register] [0B2h 0178 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [0B3h 0179 1] Reserved : 00 [0B4h 0180 12] Register Region : [Generic Address Structure] [0B4h 0180 1] Space ID : 00 [SystemMemory] [0B5h 0181 1] Bit Width : 20 [0B6h 0182 1] Bit Offset : 00 [0B7h 0183 1] Encoded Access Width : 03 [DWord Access:32] [0B8h 0184 8] Address : 00000000FEBF3008 [0C0h 0192 8] Value : 0000000000000000 [0C8h 0200 8] Mask : 00000000FFFFFFFF [0D0h 0208 1] Action : 04 [Set Record Offset] [0D1h 0209 1] Instruction : 03 [Write Register Value] [0D2h 0210 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [0D3h 0211 1] Reserved : 00 [0D4h 0212 12] Register Region : [Generic Address Structure] [0D4h 0212 1] Space ID : 00 [SystemMemory] [0D5h 0213 1] Bit Width : 20 [0D6h 0214 1] Bit Offset : 00 [0D7h 0215 1] Encoded Access Width : 03 [DWord Access:32] [0D8h 0216 8] Address : 00000000FEBF3000 [0E0h 0224 8] Value : 0000000000000004 [0E8h 0232 8] Mask : 00000000000000FF [0F0h 0240 1] Action : 05 [Execute Operation] [0F1h 0241 1] Instruction : 03 [Write Register Value] [0F2h 0242 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [0F3h 0243 1] Reserved : 00 [0F4h 0244 12] Register Region : [Generic Address Structure] [0F4h 0244 1] Space ID : 00 [SystemMemory] [0F5h 0245 1] Bit Width : 20 [0F6h 0246 1] Bit Offset : 00 [0F7h 0247 1] Encoded Access Width : 03 [DWord Access:32] [0F8h 0248 8] Address : 00000000FEBF3008 [100h 0256 8] Value : 000000000000009C [108h 0264 8] Mask : 00000000000000FF [110h 0272 1] Action : 05 [Execute Operation] [111h 0273 1] Instruction : 03 [Write Register Value] [112h 0274 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [113h 0275 1] Reserved : 00 [114h 0276 12] Register Region : [Generic Address Structure] [114h 0276 1] Space ID : 00 [SystemMemory] [115h 0277 1] Bit Width : 20 [116h 0278 1] Bit Offset : 00 [117h 0279 1] Encoded Access Width : 03 [DWord Access:32] [118h 0280 8] Address : 00000000FEBF3000 [120h 0288 8] Value : 0000000000000005 [128h 0296 8] Mask : 00000000000000FF [130h 0304 1] Action : 06 [Check Busy Status] [131h 0305 1] Instruction : 03 [Write Register Value] [132h 0306 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [133h 0307 1] Reserved : 00 [134h 0308 12] Register Region : [Generic Address Structure] [134h 0308 1] Space ID : 00 [SystemMemory] [135h 0309 1] Bit Width : 20 [136h 0310 1] Bit Offset : 00 [137h 0311 1] Encoded Access Width : 03 [DWord Access:32] [138h 0312 8] Address : 00000000FEBF3000 [140h 0320 8] Value : 0000000000000006 [148h 0328 8] Mask : 00000000000000FF [150h 0336 1] Action : 06 [Check Busy Status] [151h 0337 1] Instruction : 01 [Read Register Value] [152h 0338 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [153h 0339 1] Reserved : 00 [154h 0340 12] Register Region : [Generic Address Structure] [154h 0340 1] Space ID : 00 [SystemMemory] [155h 0341 1] Bit Width : 20 [156h 0342 1] Bit Offset : 00 [157h 0343 1] Encoded Access Width : 03 [DWord Access:32] [158h 0344 8] Address : 00000000FEBF3008 [160h 0352 8] Value : 0000000000000001 [168h 0360 8] Mask : 00000000000000FF [170h 0368 1] Action : 07 [Get Command Status] [171h 0369 1] Instruction : 03 [Write Register Value] [172h 0370 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [173h 0371 1] Reserved : 00 [174h 0372 12] Register Region : [Generic Address Structure] [174h 0372 1] Space ID : 00 [SystemMemory] [175h 0373 1] Bit Width : 20 [176h 0374 1] Bit Offset : 00 [177h 0375 1] Encoded Access Width : 03 [DWord Access:32] [178h 0376 8] Address : 00000000FEBF3000 [180h 0384 8] Value : 0000000000000007 [188h 0392 8] Mask : 00000000000000FF [190h 0400 1] Action : 07 [Get Command Status] [191h 0401 1] Instruction : 00 [Read Register] [192h 0402 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [193h 0403 1] Reserved : 00 [194h 0404 12] Register Region : [Generic Address Structure] [194h 0404 1] Space ID : 00 [SystemMemory] [195h 0405 1] Bit Width : 20 [196h 0406 1] Bit Offset : 00 [197h 0407 1] Encoded Access Width : 03 [DWord Access:32] [198h 0408 8] Address : 00000000FEBF3008 [1A0h 0416 8] Value : 0000000000000000 [1A8h 0424 8] Mask : 00000000000000FF [1B0h 0432 1] Action : 08 [Get Record Identifier] [1B1h 0433 1] Instruction : 03 [Write Register Value] [1B2h 0434 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [1B3h 0435 1] Reserved : 00 [1B4h 0436 12] Register Region : [Generic Address Structure] [1B4h 0436 1] Space ID : 00 [SystemMemory] [1B5h 0437 1] Bit Width : 20 [1B6h 0438 1] Bit Offset : 00 [1B7h 0439 1] Encoded Access Width : 03 [DWord Access:32] [1B8h 0440 8] Address : 00000000FEBF3000 [1C0h 0448 8] Value : 0000000000000008 [1C8h 0456 8] Mask : 00000000000000FF [1D0h 0464 1] Action : 08 [Get Record Identifier] [1D1h 0465 1] Instruction : 00 [Read Register] [1D2h 0466 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [1D3h 0467 1] Reserved : 00 [1D4h 0468 12] Register Region : [Generic Address Structure] [1D4h 0468 1] Space ID : 00 [SystemMemory] [1D5h 0469 1] Bit Width : 40 [1D6h 0470 1] Bit Offset : 00 [1D7h 0471 1] Encoded Access Width : 04 [QWord Access:64] [1D8h 0472 8] Address : 00000000FEBF3008 [1E0h 0480 8] Value : 0000000000000000 [1E8h 0488 8] Mask : FFFFFFFFFFFFFFFF [1F0h 0496 1] Action : 09 [Set Record Identifier] [1F1h 0497 1] Instruction : 02 [Write Register] [1F2h 0498 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [1F3h 0499 1] Reserved : 00 [1F4h 0500 12] Register Region : [Generic Address Structure] [1F4h 0500 1] Space ID : 00 [SystemMemory] [1F5h 0501 1] Bit Width : 40 [1F6h 0502 1] Bit Offset : 00 [1F7h 0503 1] Encoded Access Width : 04 [QWord Access:64] [1F8h 0504 8] Address : 00000000FEBF3008 [200h 0512 8] Value : 0000000000000000 [208h 0520 8] Mask : FFFFFFFFFFFFFFFF [210h 0528 1] Action : 09 [Set Record Identifier] [211h 0529 1] Instruction : 03 [Write Register Value] [212h 0530 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [213h 0531 1] Reserved : 00 [214h 0532 12] Register Region : [Generic Address Structure] [214h 0532 1] Space ID : 00 [SystemMemory] [215h 0533 1] Bit Width : 20 [216h 0534 1] Bit Offset : 00 [217h 0535 1] Encoded Access Width : 03 [DWord Access:32] [218h 0536 8] Address : 00000000FEBF3000 [220h 0544 8] Value : 0000000000000009 [228h 0552 8] Mask : 00000000000000FF [230h 0560 1] Action : 0A [Get Record Count] [231h 0561 1] Instruction : 03 [Write Register Value] [232h 0562 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [233h 0563 1] Reserved : 00 [234h 0564 12] Register Region : [Generic Address Structure] [234h 0564 1] Space ID : 00 [SystemMemory] [235h 0565 1] Bit Width : 20 [236h 0566 1] Bit Offset : 00 [237h 0567 1] Encoded Access Width : 03 [DWord Access:32] [238h 0568 8] Address : 00000000FEBF3000 [240h 0576 8] Value : 000000000000000A [248h 0584 8] Mask : 00000000000000FF [250h 0592 1] Action : 0A [Get Record Count] [251h 0593 1] Instruction : 00 [Read Register] [252h 0594 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [253h 0595 1] Reserved : 00 [254h 0596 12] Register Region : [Generic Address Structure] [254h 0596 1] Space ID : 00 [SystemMemory] [255h 0597 1] Bit Width : 20 [256h 0598 1] Bit Offset : 00 [257h 0599 1] Encoded Access Width : 03 [DWord Access:32] [258h 0600 8] Address : 00000000FEBF3008 [260h 0608 8] Value : 0000000000000000 [268h 0616 8] Mask : 00000000FFFFFFFF [270h 0624 1] Action : 0B [Begin Dummy Write] [271h 0625 1] Instruction : 03 [Write Register Value] [272h 0626 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [273h 0627 1] Reserved : 00 [274h 0628 12] Register Region : [Generic Address Structure] [274h 0628 1] Space ID : 00 [SystemMemory] [275h 0629 1] Bit Width : 20 [276h 0630 1] Bit Offset : 00 [277h 0631 1] Encoded Access Width : 03 [DWord Access:32] [278h 0632 8] Address : 00000000FEBF3000 [280h 0640 8] Value : 000000000000000B [288h 0648 8] Mask : 00000000000000FF [290h 0656 1] Action : 0D [Get Error Address Range] [291h 0657 1] Instruction : 03 [Write Register Value] [292h 0658 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [293h 0659 1] Reserved : 00 [294h 0660 12] Register Region : [Generic Address Structure] [294h 0660 1] Space ID : 00 [SystemMemory] [295h 0661 1] Bit Width : 20 [296h 0662 1] Bit Offset : 00 [297h 0663 1] Encoded Access Width : 03 [DWord Access:32] [298h 0664 8] Address : 00000000FEBF3000 [2A0h 0672 8] Value : 000000000000000D [2A8h 0680 8] Mask : 00000000000000FF [2B0h 0688 1] Action : 0D [Get Error Address Range] [2B1h 0689 1] Instruction : 00 [Read Register] [2B2h 0690 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [2B3h 0691 1] Reserved : 00 [2B4h 0692 12] Register Region : [Generic Address Structure] [2B4h 0692 1] Space ID : 00 [SystemMemory] [2B5h 0693 1] Bit Width : 40 [2B6h 0694 1] Bit Offset : 00 [2B7h 0695 1] Encoded Access Width : 04 [QWord Access:64] [2B8h 0696 8] Address : 00000000FEBF3008 [2C0h 0704 8] Value : 0000000000000000 [2C8h 0712 8] Mask : FFFFFFFFFFFFFFFF [2D0h 0720 1] Action : 0E [Get Error Address Lengt= h] [2D1h 0721 1] Instruction : 03 [Write Register Value] [2D2h 0722 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [2D3h 0723 1] Reserved : 00 [2D4h 0724 12] Register Region : [Generic Address Structure] [2D4h 0724 1] Space ID : 00 [SystemMemory] [2D5h 0725 1] Bit Width : 20 [2D6h 0726 1] Bit Offset : 00 [2D7h 0727 1] Encoded Access Width : 03 [DWord Access:32] [2D8h 0728 8] Address : 00000000FEBF3000 [2E0h 0736 8] Value : 000000000000000E [2E8h 0744 8] Mask : 00000000000000FF [2F0h 0752 1] Action : 0E [Get Error Address Lengt= h] [2F1h 0753 1] Instruction : 00 [Read Register] [2F2h 0754 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [2F3h 0755 1] Reserved : 00 [2F4h 0756 12] Register Region : [Generic Address Structure] [2F4h 0756 1] Space ID : 00 [SystemMemory] [2F5h 0757 1] Bit Width : 40 [2F6h 0758 1] Bit Offset : 00 [2F7h 0759 1] Encoded Access Width : 04 [QWord Access:64] [2F8h 0760 8] Address : 00000000FEBF3008 [300h 0768 8] Value : 0000000000000000 [308h 0776 8] Mask : 00000000FFFFFFFF [310h 0784 1] Action : 0F [Get Error Attributes] [311h 0785 1] Instruction : 03 [Write Register Value] [312h 0786 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [313h 0787 1] Reserved : 00 [314h 0788 12] Register Region : [Generic Address Structure] [314h 0788 1] Space ID : 00 [SystemMemory] [315h 0789 1] Bit Width : 20 [316h 0790 1] Bit Offset : 00 [317h 0791 1] Encoded Access Width : 03 [DWord Access:32] [318h 0792 8] Address : 00000000FEBF3000 [320h 0800 8] Value : 000000000000000F [328h 0808 8] Mask : 00000000000000FF [330h 0816 1] Action : 0F [Get Error Attributes] [331h 0817 1] Instruction : 00 [Read Register] [332h 0818 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [333h 0819 1] Reserved : 00 [334h 0820 12] Register Region : [Generic Address Structure] [334h 0820 1] Space ID : 00 [SystemMemory] [335h 0821 1] Bit Width : 20 [336h 0822 1] Bit Offset : 00 [337h 0823 1] Encoded Access Width : 03 [DWord Access:32] [338h 0824 8] Address : 00000000FEBF3008 [340h 0832 8] Value : 0000000000000000 [348h 0840 8] Mask : 00000000FFFFFFFF [350h 0848 1] Action : 10 [Execute Timings] [351h 0849 1] Instruction : 03 [Write Register Value] [352h 0850 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [353h 0851 1] Reserved : 00 [354h 0852 12] Register Region : [Generic Address Structure] [354h 0852 1] Space ID : 00 [SystemMemory] [355h 0853 1] Bit Width : 20 [356h 0854 1] Bit Offset : 00 [357h 0855 1] Encoded Access Width : 03 [DWord Access:32] [358h 0856 8] Address : 00000000FEBF3000 [360h 0864 8] Value : 0000000000000010 [368h 0872 8] Mask : 00000000000000FF [370h 0880 1] Action : 10 [Execute Timings] [371h 0881 1] Instruction : 00 [Read Register] [372h 0882 1] Flags (decoded below) : 00 Preserve Register Bits : 0 [373h 0883 1] Reserved : 00 [374h 0884 12] Register Region : [Generic Address Structure] [374h 0884 1] Space ID : 00 [SystemMemory] [375h 0885 1] Bit Width : 40 [376h 0886 1] Bit Offset : 00 [377h 0887 1] Encoded Access Width : 04 [QWord Access:64] [378h 0888 8] Address : 00000000FEBF3008 [380h 0896 8] Value : 0000000000000000 [388h 0904 8] Mask : FFFFFFFFFFFFFFFF Raw Table Data: Length 912 (0x390) Note that the contents of tests/data/q35/ERST.acpierst and tests/data/microvm/ERST.pcie are the same except for differences due to assigned base address. Files tests/data/pc/DSDT.acpierst and tests/data/acpi/q35/DSDT.acpierst are new files (and are included as a result of 'make check' process). Rather than provide the entire content, I am providing the differences between pc/DSDT and pc/DSDT.acpierst, and the difference between q35/DSDT and q35/DSDT.acpierst, with an explanation to follow. diff pc/DSDT pc/DSDT.acpierst: @@ -5,13 +5,13 @@ * * Disassembling to symbolic ASL+ operators * - * Disassembly of tests/data/acpi/pc/DSDT, Thu Dec 2 10:10:13 2021 + * Disassembly of tests/data/acpi/pc/DSDT.acpierst, Thu Dec 2 12:59:36 2= 021 * * Original Table Header: * Signature "DSDT" - * Length 0x00001772 (6002) + * Length 0x00001751 (5969) * Revision 0x01 **** 32-bit table (V1), no 64-bit math suppo= rt - * Checksum 0x9E + * Checksum 0x95 * OEM ID "BOCHS " * OEM Table ID "BXPC " * OEM Revision 0x00000001 (1) @@ -964,16 +964,11 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS " Device (S18) { - Name (_SUN, 0x03) // _SUN: Slot User Number Name (_ADR, 0x00030000) // _ADR: Address - Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device - { - PCEJ (BSEL, _SUN) - } - + Name (ASUN, 0x03) Method (_DSM, 4, Serialized) // _DSM: Device-Specific Me= thod { - Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN)) + Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, ASUN)) } } @@ -1399,11 +1394,6 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS " Method (DVNT, 2, NotSerialized) { - If ((Arg0 & 0x08)) - { - Notify (S18, Arg1) - } - If ((Arg0 & 0x10)) { Notify (S20, Arg1) diff q35/DSDT and q35/DSDT.acpierst: @@ -5,13 +5,13 @@ * * Disassembling to symbolic ASL+ operators * - * Disassembly of tests/data/acpi/q35/DSDT, Thu Dec 2 10:10:13 2021 + * Disassembly of tests/data/acpi/q35/DSDT.acpierst, Thu Dec 2 12:59:36 = 2021 * * Original Table Header: * Signature "DSDT" - * Length 0x00002061 (8289) + * Length 0x00002072 (8306) * Revision 0x01 **** 32-bit table (V1), no 64-bit math suppo= rt - * Checksum 0xFA + * Checksum 0x9A * OEM ID "BOCHS " * OEM Table ID "BXPC " * OEM Revision 0x00000001 (1) @@ -3278,6 +3278,11 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS " } } + Device (S10) + { + Name (_ADR, 0x00020000) // _ADR: Address + } + Method (PCNT, 0, NotSerialized) { } For both pc and q35, there is but a small difference between this DSDT.acpierst and the corresponding DSDT. In both cases, the changes occur under the hiearchy: Scope (\_SB) { Scope (PCI0) { which leads me to believe that the change to the DSDT was needed due to the introduction of the ERST PCI device. And is explained in detail by Ani Sinha: I have convinced myself of the changes we see in the DSDT tables. On i440fx side, we are adding a non-hotpluggable pci device on slot 3. So the changes we see are basically replacing an empty hotpluggable slot on the pci root port with a non-hotplugggable device. On q35, bsel on pcie root bus is not set (its not hotpluggable bus), so the change basically adds the address enumeration for the device. Signed-off-by: Eric DeVolder Acked-by: Ani Sinha Message-Id: <1643402289-22216-11-git-send-email-eric.devolder@oracle.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 5 ----- tests/data/acpi/microvm/ERST.pcie | Bin 0 -> 912 bytes tests/data/acpi/pc/DSDT.acpierst | Bin 0 -> 5969 bytes tests/data/acpi/pc/ERST.acpierst | Bin 0 -> 912 bytes tests/data/acpi/q35/DSDT.acpierst | Bin 0 -> 8306 bytes tests/data/acpi/q35/ERST.acpierst | Bin 0 -> 912 bytes 6 files changed, 5 deletions(-) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index 603db07711..dfb8523c8b 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1,6 +1 @@ /* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/pc/DSDT.acpierst", -"tests/data/acpi/pc/ERST.acpierst", -"tests/data/acpi/q35/DSDT.acpierst", -"tests/data/acpi/q35/ERST.acpierst", -"tests/data/acpi/microvm/ERST.pcie", diff --git a/tests/data/acpi/microvm/ERST.pcie b/tests/data/acpi/microvm/ER= ST.pcie index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..a6d0cb783831ebc18972ec57bb6= c624438ff150d 100644 GIT binary patch literal 912 zcmaKoTMmLS5Jd;doACJehb6cK12OSWBYwCn7ocm^-rA|;CUz1YmosPDa=3Dfm$hY?9$ z^LaU~(|o@yldVKV@Q&x+UZ@>zwpS)GZ(sO?Lc}v64j-jFC7yn9;D$INO8pFiUB7f+ zf49KN&wPvW+;jDxe>nP4Iq`z#7tC?s&HniOCHcA!tc6i7Z+t&KoWCN!@(t>{e2`4% zZhiFB_p5lnFb*Ui&1&BGpsO$pT3_)pk?J?$-jLiezjJ$6`=3Dr)uYry0Rn7KuJIp&j)|! zckaizM=3D~sYzU*-I~PkUtAn>Dr`~u=3D;o(_O$t$PK8~R}U#&P6`{0u*{ zz`m8fl|Wu#ucTKJu-TjNQ`rN~%rBccG0yWwF_}_zQl+X71|-_g)Pr`x1*Xgb!&xdP4yUPQ>QealcAR5Lj8F@vR~&d_hFrfVBOumUtb3< zL8GI#8|W0leXv|!GGL=3D~vE5*uM7z%Af!czNXYqlQL#IT$!9xR0zORu68XY#=3DM-SGy z3b+$tZv(*Hu4BBt4F>MUo>Padde^ZZU%V_4TiQ&t&6ruaomTLcp<9-2bBZ=3Dqyp40+ ziEQ&$6L)c>%cI)0;%&VWL5E5@F~Or>jX}g)!VlmH>3A6L#ZGj;i8(jvxl3w$XL%gc z#4Y0Q*ces>sy7Obm6bTnr@oqih!n=3DP&+!w*&jZjVy;9R95=3D2i+)QqA9kLa1VJk2ES zOh6C4;>puBt75SyO`ippr%I9Z{pk6j=3D(st4aP-WP=3Dov412KgP0p3z1}&)7R9%3U9d z&O-shXOD!>df~G};j<@%&-TL`!{M=3DJ{^0EAj)b4{!p{wbpF1J^oV~LmWA@f?c-apx zmJl5aIOP$4%5j~Id6TV0{V^u0sG`|bSAOB2V2gb1@Ki7>g+T~D<}I$cZmy;lKl#kP zxAm*k{f|HWWb1z8<4?h6y1Bg6FLiOw7Z@DC0gGYf$3^AUwgVosAOD1e9Hex!P-c3u zY%#r3y2G$SrRg@$K+^S+fmJX`o|0}AmQ(0%hN|GcJ*{Ry{RpZVR_9(>4G!#sMm9K*-Kb2oqvI?7dL24<1WVww+F6k zrAwi@3blP`ov2|RQA!4yn|HMt+&l|rp;ky|p}*s4Bhi{tS7b7IwWYtO z($_%y0DUt+12O0t{g&d0!qm$i(>FX+UGsM;osE9mca!r!@5Ld6Jt2$-nabyyC?4*zT@l2 z4LgzF3U^-%E&8T*RhMxH{B|{Nmd$hyhrlm@q(4&m{QfcO=3DjBztZw|gWU^0Q+lFdc4 z;t%ATAUG5ws_1bncmXfi8SEC{UBmF!TrD{!GvtiVS87Q`#ts;JTa>Png~+QvKOAg( z=3Dl%H)^?9Gb?Lui47fY7Bv8_MKSPiRTs@3YkU)Q{@YvnKAT;;J8U>fgQ>9qeF0+gJ! zS_V9pumOy9sSU)%^lS1X17&Pw`o1`MA>W^ePI^H@E*S%`|HOx^c$lLHVkhwcpCba771jDZ#SdZmhM`3K=3Dq{% zNdudV5*`|Tn?lmSM!~R<_iYsI+Q3HPu(0YhlR~GImZVAKI~h z+O@D02|KpVC?DEYlCeYxd&-j!?Kerrtt;#;Pd>DJ8RM1`cI=3DOKE&Yg{vc{!8uv6Z~ u5j$m$OK@OMk$l8{6J=3DZ)1AB{Pv}@<7F~|QN>AydkHSF$IS^vS{(*FTuhT2R3 literal 0 HcmV?d00001 diff --git a/tests/data/acpi/pc/ERST.acpierst b/tests/data/acpi/pc/ERST.acp= ierst index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..7965ac2562e7b23bf1dc2caaf00= ef66453c4f47a 100644 GIT binary patch literal 912 zcmaKoOAdlC6h$9Upg{N}4xO+BmS7+z&NSk{Ww`+N;?C6GO0l^KeF>#Er>E`f@jBlg ziAb~?&(mq{$NOdKO+_MtIsSwBP(BS` zh6Ua)#A*M6_AiN-%#j24ugI^+uZh>pkpuT{$ZyEEIpDYCx8&O#=3D&vKcBj4u0`Con^ B!2tjO literal 0 HcmV?d00001 diff --git a/tests/data/acpi/q35/DSDT.acpierst b/tests/data/acpi/q35/DSDT.a= cpierst index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..cad26e3f0c27a40a33101155a52= 82ed9bcb1d441 100644 GIT binary patch literal 8306 zcmb7JOKcm*8J^`!tL0K!Qk3OaY{E(UN|8`@UTx8!W+{ zr+@MJrMD_~fBw&3-hS0e0dO9FP5iwO(II>Q|7$G zoVF=3Dc*370~>q(Ucw2`X*UeoWjna$X}Z?i1bzv)oC^kS{!mHe(ZC>5U_1icE2s3nZ3 zY5U#Ka>9}Q$uMNYFgqR}u+hRN!)^AvZJYi3f9V5uU@eNi<*kJe=3DczCEzGW%K(3|f) zNxh-*?(d&$1(g9GVw69NuK2C)X2J?B+gV$DDk*`4>hC|jR`mcD_b7?pqgS%bacj9@ zge+u+(J-#EtN42^folEz$J!fPhpfdVjb&Qtb2LKz{qyU7Z&l__iTiD6SjWmWjJK0- zCr$I*9?yK<-Dn?j(m-Q0XK?N(?n{28O7Ue=3DtUS zz8mz6>|NV3acd}WF?L%e9K2G0FQ{F_Ecm-^;l^btaI59oMO>(M+Fc`iPtYiEtDUWO z$!~ctmHI|?-CbkF$9=3DbUG0}gNqVYJ|B}DX&ag9-q{`aZ*fEAypfHMn4xgt7*F*YoE z8Q%-q3#0XTYTSG7AO8uSdAI$^%Gd1^e{CtL5V)tERpa9(Exo7$}ef`$x|2%4;rOQ9c_Ndgx~!~$?ZT;n`I zWk^iq=3Dhy^i0vkufl+Xm@Oh7pkAu-V#j!kl=3D>_L(dQ$mx12`FbGB&Mu_c_pwsPl_`o zG$oj_^9WU)X-#LEGbJ=3DFn6mQ-Rh=3D14XNEH+G^6W8sOp^4bk1oy=3DX9M2Rh_1$)6{gD zx=3Dw_uPP~DXk)GFd&g(i6syZ!Ar=3D{t%be#xQomow1R@0f)bs|)C;$5iRPg~Pz>pBst zI&+%NoTf9U>qMyPT+nnbXgU{kod{K(i<-_wP3NMn6QQcp(R4bRPDj^?P}P~&bmldk zd0i($RcArdSiBQ#f zOw)Nx(|JtSiBQ#vF9|$-@;$Vo>0HruB2;xA*K{7&bRO4rB2;yr;LJ+=3DCOpBJ)%az1 zLNMJ2Au+ueds1Vb)R-rACPI~YN@JeVn5T3mLX~-1W1iNSr*$SmmHCLqd_-eDqB9Yy z%rl%RUFHmD%6I%3!IUp2Z%2?G^a&V+#~P%=3D;f zu&LjgxD0RX>1(q{mpbC@>R6seC3>2Z%2?G^a&V+#~P%=3D;f=3D3{*fllMEE0)CmI> zSk8ojDo`>|0p(0GP=3Drz^3{+q_69%e4$v_2^Gs!>^N}VuJf#pmXr~)Me6;RG314Srx z!axOM_lrzad z5lWpfP=3DV!47^ngz0~JutBm+e#b;3XemNQ|X3X}{~Ksl2P6rt1!0~J`#gn=3DqhGEf2K zOfpb}QYQ>lU^x>8szAv=3D1(Y+%KoLrvFi=3DE_fg(~36rpOM2o(cWm@rUrJ|DqSSTCWL;la|0sTXICqsWK z{hL31DoOvP(y9incNl(mvjWH6tkS`ygJ&|Vy=3D>O#yiSJ(9hzowskMpKfYJPW*4{1_ zS>_L{Z1L&VrrVtdpj*x_SlN#=3DY@V+Ky~A!(o0Z0~6}`7>EiyVoC%RaAS)aocbd=3Dl=3D)@cw3a6JzzFxX9Om4yX(0O{JJ0c&&iFPv_PiZ&{@E zC&pkx>rc%Di%Qq*=3DH;*XaMEMlG$|lP@qP%>0;IjhLU98{gZN&_q^7upZI!-q^ zjjg<%4&NG6=3D|tPibW`)Ppr^wJ$W%JfHZ$GSJi`(&%`+(sUnNuNMBB`CQ}d>%r^Bbp zR65Z%Gu_lYSk}|w`(-MfXq%aC>bX9qr^83hR65Z%Gu_m4x}vAUm(El=3D(Wa+!PCZ!9 z-d_ybRcy6jTg6Ud&EMI0LF`U6t;-Kq{QYh%kWZXv#f^kmHm}%*jUwvC(+XRSGHyMZ~lOS3M;vOtz)>YPGGp* z_KOAptfED+^h6TSZi)|T4uzk5l{Vv%UlmSBs!U^xPGf# zUM*8M#Kuv&n0I^imlGpvxXV6t%jNR5Vl#u)`^tR((aTSz}YjKG}?75er8r zhm#jbLS!vs*?sED`r1KQY^O=3Dq!xb_nQz665{Kfh)H*h=3DV5i(4-Q@d11j3c%a8CSpX z3d5^L#I8n07_sdy*6rU8L*ug@G=3D6ym-#}Cs3&$W3#Pd8>jyVA>NEt6rjfxbhF3)nR6Wl0R%y>`8L3X`Yd*9Nunc^1!j znn?6aIU6au#3z0{r^?T=3D;!l8GWi$|nJAz`zN@?)j4)3XkaN5gart(c8zE^rNYyIU` zjwP@}fZv!7*fG3s-?t4D?FQaS_wL6`E~j%9*^m>n0^VSZNHk> z#`=3D@E!v3gTxr=3D?-Z^f0nFWi0tTefjF(MF?1dtewi?ME?fQo1P&j@YHn(=3D;}&UM$mYa7S0P5HyiC?8xH z6f!9TeaHFJgMyi|5*8Nm5IsXzNQv{a2e+ZW|787=3DD||1vS!-|MF*;9ZZ04#xcG6Co z-r~+i`ZC|zYozHe_V=3D?vxh(dKF(f|<%Fl}ccg$cg<6zZe*tEpSd3kbyPWmvO)tCru Lf)z9L%&`9h*%QBN literal 0 HcmV?d00001 diff --git a/tests/data/acpi/q35/ERST.acpierst b/tests/data/acpi/q35/ERST.a= cpierst index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..7965ac2562e7b23bf1dc2caaf00= ef66453c4f47a 100644 GIT binary patch literal 912 zcmaKoOAdlC6h$9Upg{N}4xO+BmS7+z&NSk{Ww`+N;?C6GO0l^KeF>#Er>E`f@jBlg ziAb~?&(mq{$NOdKO+_MtIsSwBP(BS` zh6Ua)#A*M6_AiN-%#j24ugI^+uZh>pkpuT{$ZyEEIpDYCx8&O#=3D&vKcBj4u0`Con^ B!2tjO literal 0 HcmV?d00001 --=20 MST From nobody Mon Feb 9 21:57:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644142200895986.7470803055; Sun, 6 Feb 2022 02:10:00 -0800 (PST) Received: from localhost ([::1]:44912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGeUZ-00038m-9e for importer@patchew.org; Sun, 06 Feb 2022 05:09:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44882) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe0Y-0001Ko-QO for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:39:01 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:37084) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGe0W-0003lB-L6 for qemu-devel@nongnu.org; Sun, 06 Feb 2022 04:38:58 -0500 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-137-tcXegQXVOUmkDXc6t1W_WQ-1; Sun, 06 Feb 2022 04:38:54 -0500 Received: by mail-wm1-f70.google.com with SMTP id s187-20020a1ca9c4000000b0037bb8547d64so1532472wme.0 for ; Sun, 06 Feb 2022 01:38:54 -0800 (PST) Received: from redhat.com ([2.52.12.81]) by smtp.gmail.com with ESMTPSA id f2sm7139503wri.49.2022.02.06.01.38.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:38:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644140336; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oz2e6MHHl60kdDpnLZXoNoUL3IzInDDXRSJJeB+BbMA=; b=RmjdHNQqvgsbKShwcMp7vDZdLWEST4iQryz7rAgZJG+rncn9Oq9f6lAfqkgMUVm++g0gj2 bJ19T/+lqG46AshEZPQTFS7q7qQLeikqImW5XkTrMj0CQ1ADanuavyeNQYKL9tA3Y39kbp e/TPxN/RToyGJHRaXYM00oC9k46K/rs= X-MC-Unique: tcXegQXVOUmkDXc6t1W_WQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=oz2e6MHHl60kdDpnLZXoNoUL3IzInDDXRSJJeB+BbMA=; b=QHapZOASRCESN/444EsK3aB5oyYA3JXLq36eR3gyTT/lsNBAsSqIXvPQ4AIV91yu8t ZInoWFP8gAj8NP7CGuFUAwN3CADXPmr6TYLhHyMm1OdYEJxbG1DUJCjztqzG/v9uTQzz XqpWPtTQqPoBGHF8kXR/bLVBxIF5QXXlYoeUHOJCzOqcP+sUNBxy0RDWgppTw+S5/H1Q uPB8G7fG0qiT1wluVRAAjUgCwRKJiIieGfvkDCI2E9EIa4j6Jej2Cx2X+LnApJfDNyTs +Cp4qquW/m2bZIU6hN8t9q/bDFsOZ9h402MH4XXxWcWWC6sLxTw35iIps7bxhWdMUX2g SbMw== X-Gm-Message-State: AOAM530xHH+kwSPG/LkpgAZzzlWu9+jEgiCz64saOJ0rpYrD2ZgadqcK 2BxY+Y2iYAjv8x77k4VE9XtrbJ12jC/+iMNRJ1s8d4IQ4xeoaTIZLcLvbWs4cNtTWIHZoJQsqMQ itsGl+bWCsOqlxNYLtR97veVLOkLsJU57ZL9TqCkbRL+2wp8uMacbLXJ75LfE X-Received: by 2002:adf:fa48:: with SMTP id y8mr5736173wrr.646.1644140333420; Sun, 06 Feb 2022 01:38:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJyWwXj6znhXQ27Qo0lAni5unMj8fL0ddJqeSfvI5gXpmFvbPaD3entidbihTAto7cTUx5X/TA== X-Received: by 2002:adf:fa48:: with SMTP id y8mr5736152wrr.646.1644140333186; Sun, 06 Feb 2022 01:38:53 -0800 (PST) Date: Sun, 6 Feb 2022 04:38:50 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 24/24] util/oslib-posix: Fix missing unlock in the error path of os_mem_prealloc() Message-ID: <20220206093702.1282676-25-mst@redhat.com> References: <20220206093702.1282676-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220206093702.1282676-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Daniel P =?utf-8?B?LiBCZXJyYW5nw6k=?= , David Hildenbrand , Michal Privoznik , Pankaj Gupta , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1644142201708100001 From: David Hildenbrand We're missing an unlock in case installing the signal handler failed. Fortunately, we barely see this error in real life. Fixes: a960d6642d39 ("util/oslib-posix: Support concurrent os_mem_prealloc(= ) invocation") Fixes: CID 1468941 Cc: Paolo Bonzini Cc: Michael S. Tsirkin Cc: Pankaj Gupta Cc: Daniel P. Berrang=C3=A9 Cc: Michal Privoznik Signed-off-by: David Hildenbrand Message-Id: <20220111120830.119912-1-david@redhat.com> Reviewed-by: Pankaj Gupta Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- util/oslib-posix.c | 1 + 1 file changed, 1 insertion(+) diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 9efdc74bba..ac0dbc2adc 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -683,6 +683,7 @@ void os_mem_prealloc(int fd, char *area, size_t memory,= int smp_cpus, =20 ret =3D sigaction(SIGBUS, &act, &sigbus_oldact); if (ret) { + qemu_mutex_unlock(&sigbus_mutex); error_setg_errno(errp, errno, "os_mem_prealloc: failed to install signal handler"); return; --=20 MST