From patchwork Wed Dec 15 00:00:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676983 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D9286C433F5 for ; Wed, 15 Dec 2021 00:23:11 +0000 (UTC) Received: from localhost ([::1]:43588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxI4c-0006dd-PO for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:23:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHq0-00069O-0u; Tue, 14 Dec 2021 19:08:04 -0500 Received: from mail-dm6nam10on2040.outbound.protection.outlook.com ([40.107.93.40]:7265 helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHpx-0005FT-Il; Tue, 14 Dec 2021 19:08:03 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aqvRnpanrBnSjL2YKMhw5xbsJGxla/dMnFriNrx2kmWsSvs8ZL2jbtSBHHzAlRfPW1SYWfm2quw6kfs+zwnrQr1iqRkzOlys1bSk+WQJWBdp6A3Tv5RT3Ar4AO7wND42fHQMeXROeOhy967xxRcVMvan4+hEN94/iDgnNKz825TiyfruPXTpxUE7U3n+oWB+GgC6ILr8SHtprrYKZ7X8dNggnm2K8pZgAfkxiNtTu09+xNRNjiW/wihtyiuzBcpPbPMgxjstvwSZbTTyd+Hb15IV7khMTgk6lpcMy1X/ifd3ektDD+qIx7tb4peHWDAnMjEIP2buWZMCeGTBzFjfvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dBdIrPU++znlMD7ePPkTf3CkVjRiooY1A6nDg1iL/YA=; b=ZONgAk2TAkuw3kIVBwZZR83iCabfPzi1ASYYsqX8vsV+DeWHK52304XUI3FBMG1ADAW8RcarrfTdfqVpLkJBuWV2yqybl7rGxUeVSfCeQ75qoO05bb/sj1j6lXw6iCgDdA4grj7QRuLNsOwh8/tEZkWmd8q9DIdA7zFeckfyqdIzXccsBrIvsFmeYAn/C2X4aEXzuP57nLi2Hyz2tS9Om1n/0ghIZm+XUrX5ef69OVH4PiFpFphCvlbDt//nH7t5CK579A6TO0SZnHGLYFCrIdRomu1FcsMB4aQDSX1JaU3qjGKLj0AZ7wa+MPbx/LVX4d/tk9v4gVzVmIjmkF1Xxw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dBdIrPU++znlMD7ePPkTf3CkVjRiooY1A6nDg1iL/YA=; b=ILixcw+6jHE3kMxOyrPdFueC//949f0nhb5zH8jiszLMBeBpglxnSfgsRmhwvB7Dh36gsOtI1M5xLPPGb7UGdbLNDYTPQ4ydwUV1gAF5I1nQm2gxjnHUauqxmeUg9xSIk3+PCMsnTxsnu/tq5/i0UTcw2k88IvnDM8TLwNJjzXE= Received: from MWHPR15CA0027.namprd15.prod.outlook.com (2603:10b6:300:ad::13) by BN9PR12MB5033.namprd12.prod.outlook.com (2603:10b6:408:132::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 00:07:57 +0000 Received: from CO1NAM11FT015.eop-nam11.prod.protection.outlook.com (2603:10b6:300:ad:cafe::5a) by MWHPR15CA0027.outlook.office365.com (2603:10b6:300:ad::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16 via Frontend Transport; Wed, 15 Dec 2021 00:07:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT015.mail.protection.outlook.com (10.13.175.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:07:57 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:07:56 -0600 From: Michael Roth To: CC: , David Hildenbrand , Wei Wang , "Michael S . Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alexander Duyck , Juan Quintela , "Dr. David Alan Gilbert" , Peter Xu Subject: [PATCH 01/47] virtio-balloon: don't start free page hinting if postcopy is possible Date: Tue, 14 Dec 2021 18:00:39 -0600 Message-ID: <20211215000125.378126-2-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 41af900c-cded-441d-41a3-08d9bf5ef2e3 X-MS-TrafficTypeDiagnostic: BN9PR12MB5033:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: p2P/LVW//onbLajwnRA3AAD2JGuNxXRD5P7yoLMSDnuA3KqG7Y/5F4zUfGRow2M+LSPz+zfcFk9ddvSjflSepnYuhPpItrCRq1CrJuiCxnuA/uIiwl7oUR0zEyjAugzm/W2bAxLKozkc8k0s8dkKetzj0uFwzGm/STrxek3gdCvhcSPYd9aymfajt8+PSyI2NwFzxe+FMC6LsWwGcItShKqD7hTveOElJ4Nk8XLBthSf2Y/dVFxHYhlgPVM6eK6nF1Z/I7ERmbh9zZQ/pz4A1zTRxqQh48X+62tC1yd249CB5c1uy9DQ2N+jZRlsIuNgo4isgXkToRITOuGjzQcld7t6TzD3qYeYr6mV8AgYuqTONQQhyEljM2OSE0uppJTGpAUl/oRl7DvesBJIV9JqdlLVbtvMAQIswe/WU4PW4tcUTPiGwKxjtNanmHADKcqJaeZCfFUsSUELJNwZatrA0wXSlc2ogcWxwy8HGhqz6U9YcALTN50oM+BQN0zTOdTKYl3xCUADGwTKoDw/PSrNRzllJAUbOE9kz2cBrU82fCoHjiX9UVYcZDOqRmTr4o+HSs81yegvnaRk2xhx6Ff2rDlkLNXwoAa2pLo/604HuEVW76swAxOd1/yuqZ7nbUR9YinOxIfHCyS5I6GktiMO4Ob0TnQ3wP1f+MTZQ/pXL2I2wGFaDOEq8MyJvkTlWzMS+2DpHA23NJ5VoOrjkpW8BlPrnGJUz97OzpdJzJvHaUXMHydGW1GALhBQ5Q0oUtiYSLb6WhLtLZ5zpk6O2FJGtttRg0a25Zz6AyFYKd6+UqBg2xrTEW6tSoYJUlnDhhWTbxWTbfqTkkgdkkMAa8ESt2CQT/8gaq4ejPHw/51esw8BTgfBy7Qd5DYgoqs5zgER X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(1076003)(83380400001)(6666004)(44832011)(2616005)(26005)(81166007)(508600001)(47076005)(4326008)(82310400004)(316002)(7416002)(356005)(8936002)(86362001)(40460700001)(54906003)(5660300002)(336012)(426003)(2906002)(36860700001)(186003)(8676002)(6916009)(36756003)(16526019)(70206006)(70586007)(966005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:07:57.0844 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 41af900c-cded-441d-41a3-08d9bf5ef2e3 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT015.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5033 Received-SPF: softfail client-ip=40.107.93.40; envelope-from=Michael.Roth@amd.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: David Hildenbrand Postcopy never worked properly with 'free-page-hint=on', as there are at least two issues: 1) With postcopy, the guest will never receive a VIRTIO_BALLOON_CMD_ID_DONE and consequently won't release free pages back to the OS once migration finishes. The issue is that for postcopy, we won't do a final bitmap sync while the guest is stopped on the source and virtio_balloon_free_page_hint_notify() will only call virtio_balloon_free_page_done() on the source during PRECOPY_NOTIFY_CLEANUP, after the VM state was already migrated to the destination. 2) Once the VM touches a page on the destination that has been excluded from migration on the source via qemu_guest_free_page_hint() while postcopy is active, that thread will stall until postcopy finishes and all threads are woken up. (with older Linux kernels that won't retry faults when woken up via userfaultfd, we might actually get a SEGFAULT) The issue is that the source will refuse to migrate any pages that are not marked as dirty in the dirty bmap -- for example, because the page might just have been sent. Consequently, the faulting thread will stall, waiting for the page to be migrated -- which could take quite a while and result in guest OS issues. While we could fix 1) comparatively easily, 2) is harder to get right and might require more involved RAM migration changes on source and destination [1]. As it never worked properly, let's not start free page hinting in the precopy notifier if the postcopy migration capability was enabled to fix it easily. Capabilities cannot be enabled once migration is already running. Note 1: in the future we might either adjust migration code on the source to track pages that have actually been sent or adjust migration code on source and destination to eventually send pages multiple times from the source and and deal with pages that are sent multiple times on the destination. Note 2: virtio-mem has similar issues, however, access to "unplugged" memory by the guest is very rare and we would have to be very lucky for it to happen during migration. The spec states "The driver SHOULD NOT read from unplugged memory blocks ..." and "The driver MUST NOT write to unplugged memory blocks". virtio-mem will move away from virtio_balloon_free_page_done() soon and handle this case explicitly on the destination. [1] https://lkml.kernel.org/r/e79fd18c-aa62-c1d8-c7f3-ba3fc2c25fc8@redhat.com Fixes: c13c4153f76d ("virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT") Cc: qemu-stable@nongnu.org Cc: Wei Wang Cc: Michael S. Tsirkin Cc: Philippe Mathieu-Daudé Cc: Alexander Duyck Cc: Juan Quintela Cc: "Dr. David Alan Gilbert" Cc: Peter Xu Signed-off-by: David Hildenbrand Message-Id: <20210708095339.20274-2-david@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Peter Xu (cherry picked from commit fd51e54fa10221e5a8add894c38cc1cf199f4bc4) Signed-off-by: Michael Roth --- hw/virtio/virtio-balloon.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 4b5d9e5e50..ae7867a8db 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -30,6 +30,7 @@ #include "trace.h" #include "qemu/error-report.h" #include "migration/misc.h" +#include "migration/migration.h" #include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-access.h" @@ -662,6 +663,18 @@ virtio_balloon_free_page_hint_notify(NotifierWithReturn *n, void *data) return 0; } + /* + * Pages hinted via qemu_guest_free_page_hint() are cleared from the dirty + * bitmap and will not get migrated, especially also not when the postcopy + * destination starts using them and requests migration from the source; the + * faulting thread will stall until postcopy migration finishes and + * all threads are woken up. Let's not start free page hinting if postcopy + * is possible. + */ + if (migrate_postcopy_ram()) { + return 0; + } + switch (pnd->reason) { case PRECOPY_NOTIFY_BEFORE_BITMAP_SYNC: virtio_balloon_free_page_stop(dev); From patchwork Wed Dec 15 00:00:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676967 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 193B4C433F5 for ; Wed, 15 Dec 2021 00:16:25 +0000 (UTC) Received: from localhost ([::1]:51074 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxHy4-0000tN-5U for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:16:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52844) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHtq-000395-OD; Tue, 14 Dec 2021 19:12:03 -0500 Received: from mail-dm6nam10on2061.outbound.protection.outlook.com ([40.107.93.61]:61153 helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHte-0005i3-0j; Tue, 14 Dec 2021 19:11:53 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fSoiORBf0XD+IRocSuA/VPnEAyIkrYBpZ25rAFbGKEwQax26j/aPOW3EhKD3k+uNtXXDvPH8ixLQjRU5/VRX9ONRcswMGw7Lm30dI1gAWilpE8/UmgwxA16LG5d22zzgh/Z+3jgquhvELoWjHwB3IxidQhuBZbiu/1WhbmM7luShANuepNf0nj5qAn1q0htVaJiJViBZg2n8SSUIOH8M0VOe7k1hlROk7RG7jt2MZnnJxAiMYzNZrXdWW7fT9UrBYjoWwokpVGlTFIpoS8BW4C24t/zD4fSlV8D4Tn53LoEGIJknLn8c9mJxxuGRFIXuwKsY90+swCadT8MnZEPJaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AIRt+PwgHDbKgW3JNOi1QbDB0ammZyIzpTgBNA71FDc=; b=BD2YgVYnzYrtgNKPEG/RXGXiJG7NkuxcXeS0Ymi717tnOkoVQINxASbnnGiuDLzTv0l+ccH6oWt1Nq3goDJT1ARfRwlEijsS7BqRlF9CgP8eoxhVCPASmdTSX0a1l2ZWKhKLQKANyCbk5LrpT8dEizS/H3j5Bb+O3z6xivCAcJHywnnoK3Kdw7HqO9pSz3+aj5rpzp31OIZ1Fwra2VBRDU/Hg1xh8Xa1jXvD82Yjt5iuLhD1UyibXWqL55rgJoFkp65SiN6SAKvmare5mEXwDW1++WlRlwSMSQYbqQ9qNsXdM4ExO3/qYM8S3qnr6GdzmuMBBY7RSeIxjoOZ4ATo/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AIRt+PwgHDbKgW3JNOi1QbDB0ammZyIzpTgBNA71FDc=; b=BTLSN+xEb5yRyFMnHjBBW1UiKkNsxQ6mx/kUMBs/aOn6kehwwS05Yxm5XWlpfJwsj9FA53BcJs+hqYqpbSvOvbNaw4QTsEmtFROnlxfFNpLh0UZA1rcxL/hFsxgPbp7xo2LKfpbKboC6mTCyMTTijPDEoghEBmR5dU3oon2NHHU= Received: from DM5PR11CA0023.namprd11.prod.outlook.com (2603:10b6:3:115::33) by CH2PR12MB4907.namprd12.prod.outlook.com (2603:10b6:610:68::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 00:11:46 +0000 Received: from DM6NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:3:115:cafe::84) by DM5PR11CA0023.outlook.office365.com (2603:10b6:3:115::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.15 via Frontend Transport; Wed, 15 Dec 2021 00:11:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT044.mail.protection.outlook.com (10.13.173.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:11:46 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:11:45 -0600 From: Michael Roth To: CC: , Peter Maydell , Richard Henderson Subject: [PATCH 02/47] target/arm: Don't skip M-profile reset entirely in user mode Date: Tue, 14 Dec 2021 18:00:40 -0600 Message-ID: <20211215000125.378126-3-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2d0d4feb-5dbf-4fd2-a68e-08d9bf5f7b95 X-MS-TrafficTypeDiagnostic: CH2PR12MB4907:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4fV7Gzvei8Ij+wlSIrvWWj269OYC0u4A90tOaOJz3PEic+m3CpmzkNtdkc0Z3YHJ603a0jXA7YYuBWtTehoa83NfVt5nfJ5EOIHD3uP4BTpDjN1v2MvroVdbrfyqXH1kND8iCnkLPlJVOH4zU0WGzV5Hontb+f3wTS3j95vfirk/1CMEdDZEcQKWHjGThF7BOK0eDDz/Cg7503HsF2ZHvf6SL2GLW54DUkYQRe8qqmIXTW/BROwyO7Ev/WmFnXYWGCDx/faFe4vLoi0vAB/RfJ7PTUdfzClvd9Ul6st14bMVxi+gNjkG1ANppYSHrrOyvcrHXBWpM0Cs2LBcOitiVaH/e0YkhmpNbm5+4j6VXAaZUN0qRjAA2UZwiFk/p9Bt3dQDSlUGJlVmjw62xGTareM4dEHILXA6d/L1vByS+ZOY0jsL50vHmGFK9dMDPyz4mJ1Am/q51qBdjXOS/TpQyB2Zmq4swdj7WAtcyZyu22waOlvxgYJf5TUt+Y1uotXbhXJFGZOy2zHu3xyKf/v5s6M77KmC7GzAcfnRZmE8u9+jj24G9S7yApqyxRUMqenF0pUXQH6qCoxx6gIPEJ2ziGzN7qVwNrd6gUHA0a32pc8FdR1q9Be/Lwuzac+GvApyDHGI9wA8EGgza10iomXwSwbe7eAB8d/Y7PNtDk9GgA1VuRHolq/yI2EuS5E8aYH9oGklyRPsek6ldK6KCtY6s6+JMxhHocclfh0G0b8tV/+/Y0l9Na7zd3jwg5vXdfPhciEe9UNE9BvKu6t2zfM48TkM9IXvguG94NEcrEpJchWhcGHEEYhM86EjV3KNFyR+Vn1+p/Ap7sAuvoT4gWH7K4zE8LVyGdWJJoEBByujk0if1yb0Y6NwwZoDkIhg40vK X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(316002)(36860700001)(86362001)(426003)(8676002)(6916009)(5660300002)(1076003)(186003)(83380400001)(2906002)(508600001)(966005)(81166007)(44832011)(26005)(6666004)(36756003)(356005)(336012)(70206006)(2616005)(4326008)(47076005)(82310400004)(16526019)(8936002)(54906003)(70586007)(40460700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:11:46.4975 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2d0d4feb-5dbf-4fd2-a68e-08d9bf5f7b95 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4907 Received-SPF: softfail client-ip=40.107.93.61; envelope-from=Michael.Roth@amd.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Currently all of the M-profile specific code in arm_cpu_reset() is inside a !defined(CONFIG_USER_ONLY) ifdef block. This is unintentional: it happened because originally the only M-profile-specific handling was the setup of the initial SP and PC from the vector table, which is system-emulation only. But then we added a lot of other M-profile setup to the same "if (ARM_FEATURE_M)" code block without noticing that it was all inside a not-user-mode ifdef. This has generally been harmless, but with the addition of v8.1M low-overhead-loop support we ran into a problem: the reset of FPSCR.LTPSIZE to 4 was only being done for system emulation mode, so if a user-mode guest tried to execute the LE instruction it would incorrectly take a UsageFault. Adjust the ifdefs so only the really system-emulation specific parts are covered. Because this means we now run some reset code that sets up initial values in the FPCCR and similar FPU related registers, explicitly set up the registers controlling FPU context handling in user-emulation mode so that the FPU works by design and not by chance. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/613 Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20210914120725.24992-2-peter.maydell@linaro.org (cherry picked from commit b62ceeaf8096fdbbbfdc6087da0028bc4a4dd77e) Signed-off-by: Michael Roth --- target/arm/cpu.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 2866dd7658..af60c07ca1 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -265,12 +265,15 @@ static void arm_cpu_reset(DeviceState *dev) env->uncached_cpsr = ARM_CPU_MODE_SVC; } env->daif = PSTATE_D | PSTATE_A | PSTATE_I | PSTATE_F; +#endif if (arm_feature(env, ARM_FEATURE_M)) { +#ifndef CONFIG_USER_ONLY uint32_t initial_msp; /* Loaded from 0x0 */ uint32_t initial_pc; /* Loaded from 0x4 */ uint8_t *rom; uint32_t vecbase; +#endif if (cpu_isar_feature(aa32_lob, cpu)) { /* @@ -324,6 +327,8 @@ static void arm_cpu_reset(DeviceState *dev) env->v7m.fpccr[M_REG_S] = R_V7M_FPCCR_ASPEN_MASK | R_V7M_FPCCR_LSPEN_MASK | R_V7M_FPCCR_S_MASK; } + +#ifndef CONFIG_USER_ONLY /* Unlike A/R profile, M profile defines the reset LR value */ env->regs[14] = 0xffffffff; @@ -352,8 +357,22 @@ static void arm_cpu_reset(DeviceState *dev) env->regs[13] = initial_msp & 0xFFFFFFFC; env->regs[15] = initial_pc & ~1; env->thumb = initial_pc & 1; +#else + /* + * For user mode we run non-secure and with access to the FPU. + * The FPU context is active (ie does not need further setup) + * and is owned by non-secure. + */ + env->v7m.secure = false; + env->v7m.nsacr = 0xcff; + env->v7m.cpacr[M_REG_NS] = 0xf0ffff; + env->v7m.fpccr[M_REG_S] &= + ~(R_V7M_FPCCR_LSPEN_MASK | R_V7M_FPCCR_S_MASK); + env->v7m.control[M_REG_S] |= R_V7M_CONTROL_FPCA_MASK; +#endif } +#ifndef CONFIG_USER_ONLY /* AArch32 has a hard highvec setting of 0xFFFF0000. If we are currently * executing as AArch32 then check if highvecs are enabled and * adjust the PC accordingly. From patchwork Wed Dec 15 00:00:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677027 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5BF1FC433F5 for ; Wed, 15 Dec 2021 00:34:45 +0000 (UTC) Received: from localhost ([::1]:50714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxIFo-0005EN-Gk for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:34:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53458) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHxM-0001gl-JA; Tue, 14 Dec 2021 19:15:40 -0500 Received: from mail-dm6nam10on2072.outbound.protection.outlook.com ([40.107.93.72]:26849 helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHxK-00067X-8a; Tue, 14 Dec 2021 19:15:40 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EKAzgEt97n6VC1uvgTeol93AMP3nn3wUPyw7GedH+H70Du+vq5Det9mIYbm7IjO105PyssIclCxr1w4rqpMdEIIVjqVV73iTSv80hjKBKUcCwtXBeLjPM/mUwyGNu4iLveTH9bBBAIyACWmIqOb21HO1xOleX5eP/MFd+rQvX1n+4RzkE1EjjcHjI6Ij7+PZVOgXGM4eIq7Ig/q9fXM+Lws/SGFRjvj3wYZoqM2y7RujXtZLoRZuAvl3w16NUj3wWMoMuQN0eHaNaKTjNPM867eBVOvMNqp+e1oE1ayZX05PUWyGDj7+A25PTt4W+wYcdY1QaSsIq1Z04CE3MTEXpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rJoBArt8iGc6Gzons6W77Ci+eHA9M1YfP6txE2pVuEI=; b=kVH1CML8cWGdyHOiygRxjF0UmAGmbcpY7epBcKhjv8H/bC35Rc230/iwZW3uxgVSA2fxUbKSBqGVJkV6h9uVOCvisUruf7i7SAVZWpuQTjcpTU3Q5YsUttcL4bjcMMGePE6UNcjVgwQuU1kAZHx9z4KlXmTxNzY0DkgSMtulefoELVcSvzMtU2NyhlnOo2xsp2U1ODV81yacGBH1tGKD6oavrD277AN2H7hJJVKlbAZUvZ6JqD3wJIx0Q7aZdmga0qnzDTAZ/+vzq7gGID60fV3PTvkwbzchyfmlY8+29CHDa1hLtGKk8Rzv7HLTgOZGnIp/HrHsXWHqFhC2n5tLpg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rJoBArt8iGc6Gzons6W77Ci+eHA9M1YfP6txE2pVuEI=; b=bBP+Tkwj6Y/qaModtgUaBNVcHIoWendGpt2f1Szt/9e+SfK3vlWeCmTN8g+p/CrMduhlU3YAqLIlr0TH+uSwrnLM1Ms6dgL6LmTgFVkFr5P76XKfxprJ3Q2DCdMuLRXFFOTl/9pAhK/Ekw29VQwlpL54WaQcRnldceHvtDDKL94= Received: from DM6PR02CA0074.namprd02.prod.outlook.com (2603:10b6:5:1f4::15) by BY5PR12MB4099.namprd12.prod.outlook.com (2603:10b6:a03:20f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16; Wed, 15 Dec 2021 00:15:35 +0000 Received: from DM6NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1f4:cafe::2d) by DM6PR02CA0074.outlook.office365.com (2603:10b6:5:1f4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:15:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT016.mail.protection.outlook.com (10.13.173.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:15:35 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:15:35 -0600 From: Michael Roth To: CC: , Jason Wang , Alexander Bulekov Subject: [PATCH 03/47] virtio-net: fix use after unmap/free for sg Date: Tue, 14 Dec 2021 18:00:41 -0600 Message-ID: <20211215000125.378126-4-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ab7e8852-4157-4bf1-1dc3-08d9bf600427 X-MS-TrafficTypeDiagnostic: BY5PR12MB4099:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:792; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BgpPTmY0lC1EkoDZNa5Swleb+15Eqph5xdrlDCVtnF9OPSnsbmCetkWhzmfMFASQ4cGgeKXd0/mj8/MUhRxJCCT3Zggf7WvcX30K0rTF+Sef3huMalC7JHwtEhfbuA3+4O4AS86PpBmNmFPAcdwrGETawb29zqpXY2Dmh2wfxx3SGMi0RVj5xUUNeun8SQwFEmdZdNAds2JBukgvay+9g111LC9dJQEplcgUK20aWOxukATKXOIEBt8YOsfzEMrw/ghxxLBys8rSwvk8w5l0zUezV4xDBgk9M54GgPxFFi3qh/kuiUQxoDZiNYDcgeW+LRifdyjyf0gqzurjoNyPaNpsnsnig8uGNa5WC0k3nk6etECJPaL0XcNP/O4wofz547NxEn9CzwZ0CZBQOb6DGadBeBn0tyvZmdpFQQMeuQ8VKLJwlYbKfKrXK/Idusu56RjVbO1iyJhesvChOvWjqhykxNns2xze4hHueSlhpnXHlG3qfQRRW5x/0Trfqzpl9gZ+przV4MMZcfQQNSSeKkytOm3j6Lb1sQGbVgrXztw3Gp+Oi6bXoGvGGdb1R9jW01eVzEt1PhhQSn6DKqxTJNDKIBLVKLiVOmfeTHXBvetE+VpHCaVvVKJCI9tKCN0QaXJsDeQhaR7ND0DbKrmh0OU4xCLKI2qAb1lDkbpM1FG1/zy3FrVp5m46wO8yUAgjTk/5S9jvnGEAf+0xWgbHsxt+TijXyTYewL/Z33qySo/08ZyqPVol1K3bJymp7gka6oDmIKSpm/CSIx11o2qE11k4GjK2trzFUgUtV61VGbQ= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700001)(1076003)(70586007)(83380400001)(6666004)(40460700001)(36860700001)(82310400004)(356005)(5660300002)(70206006)(2906002)(81166007)(508600001)(26005)(426003)(8676002)(8936002)(316002)(186003)(4326008)(36756003)(336012)(86362001)(16526019)(54906003)(44832011)(47076005)(2616005)(6916009)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:15:35.6280 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ab7e8852-4157-4bf1-1dc3-08d9bf600427 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4099 Received-SPF: softfail client-ip=40.107.93.72; envelope-from=Michael.Roth@amd.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jason Wang When mergeable buffer is enabled, we try to set the num_buffers after the virtqueue elem has been unmapped. This will lead several issues, E.g a use after free when the descriptor has an address which belongs to the non direct access region. In this case we use bounce buffer that is allocated during address_space_map() and freed during address_space_unmap(). Fixing this by storing the elems temporarily in an array and delay the unmap after we set the the num_buffers. This addresses CVE-2021-3748. Reported-by: Alexander Bulekov Fixes: fbe78f4f55c6 ("virtio-net support") Cc: qemu-stable@nongnu.org Signed-off-by: Jason Wang (cherry picked from commit bedd7e93d01961fcb16a97ae45d93acf357e11f6) Signed-off-by: Michael Roth --- hw/net/virtio-net.c | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 16d20cdee5..f205331dcf 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1746,10 +1746,13 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf, VirtIONet *n = qemu_get_nic_opaque(nc); VirtIONetQueue *q = virtio_net_get_subqueue(nc); VirtIODevice *vdev = VIRTIO_DEVICE(n); + VirtQueueElement *elems[VIRTQUEUE_MAX_SIZE]; + size_t lens[VIRTQUEUE_MAX_SIZE]; struct iovec mhdr_sg[VIRTQUEUE_MAX_SIZE]; struct virtio_net_hdr_mrg_rxbuf mhdr; unsigned mhdr_cnt = 0; - size_t offset, i, guest_offset; + size_t offset, i, guest_offset, j; + ssize_t err; if (!virtio_net_can_receive(nc)) { return -1; @@ -1780,6 +1783,12 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf, total = 0; + if (i == VIRTQUEUE_MAX_SIZE) { + virtio_error(vdev, "virtio-net unexpected long buffer chain"); + err = size; + goto err; + } + elem = virtqueue_pop(q->rx_vq, sizeof(VirtQueueElement)); if (!elem) { if (i) { @@ -1791,7 +1800,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf, n->guest_hdr_len, n->host_hdr_len, vdev->guest_features); } - return -1; + err = -1; + goto err; } if (elem->in_num < 1) { @@ -1799,7 +1809,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf, "virtio-net receive queue contains no in buffers"); virtqueue_detach_element(q->rx_vq, elem, 0); g_free(elem); - return -1; + err = -1; + goto err; } sg = elem->in_sg; @@ -1836,12 +1847,13 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf, if (!n->mergeable_rx_bufs && offset < size) { virtqueue_unpop(q->rx_vq, elem, total); g_free(elem); - return size; + err = size; + goto err; } - /* signal other side */ - virtqueue_fill(q->rx_vq, elem, total, i++); - g_free(elem); + elems[i] = elem; + lens[i] = total; + i++; } if (mhdr_cnt) { @@ -1851,10 +1863,23 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf, &mhdr.num_buffers, sizeof mhdr.num_buffers); } + for (j = 0; j < i; j++) { + /* signal other side */ + virtqueue_fill(q->rx_vq, elems[j], lens[j], j); + g_free(elems[j]); + } + virtqueue_flush(q->rx_vq, i); virtio_notify(vdev, q->rx_vq); return size; + +err: + for (j = 0; j < i; j++) { + g_free(elems[j]); + } + + return err; } static ssize_t virtio_net_do_receive(NetClientState *nc, const uint8_t *buf, From patchwork Wed Dec 15 00:00:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677071 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B057AC433EF for ; Wed, 15 Dec 2021 00:56:46 +0000 (UTC) Received: from localhost ([::1]:33372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxIb7-0006kA-GL for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:56:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53984) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxI04-0006jM-6I; Tue, 14 Dec 2021 19:18:28 -0500 Received: from mail-dm6nam10on2086.outbound.protection.outlook.com ([40.107.93.86]:10112 helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxI01-0006W8-EW; Tue, 14 Dec 2021 19:18:27 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WYUnZZFwFGp051vZAWQhaTFi82qRvLSuWzFTy+F0jvX4Pw0zQEZANC1+kjdpdqh9dRh/jPMCpGR4nRc5Z3e3A8SfOK6kb6G4LU+60gMfsse0aGTp11qVZLqv5SKmLINF0UhVnK+qa4PTHPo05SX5gXvfxiUU0DEnuPXQ4hTcE+04M6ryRz9Bg/dlFjaEd5xguNqpdKEQA5BvBzyV+jzGKZEFEAWHr+HGhedv2JxOzRXMvJE+VLc4yryHlROJ5UlroUpsqwR496WAtbxCW9U4iOXWcfJ/gkl7zv5aH+gahWlxzkQ0Qq6pju/ymLNHm/KpOJDfja4bbKP14v9bifn3pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=b7t+ouPu5WYI+gHy9SAAMmKg863mI9sae+/3yPLcA3M=; b=cBlzJUeTLioUefWMlVF9Sp1lTv1HR4ykabAKnITbkLzfGUC8d9cMko5b+23dCn18RBOnhOnUCJRWz6eJdONtAaXyC7JMiKi3XI+Oli04yRy6y29lhQ/4BO999rQmfJio/dYu9K4HNmVyLKBJsUnuz8bG5TeI3SINEbTYhdK1f1ny4wiOJtCt3gAaKyjvZE36Z5vMTdFlvpHA2wbKdbXoaJ0+nVuhQkDUcmn2bW+HACGdpCi3Eo43ikVFd+8r1miAVH71lvrC5ScWm6AlCko1jFACCyHtsHYdqauY/2autJQepy9+TnAs5eQwL8rDeCKhhp6zk6QUJnS6TDBppc6mpQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=b7t+ouPu5WYI+gHy9SAAMmKg863mI9sae+/3yPLcA3M=; b=IaEPCDB2ruHnAds1nCno3Uzy/q3XxFQ+yrH2p8562xJ0ggxDk3xrKi4/RHs0APw1VPi8OfD1XgcdzmKNbLVuuXwps0xd8FYhgFrfYjEUBP5a/xcA+YcxNtQy8Su9qnV8GiH42eXdbsUinVXVrsMJrtBFbnWvA7a1djvqlAVDFyo= Received: from BN6PR14CA0002.namprd14.prod.outlook.com (2603:10b6:404:79::12) by MN2PR12MB4061.namprd12.prod.outlook.com (2603:10b6:208:19a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.14; Wed, 15 Dec 2021 00:18:22 +0000 Received: from BN8NAM11FT043.eop-nam11.prod.protection.outlook.com (2603:10b6:404:79:cafe::13) by BN6PR14CA0002.outlook.office365.com (2603:10b6:404:79::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17 via Frontend Transport; Wed, 15 Dec 2021 00:18:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT043.mail.protection.outlook.com (10.13.177.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:18:22 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:18:22 -0600 From: Michael Roth To: CC: , Nir Soffer , Nir Soffer , Eric Blake Subject: [PATCH 04/47] qemu-nbd: Change default cache mode to writeback Date: Tue, 14 Dec 2021 18:00:42 -0600 Message-ID: <20211215000125.378126-5-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2d28f6ac-de0b-47c1-4875-08d9bf6067b6 X-MS-TrafficTypeDiagnostic: MN2PR12MB4061:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:473; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZNo57rfdUpmzsXr8++tpYBiMyjlbVziTzKjmJXjneBx1/GAl5mh60LvdNlf3oZq5V0x26HrBefRINZMtRnKTMGwIuelCmTlw4sbhSXxmYwqxjfty4NVVoXdVFsSoepD8Ym5nIIrF69TDA++UJ2+iZwHX7eFS5wcSBGXcpn2dZuI7zEuzZXNWi2GVlTTgeroTPoEYRxdQcPtBQN36/PYwCrpM7PmajZvPhq7afAh3guXKBo5RIAIqlSpIrtv8Cie/t4iQP8f0NZKS3dMhUUs7QLc1n1W/Dvr9SHUu2TwD4fag/Wj3ksTlsKGwjNgZX00LvDHG0O+XcVwJbrB9rwag0H+aKbkakodylsNcJVnB1fiAnhY2eZStLcblazxjg2nIgUb6Kc2M2iaQqve8rSNdo6WUvPivQwwyqPnBnOkkpYht3/L8g/sJ6IEdrXjb0SoWZlbosZbWyVJ8DibLomwCf1kCLIbTArdAE7UnIb2P/aQI8W4hjs/9D1kai931yvVtp3xFFQIxSfaw9g4YIHlG34K/G6GGDnjrPFHxHiO5cgCrtaU6Q+/ZfuoZYRAcqV+DbNS42vMbDGnyf50r3TtGcDngTdHwr25x9QF6Wc1w6xAd4rETngOHpvWWUMinjI3qWRbJRakS61eu6Bk9XiEpdFHURBGrVM0kCHI5tn4weO4L0vSViLHNIEHuNVEbeZwHHTXdzVi7lMdQcFJkt33jdfheqy4s38c8Wg1XQq68z3nQPbu96zWmI/Bo94Giew77eTOsrsjmvVkP67L00eXKyJTK4Gc4qvVO5KR9csmNU1/M+jSz0ZVmi52IA1+fmgJbMlj3jVKhE4U+mtzErhuzayNIVsCH6nBLOppRmy6JQpEBiuyACdvULPwz9HAbFF2sNCaNfy4d3XHJe4dzAJx+PMEAGVWK1UrR3UHhuPt/tT4= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700001)(26005)(81166007)(4326008)(2616005)(6916009)(186003)(6666004)(82310400004)(8676002)(47076005)(316002)(356005)(16526019)(83380400001)(966005)(2906002)(336012)(40460700001)(1076003)(36860700001)(36756003)(70206006)(70586007)(8936002)(5660300002)(508600001)(426003)(86362001)(44832011)(54906003)(33290500001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:18:22.7088 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2d28f6ac-de0b-47c1-4875-08d9bf6067b6 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT043.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4061 Received-SPF: softfail client-ip=40.107.93.86; envelope-from=Michael.Roth@amd.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Nir Soffer Both qemu and qemu-img use writeback cache mode by default, which is already documented in qemu(1). qemu-nbd uses writethrough cache mode by default, and the default cache mode is not documented. According to the qemu-nbd(8): --cache=CACHE The cache mode to be used with the file. See the documentation of the emulator's -drive cache=... option for allowed values. qemu(1) says: The default mode is cache=writeback. So users have no reason to assume that qemu-nbd is using writethough cache mode. The only hint is the painfully slow writing when using the defaults. Looking in git history, it seems that qemu used writethrough in the past to support broken guests that did not flush data properly, or could not flush due to limitations in qemu. But qemu-nbd clients can use NBD_CMD_FLUSH to flush data, so using writethrough does not help anyone. Change the default cache mode to writback, and document the default and available values properly in the online help and manual. With this change converting image via qemu-nbd is 3.5 times faster. $ qemu-img create dst.img 50g $ qemu-nbd -t -f raw -k /tmp/nbd.sock dst.img Before this change: $ hyperfine -r3 "./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock" Benchmark #1: ./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock Time (mean ± σ): 83.639 s ± 5.970 s [User: 2.733 s, System: 6.112 s] Range (min … max): 76.749 s … 87.245 s 3 runs After this change: $ hyperfine -r3 "./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock" Benchmark #1: ./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock Time (mean ± σ): 23.522 s ± 0.433 s [User: 2.083 s, System: 5.475 s] Range (min … max): 23.234 s … 24.019 s 3 runs Users can avoid the issue by using --cache=writeback[1] but the defaults should give good performance for the common use case. [1] https://bugzilla.redhat.com/1990656 Signed-off-by: Nir Soffer Message-Id: <20210813205519.50518-1-nsoffer@redhat.com> Reviewed-by: Eric Blake CC: qemu-stable@nongnu.org Signed-off-by: Eric Blake (cherry picked from commit 09615257058a0ae87b837bb041f56f7312d9ead8) Signed-off-by: Michael Roth --- docs/tools/qemu-nbd.rst | 6 ++++-- qemu-nbd.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/tools/qemu-nbd.rst b/docs/tools/qemu-nbd.rst index ee862fa0bc..5643da26e9 100644 --- a/docs/tools/qemu-nbd.rst +++ b/docs/tools/qemu-nbd.rst @@ -98,8 +98,10 @@ driver options if ``--image-opts`` is specified. .. option:: --cache=CACHE - The cache mode to be used with the file. See the documentation of - the emulator's ``-drive cache=...`` option for allowed values. + The cache mode to be used with the file. Valid values are: + ``none``, ``writeback`` (the default), ``writethrough``, + ``directsync`` and ``unsafe``. See the documentation of + the emulator's ``-drive cache=...`` option for more info. .. option:: -n, --nocache diff --git a/qemu-nbd.c b/qemu-nbd.c index 26ffbf15af..6c18fcd19a 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -135,7 +135,9 @@ static void usage(const char *name) " 'snapshot.id=[ID],snapshot.name=[NAME]', or\n" " '[ID_OR_NAME]'\n" " -n, --nocache disable host cache\n" -" --cache=MODE set cache mode (none, writeback, ...)\n" +" --cache=MODE set cache mode used to access the disk image, the\n" +" valid options are: 'none', 'writeback' (default),\n" +" 'writethrough', 'directsync' and 'unsafe'\n" " --aio=MODE set AIO mode (native, io_uring or threads)\n" " --discard=MODE set discard mode (ignore, unmap)\n" " --detect-zeroes=MODE set detect-zeroes mode (off, on, unmap)\n" @@ -552,7 +554,7 @@ int main(int argc, char **argv) bool alloc_depth = false; const char *tlscredsid = NULL; bool imageOpts = false; - bool writethrough = true; + bool writethrough = false; /* Client will flush as needed. */ bool fork_process = false; bool list = false; int old_stderr = -1; From patchwork Wed Dec 15 00:00:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677107 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8A33EC433EF for ; Wed, 15 Dec 2021 00:58:58 +0000 (UTC) Received: from localhost ([::1]:39636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxIdF-0002s0-Fb for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:58:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54046) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxI0O-00085R-AM; Tue, 14 Dec 2021 19:18:48 -0500 Received: from mail-bn1nam07on2061.outbound.protection.outlook.com ([40.107.212.61]:9802 helo=NAM02-BN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxI0M-0006YS-9g; Tue, 14 Dec 2021 19:18:48 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AOhvQbADPjW4ia6l7oE1JBJZUTvAi3DimTjoiEGhDeoTEWpMSwIoWjHNo0YQeU0SCK3qJA/OBfvpKBdsk4iq/AB4/gY2x1ND2z5cwEIA+rx8YIJF7G6/yd10Qpz2QwSgW79f4xqTY3HA3YcE275v4CPCOYbaXLoxGY1BvaK69fQq3HHPfAU/FZB1yCYSFJaHNzwG8hBluyQpgrERiZ8xfEA+QTIOrfd84v1uMzoDAg/SfalVBZt/A58UCFZc2xG29JWFrR6YoISTxT/ym+wuITUUmk579MkdoY5Md3n6gHq3Q6/J6fPOTlJ9U9dNU/N76/lk9V0iMxtST705EvICOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aQ9R7X59sx+ZY/u/jmvHecM0kPcOognPD5Jpkuq/kh0=; b=mDktxiQn7O/+0MOej8yhwwXcOkUTk7jY3IdMWcqerhVE81TEh1oKzuJbTlyCYxPwLNMhmg7a/CxPxPfboY/zDFd2fmnbiYdfvTFVXjVmb7CVfChs5jPXxIpZ2wkC4wu4Fy92sZXmpKt9VQk0CZ114URWT74jpDl3EsZO0UmEuBjHk4XdFq5AcQmSMdGnGersN0T1FSR1+cxUzGsG9CBO7GjOvdpOXKyxiED7Kh7kB6M7wGtfZXk+2LyqfJ08dOcUTErVTyUnOJXeDCQuJZGOgPqjPVwv+5nKZiaiRoY8OnFV3uQVWzejLXxyYudg0frzyhRVKek1MAN3/LyuELxCSQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aQ9R7X59sx+ZY/u/jmvHecM0kPcOognPD5Jpkuq/kh0=; b=4fDrrVJHSKbf9CqhNksJFmGZl4Xp/fzqdVqjkPEWcQSG3lKmOPjSpuN0wUBntI1oP45fCDjR7hINtjL4blY+dW1RYZei+TP79KKk9wkYNt81fS7csmEBGvtCpK4CZ1jZOK/QY1N2WHXg1y0JSt8PtqGAV7jKhr4IJ+vrE99GUW4= Received: from BN0PR04CA0104.namprd04.prod.outlook.com (2603:10b6:408:ec::19) by PH0PR12MB5481.namprd12.prod.outlook.com (2603:10b6:510:d4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.12; Wed, 15 Dec 2021 00:18:43 +0000 Received: from BN8NAM11FT031.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ec:cafe::7d) by BN0PR04CA0104.outlook.office365.com (2603:10b6:408:ec::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14 via Frontend Transport; Wed, 15 Dec 2021 00:18:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT031.mail.protection.outlook.com (10.13.177.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:18:43 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:18:43 -0600 From: Michael Roth To: CC: , Markus Armbruster , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Gerd Hoffmann , Laurent Vivier Subject: [PATCH 05/47] hmp: Unbreak "change vnc" Date: Tue, 14 Dec 2021 18:00:43 -0600 Message-ID: <20211215000125.378126-6-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0d7b040b-b64d-488e-4d05-08d9bf60742c X-MS-TrafficTypeDiagnostic: PH0PR12MB5481:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2512; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cJeETZ+UKJhdsN6+9yuL1PDV4jHhy8kdcLgYOMf7Z2eeJlN/Pft7zUa02y+U3miJEqdAG80QM9L+C8ASNK4bmlDMMsnSbqTvlsE2WwKaS1ina/JupPTju/EdS76U+VtRrz4m2hZNYMYPSnRXe9Cj8JEvgJ4aZ4IF8IMKZxIiYVJckp3/cMXt0g4hgYA7W8MAcKW4V9lqGWX8PvUVzqOH8wfNfW4DUnKXKQFxQbk6NVehKDR0BDWB8I8ewOxts7dy6k/yHbscN50PUT0pSysEevxTwQWvxzYBLPVbC7geaDPpbyFkxnqSRNPSAYLcIGqFaix25p6IvXwZdRGeBRpjVI+9BZQxX8o1ICZBn0z8DC/Wf+RDPY5HNhJBSyPh60SfHNHC4Hl9kh0PRVlWSHbOKiTZTXSE57x+/5ZN/nQ4ix+VTiqtP+wI6TZFp7/FiXcUmVZeWApmpMPZnHPMD3XpzMUOQAH0woTGY0dgevUxkweCk+if7dXWemBqxg1/h/d3uf9jtPPgqLDu9lRgdzFfGW2+b63li1l2/h4zVxAs687YXzzvwrHe4Se3O8hmD7/IzXBgobCLDG0fI1bFXDQPVTKhPnSCPtQNDwpjrj3Phf9durjpgL+BSDxGiBT2Yex3PpBcVOMoxUrEcurJtXiVQ/MfLFPtcrFanZAco/kwvwSKjLVhBIjbDVu3NtDExhHzab/uRnz203xWUftzQVYY2le7gDyMjZ1M49URRjwpJBAVsBU4BHdIwQZetOMD0Er1Yzozf2cY7ufOQOtvOSjfUhZjyXUhakPyzu0TUFGiJrU= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700001)(356005)(81166007)(40460700001)(186003)(508600001)(36860700001)(82310400004)(426003)(70206006)(86362001)(2906002)(8936002)(70586007)(54906003)(83380400001)(16526019)(5660300002)(8676002)(44832011)(2616005)(1076003)(47076005)(336012)(6916009)(316002)(4326008)(36756003)(26005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:18:43.6037 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0d7b040b-b64d-488e-4d05-08d9bf60742c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT031.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5481 Received-SPF: softfail client-ip=40.107.212.61; envelope-from=Michael.Roth@amd.com; helo=NAM02-BN1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_FILL_THIS_FORM_SHORT=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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Markus Armbruster HMP command "change vnc" can take the password as argument, or prompt for it: (qemu) change vnc password 123 (qemu) change vnc password Password: *** (qemu) This regressed in commit cfb5387a1d "hmp: remove "change vnc TARGET" command", v6.0.0. (qemu) change vnc passwd 123 Password: *** (qemu) change vnc passwd (qemu) The latter passes NULL to qmp_change_vnc_password(), which is a no-no. Looks like it puts the display into "password required, but none set" state. The logic error is easy to miss in review, but testing should've caught it. Fix the obvious way. Fixes: cfb5387a1de2acda23fb5c97d2378b9e7ddf8025 Cc: qemu-stable@nongnu.org Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrangé Reviewed-by: Gerd Hoffmann Message-Id: <20210909081219.308065-2-armbru@redhat.com> Signed-off-by: Laurent Vivier (cherry picked from commit 6193344f9337f8b76cd44ce94a32c9900d907d35) Signed-off-by: Michael Roth --- monitor/hmp-cmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index e00255f7ee..a7e197a90b 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -1496,7 +1496,7 @@ void hmp_change(Monitor *mon, const QDict *qdict) } if (strcmp(target, "passwd") == 0 || strcmp(target, "password") == 0) { - if (arg) { + if (!arg) { MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common); monitor_read_password(hmp_mon, hmp_change_read_arg, NULL); return; From patchwork Wed Dec 15 00:00:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677069 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1EC1BC433FE for ; Wed, 15 Dec 2021 00:54:54 +0000 (UTC) Received: from localhost ([::1]:56128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxIZJ-00036x-25 for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:54:53 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54134) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxI0m-0000aT-7b; Tue, 14 Dec 2021 19:19:13 -0500 Received: from mail-bn7nam10on2078.outbound.protection.outlook.com ([40.107.92.78]:49180 helo=NAM10-BN7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxI0i-0006ah-20; Tue, 14 Dec 2021 19:19:09 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TpQNe8CGTp+Bb8hqlp2D6ACkvrnVOs/JqGN6UtJ6FNKYC6Q63dToZBpg+PTagcvDc6TN99ej5h4ehVjDEyb5fjO9Ro/i7kurZOzBr8lfCyoG7zJpduotvH9DZlP4Mr3e69wBScWbVqm14nxddNUW/bYGFvXbewGEcztzYGu7o5fsy64/e7aU40cSrQ4vPA7RCRFgzbNVQVZy41/uybX7csFYw2abIqi/0ju41vFPooQc95UD5u3fEvF9F3DyutMdJgux/nFmrNa9CAjN5BcrUkuxTWsBmXCihP1ry+BRF5YNQB3okmnT5TvpSA3a7kb8jHBPBXS1pQpIh7w76FAmHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JTuTcfJFG2D2G+EG65F+rhctkWVk5bPCtIxZ5uUtri8=; b=j2rMiALohKsrsogoF4ZVa+bVGMtelyrdiUB+AKw8AveyovLjEd9wuvyI/mcFUEZ+eTcAHpRqUlgTMlyE0seQoUuycFtWVEV1EWA/PjmqDL5uElnKttpvJsbfejaGAcduMpx4xXve0ySUNcYWQz5uvvNZ7tDC5lqE0ltbcNGmNgBYNydsa9xNwZXCp6iWqzJondTePBpU0/9iKREu5mhN9rIb369zsOjtA8mFvkBNWrsvLyUnoinRyOazCYP4LDEWfxGN0m6dA6bjUoCziUeqPAdSIjl1PGx1wDPEkYvWk3LI14OaZiqfpwXuu/JlbRxYnWwPfEl+EWS3bnrrEziR0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JTuTcfJFG2D2G+EG65F+rhctkWVk5bPCtIxZ5uUtri8=; b=xMiOj6bysIJdt4c+MVsMCJugYueTTdl959djNuoky4RfK6FCnnfpP5zu644W2Ems16IPxDFmqULT7LF51om2SKqWIkvQshMImOjDmUzxYpGVyGweUes0zPVrni0FFyvxuBA/08+gN0L9lb0KA9pmCO02Us4wJBNVNrS82boY32E= Received: from BN0PR04CA0022.namprd04.prod.outlook.com (2603:10b6:408:ee::27) by BY5PR12MB3939.namprd12.prod.outlook.com (2603:10b6:a03:1a5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.15; Wed, 15 Dec 2021 00:19:05 +0000 Received: from BN8NAM11FT036.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ee:cafe::4e) by BN0PR04CA0022.outlook.office365.com (2603:10b6:408:ee::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14 via Frontend Transport; Wed, 15 Dec 2021 00:19:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT036.mail.protection.outlook.com (10.13.177.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:19:04 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:19:04 -0600 From: Michael Roth To: CC: , David Hildenbrand , Markus Armbruster , Paolo Bonzini Subject: [PATCH 06/47] virtio-mem-pci: Fix memory leak when creating MEMORY_DEVICE_SIZE_CHANGE event Date: Tue, 14 Dec 2021 18:00:44 -0600 Message-ID: <20211215000125.378126-7-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3947c229-abfd-43cc-b924-08d9bf60809b X-MS-TrafficTypeDiagnostic: BY5PR12MB3939:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:220; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xN2JGIhO6htnf+VcTa2pdm7SLtXkEzcBX3LwlBHfvsiEKXDi4goZ2mHkJwI6uwjrYfrJCDUTiNSlqKyZCmi2vODwQGkwVGCcsz4PXUDS96EmqLugcZ3vFwnXNn/JqQfWOpgQvKJg4qvQWtMAkOfKmo+abkYu8lVSIPLvq+IEGGiz7hAX7SgjDvjYfFPa4KxwNV2ZM3HDH21HebUrhsfJfTSnlSBFwQcUWHv5/4bEt85JeQEIA0hOZhxKMcdLAoxCxfjYX4RFt4A8acxyZ+TDh6gDRjTHsjA2zg/1iDP6Qn5LVoguPcN8nWJoBR5Bm+oG4Hr73BgN3k1w+GRzL62w3VG8f/6oA8b3Zo2J2kysDXzoskbpoMMCY6mEItkQsUaokh7MlZyCS82Y4O23Ncsx/7osCNCzm0ouQyVQymmrtaVUFMV96DHhbuMZHx3DMzfqZTZZf/71rhFZSYVH05/g0HkGd9NLju4kD3mV55GB9DE+9TlOM9NMTWrQl6UB68Je5H5pSx9CIIeYl1PakcE3/gEWMUos36eVQBJbKYZnJ9bFyStAefH4v6fe1wMzJF0MUVsHjKUnWY1V9CGiK39+16MnEu71zWQeyEMLI7Ha1H1V0VwPcxZGVF/oBJ8YgBeH1pqq6oR2C7S0P4VkSt4sxVyjS1/6m4st1bV2i7wU8st00d6cbuHwc4E4Tbl3Cauhiw3K0zzhwMGE4BZmGTzn1RjJFAf3jLs1N9jHAY7hFbUCYlnWjAOQvcaZn6WFqlV4H3fN8aCk0e0ab3YbE7devNCOPnRATSEHZPIfwQwQeWY= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700001)(36860700001)(2906002)(5660300002)(2616005)(40460700001)(508600001)(36756003)(6916009)(1076003)(44832011)(316002)(82310400004)(47076005)(81166007)(336012)(426003)(8676002)(6666004)(186003)(70206006)(54906003)(70586007)(356005)(26005)(4326008)(83380400001)(86362001)(8936002)(16526019)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:19:04.4621 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3947c229-abfd-43cc-b924-08d9bf60809b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT036.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB3939 Received-SPF: softfail client-ip=40.107.92.78; envelope-from=Michael.Roth@amd.com; helo=NAM10-BN7-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: David Hildenbrand Apparently, we don't have to duplicate the string. Fixes: 722a3c783ef4 ("virtio-pci: Send qapi events when the virtio-mem size changes") Cc: qemu-stable@nongnu.org Signed-off-by: David Hildenbrand Reviewed-by: Markus Armbruster Message-Id: <20210929162445.64060-2-david@redhat.com> Signed-off-by: Paolo Bonzini (cherry picked from commit 75b98cb9f6456ccf194211beffcbf93b0a995fa4) Signed-off-by: Michael Roth --- hw/virtio/virtio-mem-pci.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/hw/virtio/virtio-mem-pci.c b/hw/virtio/virtio-mem-pci.c index fa5395cd88..7e384b7397 100644 --- a/hw/virtio/virtio-mem-pci.c +++ b/hw/virtio/virtio-mem-pci.c @@ -88,13 +88,8 @@ static void virtio_mem_pci_size_change_notify(Notifier *notifier, void *data) size_change_notifier); DeviceState *dev = DEVICE(pci_mem); const uint64_t * const size_p = data; - const char *id = NULL; - if (dev->id) { - id = g_strdup(dev->id); - } - - qapi_event_send_memory_device_size_change(!!id, id, *size_p); + qapi_event_send_memory_device_size_change(!!dev->id, dev->id, *size_p); } static void virtio_mem_pci_class_init(ObjectClass *klass, void *data) From patchwork Wed Dec 15 00:00:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677065 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D32E7C433F5 for ; Wed, 15 Dec 2021 00:53:27 +0000 (UTC) Received: from localhost ([::1]:50546 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxIXu-0007qF-KI for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:53:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxI16-0000nA-0J; Tue, 14 Dec 2021 19:19:32 -0500 Received: from mail-dm6nam12on2086.outbound.protection.outlook.com ([40.107.243.86]:58049 helo=NAM12-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxI14-0006bZ-1X; Tue, 14 Dec 2021 19:19:31 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NcEYwJ3gOZw1b/13XSoC85b84PF5+XkcIadl38Y4ngSwCxXNN3uPFNsZZ9KZ1ZqzRpk2EYv7gbfBlPBQlUvL9hkMQ8MuT1ECwjLTnZ2RrSDjy900mP8WmG1/sRRgVt+FMpFhMqzU0ThnZigx1uVunsk/ZQ7Qso1xuZOVqNvfls/WLWkP16UOiBSC8bOhji8kdzxN6UkvXZXaHkUUvGg4H47PpjU0j18nm0nq098kXuVW/xoId9nnsy9b0H6PbvIfp+RDmwI1F8rB51fEBcmQu6VWC5vJ3kDgC8HDb3ebVb/i/ZrMa4AvTvo8+zekXxdfg9kZVTClqcm/MYSk/zm3cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=e3t0Of36ttc9Am/ojr/s3rUYC8SOMQj3BSwKT/cJ0pA=; b=eqBKeiYHXc8Yuow1YXTmwjirPN6RwKayGnmQfqjJL6qfZ34bFqYmv2gh+H11/lqHkg5yTrEC27Jj349kIN3AW3vM2rm7Jiise8HMTykQDD6k2nI4tBFTZkflCNlfQSy5/KSZXEFAIz12H5YCtv6dtcTbSakqRDEf5uIH5PSrZTChefuYbQOIcibuIb+PeiiD79Jt0zWisIEn2vmTvJrmUbopWO54sxmT2/vQSmBgBrmWBRFkaMFAieqwONxMPIUynYHWbg4AoQWweIvOTFZ7rrvxKXzoFaSTHUhieBv/QdWJZLWyiDqEXm8F8BbC1kXzeOn6Rb0LS22VKJ+TEsezfg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=e3t0Of36ttc9Am/ojr/s3rUYC8SOMQj3BSwKT/cJ0pA=; b=Fn19ptPWqGDZ9cY6V6ybg3UZqSF7t+xlYvZv1DXvp8HaOAwOwyQarXFLPMGKajG7zh1uqS36gr+26W/7MXRaNkWfzN9UDoq0cd6Aez6XSg6nrHkZAVCeYWWFeBDYIFFXxuwWP4RTJCBjgvH5FUvBseS7XQkzgoFlj4cb/hJDG8A= Received: from BN6PR11CA0022.namprd11.prod.outlook.com (2603:10b6:405:2::32) by BYAPR12MB3141.namprd12.prod.outlook.com (2603:10b6:a03:da::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.11; Wed, 15 Dec 2021 00:19:25 +0000 Received: from BN8NAM11FT060.eop-nam11.prod.protection.outlook.com (2603:10b6:405:2:cafe::ca) by BN6PR11CA0022.outlook.office365.com (2603:10b6:405:2::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14 via Frontend Transport; Wed, 15 Dec 2021 00:19:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT060.mail.protection.outlook.com (10.13.177.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:19:25 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:19:25 -0600 From: Michael Roth To: CC: , Gerd Hoffmann , Chen Zhe , Tan Jingguo , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 07/47] uas: add stream number sanity checks. Date: Tue, 14 Dec 2021 18:00:45 -0600 Message-ID: <20211215000125.378126-8-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6dfea955-ce83-495e-2c2b-08d9bf608d0f X-MS-TrafficTypeDiagnostic: BYAPR12MB3141:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YYB47b+bdU7gJiF4p/43Ifn1pMjNLLgoSOR4LMsY+PcowYWCNXaCG5RLTU4TfWTF+uj3cqwZgxTfYh/6G/P7qmsjDsCeCy4crWaA63ysnzXwUAI36ZfUKnvyDiywGwU2SXNm2VvT9f76EEu8Q7kuN0npM6Rm/rvS3QA5cywBghNr8ucAQpUs/Dp7/PSdjZpMTJtjMZkV4WIpZi9PPr8LTpFhe8lRQorx+F5elTQTFDfBSck9L//ux3aVfI3y6Z+CjEbPCCUvIA7o8VQy2qMKQCLTepk6cPGnstUUZKxCo9PLoDM9PK7l2d+s42pfVgWqOya3Awb9DdesYO9zAr1ovFP+sPiOLVORs/JTfImHTWEqbJm1na1cS37ELJ/gUSTMD738dqLQ1Itp1qIUTwhYv68CuJ8chfkcRel+zdncPIbahn8muim1wUTygqhmLEGKiQ8T6/RqZVWrmVUl8mYVmrPV95SdILCtvMrKrrY9nfS9EuZ50bCVSUsEklk60CXbs7G0UL5tvKL9PuMPY5Ve59vvx0rptdIRe9JmVOhxkQFOr4aVNeFeNf5a8Ow5YSW+Z1dbEXUtKGZ0r7Yq/tN4BG7/Oq6xw9GprQpb8QrtJW2HdRdBPRzDogndljaObmjDtPCw6aN+DunHYv4Ae78MFWPy4hrsg/8e67JHGcKsDVxDni9VKOoA274JbS9MHKvoTt4wolVdsXFAnJgNTnNFlGTDtiTzG2+3CtOWu/oLi0Gd6WEbJYTL9AC4CybCPAGJ+5XCz6RhMA5ldu7W379H3YbQVdK44WC6WXMdfJSkYk8= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(40460700001)(16526019)(186003)(316002)(2616005)(47076005)(82310400004)(36860700001)(426003)(1076003)(5660300002)(336012)(8936002)(508600001)(6916009)(26005)(54906003)(8676002)(6666004)(70586007)(70206006)(36756003)(86362001)(4326008)(2906002)(83380400001)(81166007)(44832011)(356005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:19:25.3549 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6dfea955-ce83-495e-2c2b-08d9bf608d0f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT060.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3141 Received-SPF: softfail client-ip=40.107.243.86; envelope-from=Michael.Roth@amd.com; helo=NAM12-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Gerd Hoffmann The device uses the guest-supplied stream number unchecked, which can lead to guest-triggered out-of-band access to the UASDevice->data3 and UASDevice->status3 fields. Add the missing checks. Fixes: CVE-2021-3713 Signed-off-by: Gerd Hoffmann Reported-by: Chen Zhe Reported-by: Tan Jingguo Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210818120505.1258262-2-kraxel@redhat.com> (cherry picked from commit 13b250b12ad3c59114a6a17d59caf073ce45b33a) Signed-off-by: Michael Roth --- hw/usb/dev-uas.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c index 263056231c..f6309a5ebf 100644 --- a/hw/usb/dev-uas.c +++ b/hw/usb/dev-uas.c @@ -840,6 +840,9 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p) } break; case UAS_PIPE_ID_STATUS: + if (p->stream > UAS_MAX_STREAMS) { + goto err_stream; + } if (p->stream) { QTAILQ_FOREACH(st, &uas->results, next) { if (st->stream == p->stream) { @@ -867,6 +870,9 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p) break; case UAS_PIPE_ID_DATA_IN: case UAS_PIPE_ID_DATA_OUT: + if (p->stream > UAS_MAX_STREAMS) { + goto err_stream; + } if (p->stream) { req = usb_uas_find_request(uas, p->stream); } else { @@ -902,6 +908,11 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p) p->status = USB_RET_STALL; break; } + +err_stream: + error_report("%s: invalid stream %d", __func__, p->stream); + p->status = USB_RET_STALL; + return; } static void usb_uas_unrealize(USBDevice *dev) From patchwork Wed Dec 15 00:00:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677109 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6B7D2C4332F for ; Wed, 15 Dec 2021 01:01:04 +0000 (UTC) Received: from localhost ([::1]:44278 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxIfH-00060D-7L for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 20:01:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54218) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxI1S-0001F8-Br; Tue, 14 Dec 2021 19:19:55 -0500 Received: from mail-dm6nam11on2082.outbound.protection.outlook.com ([40.107.223.82]:34403 helo=NAM11-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxI1Q-0006fM-0r; Tue, 14 Dec 2021 19:19:54 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SOmqGE97bvHMW6ZdI8LXb6CfEFP0ucXquJL8Wpo9GzkZHHHY4H3rYJwbmQEfwcsriHH2tchbx+sUctRzhQICMrXA2MoDNzzkJ7vx2vX6+ruSEweLbQDG6BswtMahQTct6wAmnksT7ZQKeBp6Uz6oNUizbDg0+Ro16UYD3J/8E2h+jCqViy8mPi/2HPsg602W8Z/SOxqUJg5Wkags1+cnIkWTATFiNUVq1RWtLFbEcJ2YSVquJclYslRdRI9jhTM5Mal6fr0o3SHUhIfiXF9bRsq4cj4nI6i8lleaxZHNcKqgJ7x7UmB+V7hYMTgWVCAOUezH4v3cuv73nRbX2GlX3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=V5EzCM586ZQLU/n0UcWd51cBqe6iimLomh/LhdViAuE=; b=J2s/rENrgQqE49V72UsC9L6mB6ISMk06IDxaUp4PFrhqTRy3QV2CVT+jgzAF7omHn6v/DHfITf0ThDJN+9664aX9kzFu2FIR0H/j3Y3t8N3naKsDSw3UCPWG4PGy3WLaJ+iBF2iR3v1K/c378Nu9RWwbFgku8RSdSdVeERgfMDeMTzkJp59msfSMFoCN08p9aGV1WNiUy7FPsPYPCPDra1bAIchOs/Td12At5TjxRaI1EbP1kRkZ7VYCUktMAn0TK5qd3+9R2CYZA5f9vGHaMvLVFonTTLI+W+ArHSYF7/ZedbOPFFn7YS4yx8ephGhmlCCfvry3rnL4bW7w462WWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=V5EzCM586ZQLU/n0UcWd51cBqe6iimLomh/LhdViAuE=; b=gjcUBGTjOM2yAUNGdjpKKJpzxBfMvEwbprXlhicDfHpoUJi2pg30bL8jaq2/70nnRefilVgTjerXOn2AZMwouHGmrVzrj7JYdRQJHL5k6xlVP+BPRO20A+W/E0EcgTqctaWb9IqIMxsz/tInrmZkG2tXxUmCCGM1cbXs7l6+atE= Received: from BN9P223CA0030.NAMP223.PROD.OUTLOOK.COM (2603:10b6:408:10b::35) by BN7PR12MB2833.namprd12.prod.outlook.com (2603:10b6:408:27::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 00:19:47 +0000 Received: from BN8NAM11FT028.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10b:cafe::d0) by BN9P223CA0030.outlook.office365.com (2603:10b6:408:10b::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.15 via Frontend Transport; Wed, 15 Dec 2021 00:19:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT028.mail.protection.outlook.com (10.13.176.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.16 via Frontend Transport; Wed, 15 Dec 2021 00:19:47 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:19:45 -0600 From: Michael Roth To: CC: , Xueming Li , , Yuwei Zhang , "Michael S . Tsirkin" Subject: [PATCH 08/47] vhost-user: fix duplicated notifier MR init Date: Tue, 14 Dec 2021 18:00:46 -0600 Message-ID: <20211215000125.378126-9-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 21a86786-5865-4a8c-eafe-08d9bf609a37 X-MS-TrafficTypeDiagnostic: BN7PR12MB2833:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:16; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8Fq+RZlNvsiUvh9Iy4YVwMsmT23vQ8NEpyXqCK94d8RhyHswraq254qKt9wMXWFrF23vaAjs57UKgF6fX8F+A58eC60+MnhcuBMbMD8x8UkwupaW62w6/f8arqlqmkiIZBFaLW9pvvMz4erXgDnw9S29ykIJEaVEDF8M0cLUZMPMUEaIw+yExwXGPfueQOF8VMAHPqCQA++zSJjB9BIPVBLzfzOpJyUAOMXAV3sqAT7uYR1d0qvs7sew7O/gwUFPRMtwJisBl/NCHSkYruUyE1aGYN5qIXtLjDj95oySBkPjP0UnEv+1ApbKihC5SzPNbu74wEQs8fDjwv5ppStnbkz03HCzTPkVwDjCLTQqCEjuEcp48QdfqSa4AlIg4BsPYfCI3NKd1KNbQ7t2IgsR2dsnXJVpNfJD4MotRufZHtEZXF2HCGwesZJhj40TBPY+uEt9WZsBtm4DJgsYk3UBJgPoJSh+hYtdtqOrmaaorflvpC5FWjvmUl8wVb3Jamuv5U6op1V2hH2UFIngPKRk0iiMnVauGN4Xe18IF/XvtfbMTJHF3S7G0IChoJWO3YtOVNVgKW6Cz6BiORpnQeJca6q6nXY1C4e4wfYvX04pcmfWeiL3WCHv8igu+2Dm95tafHvMCVT1Rg2gQzDkaHdvHTRAC3AsNHvlM2kZabpTgIUQ2MO1SlS3zE9wQIMU6h1TeIRlYLlhVVyKEWSLQhPHhkdUmUfLQ5sMWkNuvj3LY4/8La1Ujby++hsGykJR0jWeARYWYyE6Nkin0oP464JCclA/H0TFInI6k9O8Z50Lw4Q= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(508600001)(83380400001)(1076003)(356005)(81166007)(2616005)(44832011)(4326008)(426003)(336012)(5660300002)(40460700001)(8936002)(6916009)(2906002)(47076005)(70206006)(316002)(36860700001)(26005)(70586007)(186003)(54906003)(8676002)(36756003)(16526019)(86362001)(82310400004)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:19:47.4313 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 21a86786-5865-4a8c-eafe-08d9bf609a37 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT028.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR12MB2833 Received-SPF: softfail client-ip=40.107.223.82; envelope-from=Michael.Roth@amd.com; helo=NAM11-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Xueming Li In case of device resume after suspend, VQ notifier MR still valid. Duplicated registrations explode memory block list and slow down device resume. Fixes: 44866521bd6e ("vhost-user: support registering external host notifiers") Cc: tiwei.bie@intel.com Cc: qemu-stable@nongnu.org Cc: Yuwei Zhang Signed-off-by: Xueming Li Message-Id: <20211008080215.590292-1-xuemingl@nvidia.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin (cherry picked from commit a1ed9ef1de87c3e86ff68589604298ec90875a14) Signed-off-by: Michael Roth --- hw/virtio/vhost-user.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index aec6cc1990..7b35c5d71d 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1469,8 +1469,9 @@ static int vhost_user_slave_handle_vring_host_notifier(struct vhost_dev *dev, name = g_strdup_printf("vhost-user/host-notifier@%p mmaps[%d]", user, queue_idx); - memory_region_init_ram_device_ptr(&n->mr, OBJECT(vdev), name, - page_size, addr); + if (!n->mr.ram) /* Don't init again after suspend. */ + memory_region_init_ram_device_ptr(&n->mr, OBJECT(vdev), name, + page_size, addr); g_free(name); if (virtio_queue_set_host_notifier_mr(vdev, queue_idx, &n->mr, true)) { From patchwork Wed Dec 15 00:00:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676951 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5BAC2C433F5 for ; Wed, 15 Dec 2021 00:06:51 +0000 (UTC) Received: from localhost ([::1]:57296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxHon-0002ki-N7 for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:06:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHlq-0000rC-Va; Tue, 14 Dec 2021 19:03:49 -0500 Received: from mail-dm6nam10on2061.outbound.protection.outlook.com ([40.107.93.61]:37349 helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHlj-0004h9-KC; Tue, 14 Dec 2021 19:03:43 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VM9h1zD+Bb2mwCjw/0aAQacJwhaFsW0qqt02qo0FGE8SSMyhTiQR1jTX/2lEc4PAvQ3epmsTItEzQJ+Kl9dzMAfTD0WKc/2JFxw9fw0bIL5uRKfqKuGVHy+8DaqzuLa2ZDMBvg/BgKnBGYUJ7w7K/1N4ZMUMbaUg0OrdDqefVlgfCDIuZcrk/7ts4ygax00LfjneXG6IQzGlvZVHNLTtM2icr19DwNtA6Dyty55eSCDQsv/5eXx1nkLQuC99YX6O98Ec+yBomXAJJZMrErKxjosNaw0nKrWs36lwVrl9bMCSIgKPaufL2gs/wvIEgAV/OK2vHVDfO9/X7aZnHCbDNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=moT7gGN12IOpbF6pRI41tYe+3kWPqvOuMl/htAVIf/g=; b=HiYtv9c7Di9dOyG9jKBxht1ppXFPjfKHHRG01n53iaoqGh8Rl8cMOsJWxmySvchv33kKVCmDkk1rHYVWhgmD5VFyxDfoJcEg400a8DkohyXIkecgP0HXKWU+C1zKPH1zN42m2E7eNs0RMKNW1tvLCF8DpNsq3PP+E3DXd8qBS5UNNw/fLQ3r9zOJiJmErvcILxWar8b5WTtuvL5d9jA5pHCtLdvsWgBwDfJRjq0MS1OSnzEuTjvB1+Mpqaur6au/6My7RNxEUI038wgLDdw3z1aLsVPegwvOQwlOrJqxuRVfiANMpdpup+SzdsLrqJ/g63QQ9GCT/HajLwZ+Crj8zA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=moT7gGN12IOpbF6pRI41tYe+3kWPqvOuMl/htAVIf/g=; b=cGI9Y3D4Zl6NePN99BZRotU5OtiXXS+nTiM6CTwaAQrJ5SGNhHjFCF11RjC6rf2tASqInVn8VCS2Od+KLOAPG58D3VRLgu1t65kaFEDMpRJz2852OIJaNDvhgsQ4pDCQEjR4nIMlEwKrInOyG+PAlFXjV8UyYZ8FOEBHvxp/15w= Received: from CO1PR15CA0047.namprd15.prod.outlook.com (2603:10b6:101:1f::15) by DM6PR12MB2780.namprd12.prod.outlook.com (2603:10b6:5:4e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.21; Wed, 15 Dec 2021 00:03:24 +0000 Received: from CO1NAM11FT012.eop-nam11.prod.protection.outlook.com (2603:10b6:101:1f:cafe::7) by CO1PR15CA0047.outlook.office365.com (2603:10b6:101:1f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.15 via Frontend Transport; Wed, 15 Dec 2021 00:03:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT012.mail.protection.outlook.com (10.13.175.192) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:03:24 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:03:23 -0600 From: Michael Roth To: CC: , David Hildenbrand , "Michael S . Tsirkin" , Raphael Norwitz , =?utf-8?q?Marc-Andr=C3=A9_Lu?= =?utf-8?q?reau?= , Stefan Hajnoczi , Paolo Bonzini , Coiby Xu Subject: [PATCH 09/47] libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr Date: Tue, 14 Dec 2021 18:00:47 -0600 Message-ID: <20211215000125.378126-10-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4b441c2d-ba00-4f90-52d5-08d9bf5e5048 X-MS-TrafficTypeDiagnostic: DM6PR12MB2780:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:364; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BLgZpNQpzRyA9PZqHQkA0YfkyZS4oK10EYT6UcfHXhs1XdfPqHQhiyIUnMhoiWQ/ecj5C6ggxsO+qF+ypX2bwCcHFZw/pOuEyxjr99vniaQcDXDrKSnVkxEhYf8RTaDQX2BZ1uyv/B7WbK3kfgKjNLmY17c0UPbD/nJkskmko/N4ef/CHWLBFz2nmff1vBlMi/pvlhBHKsCJczymhHhJFfMqyPOO+S/5M62tS+7kIEJdMyyAAuQVLKx6pG0hDAvx7r9+Zi/z4YY6kJUxhLGnRsokmUvGa9bRu7qWO7vfAgk79/FLrersO3DO8P0yQ0Dn9gvkImbh5fl84f7H8+ykhq40YQsk3S83qzxH7/ecwQ0vI0uQciH55NwDO5nnkk4jlZQ0UIXzKmDrzdVS2E7PWM5diWAer1YR896IW+u1RAJ16QJ7SNDUcdKFZpB3y1UCQ7rvKd33pHo1RnELQfS9pWmDPy7EVEGbrboWGOZHNjx3W3WeZk7duAS2+B9SB3gH0HZP6EnUkhI5Op5D+XAil+vwSdgwtlls8ia+fruTNODse5+LcAqQNrkX7bdS8/96VEzVYWgqJeEEy5v3iFHpYeoKv2tTPGyfkX3DJwNKqvuXqIoKBbTHYum7DVXXEaNVRusP9vvK/nedMFxm0jKbsN2xnXf6Xnut1iCjlMOxECZn+n6aYk0UhkLP3FFLi3nbfO3UHEaWpIyGQYOrpms00e4qZQfU2SPhNhfD+JDibgYOqkLFcBvXOtK4keOyACwgcT90irep7/Y+qglztsSU+XgBroLJ9kBQI+wO1DPPEwM= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(6916009)(1076003)(6666004)(186003)(54906003)(8676002)(26005)(316002)(8936002)(16526019)(356005)(2906002)(83380400001)(40460700001)(81166007)(70206006)(36756003)(47076005)(4326008)(336012)(70586007)(426003)(36860700001)(2616005)(82310400004)(508600001)(86362001)(5660300002)(44832011)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:03:24.2665 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4b441c2d-ba00-4f90-52d5-08d9bf5e5048 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT012.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2780 Received-SPF: softfail client-ip=40.107.93.61; envelope-from=Michael.Roth@amd.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: David Hildenbrand We end up not copying the mmap_addr of all existing regions, resulting in a SEGFAULT once we actually try to map/access anything within our memory regions. Fixes: 875b9fd97b34 ("Support individual region unmap in libvhost-user") Cc: qemu-stable@nongnu.org Cc: Michael S. Tsirkin Cc: Raphael Norwitz Cc: "Marc-André Lureau" Cc: Stefan Hajnoczi Cc: Paolo Bonzini Cc: Coiby Xu Signed-off-by: David Hildenbrand Message-Id: <20211011201047.62587-1-david@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Raphael Norwitz Reviewed-by: Stefan Hajnoczi (cherry picked from commit 6889eb2d431ae962e3e083b57bff47cd573cb1c4) Signed-off-by: Michael Roth --- subprojects/libvhost-user/libvhost-user.c | 1 + 1 file changed, 1 insertion(+) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index bf09693255..787f4d2d4f 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -816,6 +816,7 @@ vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) { shadow_regions[j].gpa = dev->regions[i].gpa; shadow_regions[j].size = dev->regions[i].size; shadow_regions[j].qva = dev->regions[i].qva; + shadow_regions[j].mmap_addr = dev->regions[i].mmap_addr; shadow_regions[j].mmap_offset = dev->regions[i].mmap_offset; j++; } else { From patchwork Wed Dec 15 00:00:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676953 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6A840C433EF for ; Wed, 15 Dec 2021 00:07:12 +0000 (UTC) Received: from localhost ([::1]:58522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxHp9-0003bT-Bd for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:07:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51268) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHm9-00017l-9T; Tue, 14 Dec 2021 19:04:07 -0500 Received: from mail-co1nam11on2071.outbound.protection.outlook.com ([40.107.220.71]:45344 helo=NAM11-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHlu-0004ij-8w; Tue, 14 Dec 2021 19:04:04 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=STy6WLNnrf10Yipk4A9OkzuhaAopzWvcl8pTJKSMiyvq7ciLbsEa+AYhAGASbhxgqrN2/xFWSph6FHoXb5/WwRIy8BGzCyyWIbavUc9bFmJG5iGTiy+V3Sd0TSmAbmOIJEQw3GMyubp4d2wMoTiI7rQJKROeBUTZzS7oYhVYsRxIrEnuqaJqq4sv7BPW16F11pw2dEguXSc7OopoA/ixaQnSdrk0wNC+RtUkL6Xi4qwK5hBTeyXXBgo56yRLz9jRUp6TX6wqB9ab3LF7cVnCO8Q9f7grVmDZok3tBVMr45yCjm5UQKyTRpYpgnSd7z7s7By2xHuZmQCKrZ5RSjHJtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kZiTzW4YTXNSuYVmYcjN5F6TNh8honjBn7jl6qSBPCk=; b=ZCJhJK8+JWZOHwUuwcPbykHnl/yeBlCw89Tb53T8xtboD1Jve78UsGg73O6RCK2P7RQVkqqiHzJjUME2JpmzZkMCtGd5BVhaBfGNcL1vzbfWMXvzyuXLXzZP7o24ylKPHCV41TJMAuZe/qJDYNJMyc82k8q3EwxFOqbaZ1EAdiSTqAc2FGrfg+oNtDqGDkcAOF3uzmWOT3b3N/rKqkeUjaknDUH3Q4OlwgOoknN4NO67sS/8bJRUJLWfJeYfwOkvYBv95jJoEn7W99fdyU9n9qBQrHJOZz3kSG3dGGgufjsOX7tv6HqaBQEfZwugk78wc9khUoXRhEVo22/swHAzow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kZiTzW4YTXNSuYVmYcjN5F6TNh8honjBn7jl6qSBPCk=; b=3J6ocqGaAchAs3liKYYxOGpmfSkhi0/DEnauUunb4tQC9rn2YXnEQRMWbPp/UqeZvVxqcMjhyDoMm81pYVKX45OWsNmo2h2PsUsPTwdq9qgnWPDTYyaxCAFLnAw5cgNXYuOHScdU1Digq+VExcHfsEy5Lu1gqpU0rgMfy3eh0H4= Received: from CO2PR18CA0061.namprd18.prod.outlook.com (2603:10b6:104:2::29) by BN6PR1201MB0130.namprd12.prod.outlook.com (2603:10b6:405:59::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16; Wed, 15 Dec 2021 00:03:46 +0000 Received: from CO1NAM11FT066.eop-nam11.prod.protection.outlook.com (2603:10b6:104:2:cafe::ba) by CO2PR18CA0061.outlook.office365.com (2603:10b6:104:2::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.15 via Frontend Transport; Wed, 15 Dec 2021 00:03:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT066.mail.protection.outlook.com (10.13.175.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:03:45 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:03:44 -0600 From: Michael Roth To: CC: , Helge Deller , =?utf-8?q?Philip?= =?utf-8?q?pe_Mathieu-Daud=C3=A9?= , Richard Henderson , Sven Schnelle , Gerd Hoffmann Subject: [PATCH 10/47] hw/display/artist: Fix bug in coordinate extraction in artist_vram_read() and artist_vram_write() Date: Tue, 14 Dec 2021 18:00:48 -0600 Message-ID: <20211215000125.378126-11-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a41851e7-9f91-4fc6-238c-08d9bf5e5cbc X-MS-TrafficTypeDiagnostic: BN6PR1201MB0130:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FSMJyZLyasT4P5qPn8OAM23HFTLsw0Eu7cBdBwdsRANqS0Ag3Q/pCGBtdytMkGxXyPUBpwOeRkbrC9cnE6723NraHAzFLZPkQfI5llszx9porZHfpMqI7JuJ3Lb2az1mEwSi6E/7xsQP1IcnBVyNIASCvNo/09X5tqqqwemfZP3JC6/fqBfw2SvKgkGA3kdvfpgRPZi+x4lr4fe/qio9RhijZUHkqIgaQ317bCOmcWXs0HZe94Ty56x4jzWmUoDhvEJ+Kow3Ef5EsgKgPONb9GGhLwUdtRoMar9d54p3Jimo8ZymoUYjr3Wfwy2Qye+i+5gp1bcgTC1soo7+zKS5hsPjHovsGZg5qx2WXEdFO3xRPtp5O8e+yV6lQ4rosx655xyA67rlKhJNK1nMTTwO2g8m0wO+xbg/1ppazewCUrk5ABQOoWCHyuEu0U0wNVaeRQO/ntuUjViGif4JEypi0CfP9S61BD/R+3vzAul3gA62d93XXLo5G8nR2MJ3stUqJ3k2UtRxW7u13md3ux+s/xtEFLRsdS99nlYV5Y6z9oe4l3shyRl1Z8GA40DCqfGyuyuGwyKwMZVCFjPOQrftqDoERR6cnCkGFJkuEyXbuBHcTC5BP89JSL+vaFO5vHMdmPwc2rwy+jrIlWFHe81ALPAIZIfTJBwucqIn1if37W2WcAhviXiDI3gE7jTKkvfksFwyN6KVwL5RQKMl9rR0KudJYjMCMXsVd2gaP3nKja/aG+Ug6nQLQxp0XG8kvtPg5trRfEcSrRGkSbgbDsytyvSWMLtC3UXmDPVezDpy1kc= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(86362001)(81166007)(36756003)(5660300002)(316002)(356005)(6916009)(54906003)(47076005)(8936002)(186003)(44832011)(16526019)(82310400004)(2906002)(26005)(40460700001)(508600001)(336012)(426003)(70586007)(83380400001)(8676002)(4326008)(70206006)(36860700001)(2616005)(1076003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:03:45.1582 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a41851e7-9f91-4fc6-238c-08d9bf5e5cbc X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT066.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1201MB0130 Received-SPF: softfail client-ip=40.107.220.71; envelope-from=Michael.Roth@amd.com; helo=NAM11-CO1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Helge Deller The CDE desktop on HP-UX 10 shows wrongly rendered pixels when the local screen menu is closed. This bug was introduced by commit c7050f3f167b ("hw/display/artist: Refactor x/y coordination extraction") which converted the coordinate extraction in artist_vram_read() and artist_vram_write() to use the ADDR_TO_X and ADDR_TO_Y macros, but forgot to right-shift the address by 2 as it was done before. Signed-off-by: Helge Deller Fixes: c7050f3f167b ("hw/display/artist: Refactor x/y coordination extraction") Cc: Philippe Mathieu-Daudé Cc: Richard Henderson Cc: Sven Schnelle Reviewed-by: Philippe Mathieu-Daudé Message-Id: Signed-off-by: Gerd Hoffmann (cherry picked from commit 01f750f5fef1afd8f6abc0548910f87d473e26d5) Signed-off-by: Michael Roth --- hw/display/artist.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/display/artist.c b/hw/display/artist.c index aa7bd594aa..21b7fd1b44 100644 --- a/hw/display/artist.c +++ b/hw/display/artist.c @@ -1170,8 +1170,8 @@ static void artist_vram_write(void *opaque, hwaddr addr, uint64_t val, } buf = vram_write_buffer(s); - posy = ADDR_TO_Y(addr); - posx = ADDR_TO_X(addr); + posy = ADDR_TO_Y(addr >> 2); + posx = ADDR_TO_X(addr >> 2); if (!buf->size) { return; @@ -1232,8 +1232,8 @@ static uint64_t artist_vram_read(void *opaque, hwaddr addr, unsigned size) return 0; } - posy = ADDR_TO_Y(addr); - posx = ADDR_TO_X(addr); + posy = ADDR_TO_Y(addr >> 2); + posx = ADDR_TO_X(addr >> 2); if (posy > buf->height || posx > buf->width) { return 0; From patchwork Wed Dec 15 00:00:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676971 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D1D5EC4332F for ; Wed, 15 Dec 2021 00:17:18 +0000 (UTC) Received: from localhost ([::1]:53748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxHyv-0002qv-83 for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:17:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51346) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHmj-0001gY-OY; Tue, 14 Dec 2021 19:04:41 -0500 Received: from mail-dm6nam12on2073.outbound.protection.outlook.com ([40.107.243.73]:33504 helo=NAM12-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHmh-0004lq-As; Tue, 14 Dec 2021 19:04:41 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xxn/LozB67Zsi09UrICoeJOayp0yGUfBBDenaZkHJviGzgLCrJS+LlIbH2FBNGnVb0L4yo2EYVaeqTioEiX4AUDgHtu0jsJAbZD+cmBcgPextB19xsGK3O7ZEaKcqJ+opp38qM85MDURkEf/V5Y+JsW9OSnJJeo9CQodT99ZSxsQ0rp4CC0i4TbjIY/+9WFbsE8NvZ6kkzFJzGga/AOxLbH/1QggbjtBUvKMkZUTviMkCiGdTNx3AUgbcS4oYem2enVdsiAWQai7GIpEbED5Mwl5vCLWOweAG7vVHkPl3Z8mUtK5OPNiNP2mo0qCXBbIDXHu2KRZdI8pF2bwEtUPpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=B0Fdq9gaIvjbxByobVgBu/1V705dm/0Olz6VpF8lEAY=; b=ISCFUxfBCRxg76C6vxIiTg6wf7lPNiISJmnCvV4/h/WGOCEK7Xmh48fO1FR7K69/tunW7qaIbnOYZ4WIfKY6/0EAb8jDJuiaHdIMIDT1UXUz8n7XF85DnWPgQOAcMpxs3t+Dy72qsk/KUuYxRZ0BdqCgwPB8L0IAkP660YZ8toEk8dRyHJ9SdMnxR1VFVAO7Txea3SBc+q9aZ4f7l0ZeOfntSvcnqY3WV5DfQyN/aiom+AnfG3eskuS+Tv/IZ+PfsmWtzGp7ZZr2wCxchcLg359VTqcKC9FBQwEC4rrR7t8FgnLj8lriBMPOtrVss5sUQo5i1wbhzAj5zeY/2B3SnA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=B0Fdq9gaIvjbxByobVgBu/1V705dm/0Olz6VpF8lEAY=; b=OXoiOtLBJpaYzjftx1vthlqzrxm8o2zCih1xPOO/OTL92SjkBoL0GSqfpMgFYJAOepTnHFiHge9wBvMIEYfiUG4YEioADr1leXWFyHbc6ew+u+OmtrJ/nDI+oL81bcZd9XqMxCzOkFAKZu96iBoloJW13N/6koyU3N4grrh2YCM= Received: from MW4PR03CA0154.namprd03.prod.outlook.com (2603:10b6:303:8d::9) by MN2PR12MB4437.namprd12.prod.outlook.com (2603:10b6:208:26f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 00:04:32 +0000 Received: from CO1NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8d:cafe::2b) by MW4PR03CA0154.outlook.office365.com (2603:10b6:303:8d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:04:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT023.mail.protection.outlook.com (10.13.175.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:04:31 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:04:26 -0600 From: Michael Roth To: CC: , Yang Zhong , Eduardo Habkost Subject: [PATCH 11/47] i386/cpu: Remove AVX_VNNI feature from Cooperlake cpu model Date: Tue, 14 Dec 2021 18:00:49 -0600 Message-ID: <20211215000125.378126-12-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ea218974-bad1-49e6-2211-08d9bf5e7856 X-MS-TrafficTypeDiagnostic: MN2PR12MB4437:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:348; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YW7OgbRVopnAsPRyWYokNhyX9s9hcDuXZJRvW+puhlF+267BsPXV52wJDLKBkuPJZwcoc+moBws+PvDQGrmggoDXE9nOotbJrDBDV4mX6jFeA1KKx5DdzOrX5o5ThnisUCCsEbNPeVj2lafhmbLTnQc4fO1DopfChcSiM9nPcvTLdORFi3qbvsPCchjlVcNdVMHDzZpdlvooLmTanKT584Pb3RXydlBaJeRtIfUDnKf+fl/uL4C/mOzt02BStikG6rYaJkqULbzwkPEzhAud+muSbDmJKN5HQLj2NaA6Ccsmp92eEjck1MarMec7d8+UQMEjRwUqwKJ7ZOh1011INAvoC7Oo9MchW3FRkXYQ/dEm6HipiIE0ClaSi9x1Z4B4HenIrujl7os3wxAl6YZb53w3mzdqLPq9mcAs0zLHbkPb6gGs09CJfCLquCY5uLU7R6/ObUMw6xINexk+duoptVN1QZzKCmZWcvyRc5hoB2zj7AGeahgByGXkOcQZIZDite9dPd+RJLagFJDIHdkLIvknz5J0NU4eZNQzpwYACviKw18ZDINpRESMi+AoxWZKYlfqnoeiT5AjL46bY7OfulVOgYrUxnesPWJr2mDkoIXNK9vWdX8sncBvX56BN3CZede2Coq/pxpddFaMy5dRo0Mi3F7MgJyZNw0BzsfPZy2qJNPWdCzddN1Jd4HiC9Qnti/rCgYB3QDXLo33vi1CNGgBAcbM9fsGl8vpwv/AtwMYtZnvdoGBnNi41RMabFIPJu6zJaD+oGmPX5n9hSeAKXxoOoOPBea+ctvcDvGKuKc= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700001)(16526019)(186003)(1076003)(2616005)(54906003)(81166007)(2906002)(86362001)(36756003)(47076005)(6666004)(336012)(6916009)(40460700001)(26005)(8936002)(8676002)(316002)(44832011)(5660300002)(83380400001)(4326008)(36860700001)(356005)(426003)(70206006)(508600001)(70586007)(82310400004)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:04:31.4815 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ea218974-bad1-49e6-2211-08d9bf5e7856 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4437 Received-SPF: softfail client-ip=40.107.243.73; envelope-from=Michael.Roth@amd.com; helo=NAM12-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Yang Zhong The AVX_VNNI feature is not in Cooperlake platform, remove it from cpu model. Signed-off-by: Yang Zhong Message-Id: <20210820054611.84303-1-yang.zhong@intel.com> Fixes: c1826ea6a052 ("i386/cpu: Expose AVX_VNNI instruction to guest") Cc: qemu-stable@nongnu.org Signed-off-by: Eduardo Habkost (cherry picked from commit f429dbf8fc526a9cacf531176b28d0c65701475a) Signed-off-by: Michael Roth --- target/i386/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 34a7ce865b..24ddc5b926 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3102,7 +3102,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { MSR_ARCH_CAP_SKIP_L1DFL_VMENTRY | MSR_ARCH_CAP_MDS_NO | MSR_ARCH_CAP_PSCHANGE_MC_NO | MSR_ARCH_CAP_TAA_NO, .features[FEAT_7_1_EAX] = - CPUID_7_1_EAX_AVX_VNNI | CPUID_7_1_EAX_AVX512_BF16, + CPUID_7_1_EAX_AVX512_BF16, /* XSAVES is added in version 2 */ .features[FEAT_XSAVE] = CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC | From patchwork Wed Dec 15 00:00:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676957 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E0489C433F5 for ; Wed, 15 Dec 2021 00:08:53 +0000 (UTC) Received: from localhost ([::1]:36152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxHqm-0007Ws-0D for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:08:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51506) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHmw-0001sx-O1; Tue, 14 Dec 2021 19:04:56 -0500 Received: from mail-mw2nam08on2061.outbound.protection.outlook.com ([40.107.101.61]:59232 helo=NAM04-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHmt-0004oK-Nk; Tue, 14 Dec 2021 19:04:54 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F04DBiHICOUmaFQM/nw1p8F3NtxUqmwBtqmST2cDELSe8thwmuSYnSn9++hgzSQFF0VJ1T7rJnrxDz3gS/1Bo18qjM+I2U+dDPUD4gP10ykSwz2KV9sSSvlWzDjlQWOXRtH7/rE6BFHs94ZDhT4FYKuMTUfZALvN3duNujFEwwNrtgWU66F0iyegXNzjGEwaTLbF/haOJC8G7bJ3D/luUvSgEl/VNZghbYGZ/rNuFTLQoO2wxU4f2/rLl0r7KMPqPZgc1QZKG84uwaeVuQ+lgLLsK9E1NBSOuOlk79lpoTdXfvANAF5pHoJ+ahpJtgxuihCwzel6niV4orfbf/K7GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tMHAMcAfoDYSZ3VgkuMOaB+k7trTeXTsoYQqxf0JJaE=; b=c5OtKlCWaG16jyRM4xWIYp0b9oYwLb4tvGNrywjSrPqmD1RTSmXm0A59/Os2vS0aqOiSXbHxONEt2GyDDlF+hzB1IDuMhriuupHfAhxzHsyz/Jx3xULAf8IyaGe7A7jS4YMO4aN+OC8xkA5hHaaeXVOICDL+alKI3vXq4nY2F4IipjPobqzDgLFZ+5GIRE6j5qV+Ct4LSPg3LaMKwuqaorbUILMumv9HANwhUoVlOmjs2uW/00PkyRCsjmqOC6U6E4oDf75NGVeIcovkSe3MAW0jQ75alYdWt1xwSFLiUSFSdd8IrX9rEqydckzH3OJQrmEGyUxG8Lf/PpJRDfxacQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tMHAMcAfoDYSZ3VgkuMOaB+k7trTeXTsoYQqxf0JJaE=; b=AHyAubVFXtUlIk4aPSDydHX6+G3GNCPm8dUlB4xwgUU5a+tShel1A8uUm7RF8AWese1Jdl+nNFglT97ImsQMJqRLGxj70H1fJzBw6ednuT9LAjCKHSrE/P1sp5xiVj+7Awn5WfWyEQ3SvBgkFiNRYy6zClb/l6N5TkHD4MAyb6o= Received: from MW2PR16CA0060.namprd16.prod.outlook.com (2603:10b6:907:1::37) by DM6PR12MB4171.namprd12.prod.outlook.com (2603:10b6:5:21f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.12; Wed, 15 Dec 2021 00:04:47 +0000 Received: from CO1NAM11FT048.eop-nam11.prod.protection.outlook.com (2603:10b6:907:1:cafe::56) by MW2PR16CA0060.outlook.office365.com (2603:10b6:907:1::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:04:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT048.mail.protection.outlook.com (10.13.175.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:04:47 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:04:46 -0600 From: Michael Roth To: CC: , Christian Schoenebeck , Greg Kurz Subject: [PATCH 12/47] 9pfs: fix crash in v9fs_walk() Date: Tue, 14 Dec 2021 18:00:50 -0600 Message-ID: <20211215000125.378126-13-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0807857c-a4d7-4765-5771-08d9bf5e81bf X-MS-TrafficTypeDiagnostic: DM6PR12MB4171:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:182; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: boV7ra0/o6N/QxV2PvRQW6X7s/cq7XHIDeACij7qUaokmlyaC/IG9awdIfHtlAfM0BnrvB3iRuqSLL+GccfH+3krcNlVv03vSm4MPV35oyYdliWXFqY41WqyKUjIox2uWKVN9TcSfA5ANp9f0R73kPffTJ+z8y98l8+O9DEPY7ODWIwMfljH/E5FLomEwj25P3cwFnEQXgDI8w9MsRvAFDcJ5pt4pJTqIMDqcMJr7pqvnTtjKXExlAAPNJjgutxSGIsWllQpZBJx82SAJYoqwEMsZPiyL7ZoKRf2/a/DnTozx4A2TnAdQwsVHf3lRdQcievVuueK3h/OdxrDl94BCqVNRE9OfS4AKFpWlfxfaGwrwtjih5dr5gAPCmD8y2z2e5nZrTKywY9oNgW4dWwIEnOR53ur1YK3Foq+q3ln96i5OhjghqiLeEE8d0fYrpSb7UUldO6/sxoOfx59sRZPh2io9CXzTwv05kAahxN8KGzS8SkYDzBLsswrWcci/kjRZpLXbZt02lQvvKA68I9cSOs9sGox7GqZxYVDVuQtGlIczBsDsvq8W+nObQKpeMzh/ZRDniAGSDcMmDwbnz/aE+GaxvNIkSzN6aMpw12PQYsFTeHEHf30QK1memSILkiID9fDwu/fJbzSaiRWZ+f9CgwRHDUpUMPsmsjPtW6TiZns6XvnCkrK/dMJvq/zlQtTX9xGG66mPw6oGMgsOEqaSiUnWdIxzvTfWIqICt39LB8Lus3G5xdCrv9ECYPOtMMnHObmDtHgV3OS1PlY0cEZt4cZRvTqL/K+oaCTwLhomW3zA8EpFGnTDs5gsfxBIP7Z/erp/DIkm2PKnelpNSgvEuw1coEcgC3QxT4hsT6BN5JVb2vaXTMCndJuOmKvLT4p X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(54906003)(70586007)(40460700001)(26005)(186003)(70206006)(36756003)(16526019)(5660300002)(356005)(2906002)(508600001)(426003)(8936002)(36860700001)(966005)(83380400001)(86362001)(81166007)(2616005)(316002)(44832011)(1076003)(8676002)(47076005)(82310400004)(6916009)(336012)(4326008)(6666004)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:04:47.2705 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0807857c-a4d7-4765-5771-08d9bf5e81bf X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT048.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4171 Received-SPF: softfail client-ip=40.107.101.61; envelope-from=Michael.Roth@amd.com; helo=NAM04-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Christian Schoenebeck v9fs_walk() utilizes the v9fs_co_run_in_worker({...}) macro to run the supplied fs driver code block on a background worker thread. When either the 'Twalk' client request was interrupted or if the client requested fid for that 'Twalk' request caused a stat error then that fs driver code block was left by 'break' keyword, with the intention to return from worker thread back to main thread as well: v9fs_co_run_in_worker({ if (v9fs_request_cancelled(pdu)) { err = -EINTR; break; } err = s->ops->lstat(&s->ctx, &dpath, &fidst); if (err < 0) { err = -errno; break; } ... }); However that 'break;' statement also skipped the v9fs_co_run_in_worker() macro's final and mandatory /* re-enter back to qemu thread */ qemu_coroutine_yield(); call and thus caused the rest of v9fs_walk() to be continued being executed on the worker thread instead of main thread, eventually leading to a crash in the transport virtio transport driver. To fix this issue and to prevent the same error from happening again by other users of v9fs_co_run_in_worker() in future, auto wrap the supplied code block into its own do { } while (0); loop inside the 'v9fs_co_run_in_worker' macro definition. Full discussion and backtrace: https://lists.gnu.org/archive/html/qemu-devel/2021-08/msg05209.html https://lists.gnu.org/archive/html/qemu-devel/2021-09/msg00174.html Fixes: 8d6cb100731c4d28535adbf2a3c2d1f29be3fef4 Signed-off-by: Christian Schoenebeck Cc: qemu-stable@nongnu.org Reviewed-by: Greg Kurz Message-Id: (cherry picked from commit f83df00900816476cca41bb536e4d532b297d76e) Signed-off-by: Michael Roth --- hw/9pfs/coth.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/9pfs/coth.h b/hw/9pfs/coth.h index c51289903d..f83c7dda7b 100644 --- a/hw/9pfs/coth.h +++ b/hw/9pfs/coth.h @@ -51,7 +51,9 @@ */ \ qemu_coroutine_yield(); \ qemu_bh_delete(co_bh); \ - code_block; \ + do { \ + code_block; \ + } while (0); \ /* re-enter back to qemu thread */ \ qemu_coroutine_yield(); \ } while (0) From patchwork Wed Dec 15 00:00:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676963 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0C7E9C433F5 for ; Wed, 15 Dec 2021 00:12:46 +0000 (UTC) Received: from localhost ([::1]:43354 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxHuX-000471-Rc for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:12:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHnL-00020B-6z; Tue, 14 Dec 2021 19:05:24 -0500 Received: from mail-bn8nam12on2081.outbound.protection.outlook.com ([40.107.237.81]:16743 helo=NAM12-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHnF-0004qs-Di; Tue, 14 Dec 2021 19:05:18 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pklm5/wBi1r0N16OmTi5wZejhTmQi7G859sZCE1sBKGpc3nF3EwPY0ORSeglV2AU+4dkwdNz/Ut0NYW0/auGaUTuxPcZzL4Rtw/S3vx32GVrKz4c49pkVfOS28RTw4xjdyWqmpvxcI1ps08csaAz6+Hj5x5ZT4r4tH1KfSNyGD4TND5jsGn7B0AfbYq/c72+bNO5banYACu8VFUDgmVsSjA9pfbf8onyFj9f6s8LjVDMkLn7UkKIswUUbMbSc6gu1pSFdPuOLmeI+eehTvwvnS3QgyrG0IB+5lsVecFs7/mRlJvl5sRtV63MxXPugXPoS/fRUISU5t376Ve/8RXDPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SeaOXCnm9IgN1WtX3R7sq3RUXWdT/zLa7akmq3V8HnY=; b=dnQBiTCdgL8NrQpp6E9FPWKT4yQFMv08PSwQgw0nF/JkGEYw3KAbzzeQVQSyQoD670q9T11bYYqhCosRX5iGzYAek2ECotxHQO9aKA7/o9diVAo4Q3G2wM9HfMJLpbVOi5jCYQ1EqcDLJAr88zyj4rYmkKQe5cg42AHb3oop+pIgCBZOya/knN4RHzXxW4elU1dk3MjAX8wUxWexeF0EQuonTptIfknmRbDZJqEkvKgX2WRmGdM9LgSyITNrIEHmzDFa1+ovcQm6M5AffSehYFLlk5/oJ8CHbrvolG4oXCaGpeKokcibzTFq9Ej7D1maeGgIOpLlw0v/hVgA1Pn8Mg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SeaOXCnm9IgN1WtX3R7sq3RUXWdT/zLa7akmq3V8HnY=; b=ttnZ+xJTc/5uzJBIhT94ICVv9EpK7PIPm9kmiiNqNJN0GsQ4Cr52IX/k3vGJ4RU0zH9fMiBCQ8d6fayy45aA6Ek7e1pi+CMLIW2RURnMNdOn/gwmjlalxqwN/2Do97xzLsLmWnmIYewrOHc/40B0ID4lzihcvjuwMcV+V1yiukk= Received: from MW4PR03CA0040.namprd03.prod.outlook.com (2603:10b6:303:8e::15) by BY5PR12MB4210.namprd12.prod.outlook.com (2603:10b6:a03:203::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16; Wed, 15 Dec 2021 00:05:08 +0000 Received: from CO1NAM11FT007.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8e:cafe::e5) by MW4PR03CA0040.outlook.office365.com (2603:10b6:303:8e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.15 via Frontend Transport; Wed, 15 Dec 2021 00:05:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT007.mail.protection.outlook.com (10.13.174.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:05:08 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:05:07 -0600 From: Michael Roth To: CC: , Mahmoud Mandour , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PATCH 13/47] plugins/execlog: removed unintended "s" at the end of log lines. Date: Tue, 14 Dec 2021 18:00:51 -0600 Message-ID: <20211215000125.378126-14-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6444326d-ac21-4420-fa7e-08d9bf5e8e29 X-MS-TrafficTypeDiagnostic: BY5PR12MB4210:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:41; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FWy5oQwQhpwhGc3e/exN1Hfr01wkfYqRbn4s/gC3jLA4S87B9k7LRkE4qiC9tWpJnv+LWLUWFVnMO4H9OPDvZju0zQ0QvL2xV/zcZJ8MVIDqQOXUoZtDjGjkinEbjEzZUVH7HZr9SbOs2LczRF5TmX50G7R7/wN9IubcvTEGlHDe2+3RzcqTR77nd4Jz+xGI+ERUO0qk2bSKtO1Q5ws7K7MRCLqtnjrRduxWgiVdNIyPkeWCvnMzemxtqlGLDz1VNh1DVC2qvoEyAWOBPMPfx10Yhr1pUsQsIGn0O2OuCw4XaBwJyo9UYyccM4SloZduLPz0ikF8kLvtK2iWYmWD6LHqNx50uyOasxE8AriXscT9ssD7juiZ+Rm7LT1JOc0JPSmdg0Diyqmn8+ku2st3OQ3ltq9T+8+5K9RENS1PoGcDYCFW+8ow9GxxBuV6LRQ9yJDTdf7Vnsi3+5VQQHhzSA84UHwt5jMoeJVVL+Fj4AFiJohEqpkqxs1rhegIp++3xRdbI+Ohq8stSqrVpW+qvdagZ7DCWr3M2b38l0SQbjD/X7efpbmO68cSqaEiZ/oI7gfSgeys1LAWyJA1hc+UEBfzG7SqUyDe9zbgy4VLHZESCr/XX2CqYd9z4GTm5PAkWcfIqCsSTN1OtW2dlh1uoN2oFlYHV6011mc2T//b/Ok4rAm48WKQbbEuKCqG80AmEBRYr7u/i55dx3VTZk2Sh+sd4TLZ7wiRYmMvxJ2t9KBJKtI8wh04uzK8V52WFd/lgTrl4i07PiiCWS1DGHuQR3G5SX9uGsd3qk25mYm31vg= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(36860700001)(5660300002)(4326008)(508600001)(8676002)(47076005)(316002)(4744005)(44832011)(81166007)(2616005)(6666004)(66574015)(70586007)(426003)(1076003)(26005)(336012)(16526019)(186003)(40460700001)(36756003)(54906003)(83380400001)(8936002)(2906002)(70206006)(6916009)(86362001)(356005)(82310400004)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:05:08.1045 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6444326d-ac21-4420-fa7e-08d9bf5e8e29 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT007.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4210 Received-SPF: softfail client-ip=40.107.237.81; envelope-from=Michael.Roth@amd.com; helo=NAM12-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Mahmoud Mandour Signed-off-by: Mahmoud Mandour Signed-off-by: Alex Bennée Message-Id: <20210803151428.125323-1-ma.mandourr@gmail.com> Message-Id: <20210806141015.2487502-2-alex.bennee@linaro.org> Cc: qemu-stable@nongnu.org (cherry picked from commit b40310616d2bd550279dd22b05483c3c613a00ff) Signed-off-by: Michael Roth --- contrib/plugins/execlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c index 2de9f0d7d4..a5275dcc15 100644 --- a/contrib/plugins/execlog.c +++ b/contrib/plugins/execlog.c @@ -67,7 +67,7 @@ static void vcpu_insn_exec(unsigned int cpu_index, void *udata) /* Print previous instruction in cache */ if (s->len) { qemu_plugin_outs(s->str); - qemu_plugin_outs("s\n"); + qemu_plugin_outs("\n"); } /* Store new instruction in cache */ From patchwork Wed Dec 15 00:00:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676959 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E67F5C433F5 for ; Wed, 15 Dec 2021 00:11:07 +0000 (UTC) Received: from localhost ([::1]:38936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxHsw-000116-Nv for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:11:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51700) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHng-00027u-AA; Tue, 14 Dec 2021 19:05:43 -0500 Received: from mail-dm6nam12on2076.outbound.protection.outlook.com ([40.107.243.76]:25056 helo=NAM12-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHnd-0004x2-U9; Tue, 14 Dec 2021 19:05:40 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L9dUJqquZ+i65i0WBOsprquF2CdmQlINaa8lx3OHVB9SLRejAp1KweSBEipM4zIn5p2Xn923A48dFxYY2f3yA3aXhFTxN1FaaAOdHyTxjAvourCLXKDW3U5/6CybvYyA+ePThptE6jnpmkF8QZBvlBfEulYR+IAtSq/10lWrzjwrwbsIz5LREszGdMEXaisD7i3yhsmi9sBONjretkFIL+FY8irFyZ3/RBZMowbbFIIlmYgg9tquVvy9npqYAeRcjUBjApadFwDQPtXVhtoOJojJXOMABRDNBH++gMlDGu8tMlxoWA0oS5DRQ7TKZUl7309ALABo5kKo52Tmm+Cs1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PL2Fdo3wsZ5I2F1oEIRNaFaaXPvQiwop93qVTHcORUQ=; b=jrdy7lsZChOCTqtqpG5ZvSaaNXT6s6TPsD7dvJsLuBdvm3M4FCqe17Sv+lgZa/IyqVgKoRWrVa4Yl+qHhD9oBxlRoSZ/GBuy7yL1xURunJ+bTneZxJQ3AqxQBMbumdRHFdON6CIcv0LdwlTNONdSRvqUrzd/rbr3a7cGEKXyWt2+NvbLL90Tk+2nO1W1ytxXWYUlTF0nQJvnSizrR4SRD4NJpw69L/+imE7E5U2fZYG+h2IFamB3FEbv3Ou1Lfr1xLwQVJ72QLt4lqXWL25LimdAzyb+tfZMcSkjNVrQ1+XTO3NNN2/r5dlfeYqt9DGMvsttpkfs+WxE2xqg7U0HZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PL2Fdo3wsZ5I2F1oEIRNaFaaXPvQiwop93qVTHcORUQ=; b=UzU8rXJwu7ysR7pNtjNsfhNaumvNQTQewz6874YLw7LItRfMNbNJ/oERD2IxWX/CIQ2gtovAxKJBfpaWzfIlBRjZfEXGHICY8UfDnVMo5kQAv6gzeGMxzi1yQUe3XDXLB028o560H4zjwPHquLWby+X/Tv5V4EO29GnPk8WDczQ= Received: from MWHPR18CA0032.namprd18.prod.outlook.com (2603:10b6:320:31::18) by BL0PR12MB4609.namprd12.prod.outlook.com (2603:10b6:208:8d::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 00:05:30 +0000 Received: from CO1NAM11FT038.eop-nam11.prod.protection.outlook.com (2603:10b6:320:31:cafe::2a) by MWHPR18CA0032.outlook.office365.com (2603:10b6:320:31::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.14 via Frontend Transport; Wed, 15 Dec 2021 00:05:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT038.mail.protection.outlook.com (10.13.174.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:05:29 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:05:28 -0600 From: Michael Roth To: CC: , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PATCH 14/47] plugins: do not limit exported symbols if modules are active Date: Tue, 14 Dec 2021 18:00:52 -0600 Message-ID: <20211215000125.378126-15-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ac2c4095-1fd6-46f9-64d8-08d9bf5e9b1c X-MS-TrafficTypeDiagnostic: BL0PR12MB4609:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2958; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KMiOfwMMImjx/ygXpDk4GVyza6X61Dt3WZ9vzNhwDdreri7G/PfQ7qvrtHS732c4VZENlMYAM/rnVRqIWCALLXW0xD3PRaqBdf208h4O41DPvGAO/y+TziXPk9v6Hy57Nls8ddsWE9ij37q0pPHe5xVSVLOEQgx93j+gXrYwJSFLB9dlBbPgAcE6QrHAMI7Liien7MMMYXTeQzvoC0dbXegXOqr/7di4VgZW+a50ioGnRNQrCaiyj6N5sFtHtX5hCLnM3UTs+gefhP2GmwRJyyOH+SRmI63xbih5iF0AmR6oJFoEe1QCADtzHXByEv26owsuPOpYT9Li0dbOA2j5W/vdmfQwnFdk52T/6hzODIUunhXnEoyq20i+J7fBBy5iTaFEuAldhAE75KirGbN1+rIGu0q1bOoV5Z8oNvP602ERTBC7WnKPxc7VMtuJQIYgXgzwxzgkVnZPwlPLEt7VlArw1yOwejX7LCEtau1A45+VenvM7QYRQcpTb+6J5OmDvINp++9IYf7trtVxAdYqojpXPkGrioa7VCVeFkOg4FeXrwQDpfu2YJ+ofw/mgaUT5fijIpvsx7z8W/ssGUxGQR1wIv5IqFbyfBG86dy1LZzR2NyS7872C0H8pDtwfizmkejg96XWrGfbxqQW2GWPP38cnX3IpfwZawkURJQkcOqznY5A0FF6hLn+98UAKPDPV5VTLen0Jf5VDstUyFvvcs/zPTCEua2RpYsRLPei6nS/sy/Vb5JLcCiXih5k3SWBOjA8HES5YOlkhU3+K1D/ePR175WmFmKXr3YaWTBnNzGgUQLu7VeNssbIxWUss5kEswKF+khTwD2kuW0rrIXxKTuQoFunHVB9C0CjPeuI4oQECA7klCCQVX4e8UofPaOB X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(86362001)(966005)(2616005)(1076003)(54906003)(4326008)(36756003)(26005)(8676002)(5660300002)(186003)(2906002)(40460700001)(6916009)(6666004)(8936002)(336012)(44832011)(83380400001)(81166007)(356005)(36860700001)(426003)(82310400004)(316002)(508600001)(70206006)(70586007)(47076005)(16526019)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:05:29.8077 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac2c4095-1fd6-46f9-64d8-08d9bf5e9b1c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT038.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB4609 Received-SPF: softfail client-ip=40.107.243.76; envelope-from=Michael.Roth@amd.com; helo=NAM12-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini On Mac --enable-modules and --enable-plugins are currently incompatible, because the Apple -Wl,-exported_symbols_list command line options prevents the export of any symbols needed by the modules. On x86 -Wl,--dynamic-list does not have this effect, but only because the -Wl,--export-dynamic option provided by gmodule-2.0.pc overrides it. On Apple there is no -Wl,--export-dynamic, because it is the default, and thus no override. Either way, when modules are active there is no reason to include the plugin_ldflags. While at it, avoid the useless -Wl,--export-dynamic when --enable-plugins is specified but --enable-modules is not; this way, the GNU and Apple configurations are more similar. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/516 Signed-off-by: Paolo Bonzini [AJB: fix noexport to no-export] Signed-off-by: Alex Bennée Message-Id: <20210811100550.54714-1-pbonzini@redhat.com> Cc: qemu-stable@nongnu.org (cherry picked from commit b906acace2d4f68b6ff8de73739a773cc4851436) Signed-off-by: Michael Roth --- configure | 5 ++--- plugins/meson.build | 14 ++++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/configure b/configure index 9a79a004d7..7659870810 100755 --- a/configure +++ b/configure @@ -3187,9 +3187,8 @@ glib_req_ver=2.56 glib_modules=gthread-2.0 if test "$modules" = yes; then glib_modules="$glib_modules gmodule-export-2.0" -fi -if test "$plugins" = "yes"; then - glib_modules="$glib_modules gmodule-2.0" +elif test "$plugins" = "yes"; then + glib_modules="$glib_modules gmodule-no-export-2.0" fi for i in $glib_modules; do diff --git a/plugins/meson.build b/plugins/meson.build index e77723010e..bfd5c9822a 100644 --- a/plugins/meson.build +++ b/plugins/meson.build @@ -1,9 +1,11 @@ -if 'CONFIG_HAS_LD_DYNAMIC_LIST' in config_host - plugin_ldflags = ['-Wl,--dynamic-list=' + (meson.build_root() / 'qemu-plugins-ld.symbols')] -elif 'CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST' in config_host - plugin_ldflags = ['-Wl,-exported_symbols_list,' + (meson.build_root() / 'qemu-plugins-ld64.symbols')] -else - plugin_ldflags = [] +plugin_ldflags = [] +# Modules need more symbols than just those in plugins/qemu-plugins.symbols +if not enable_modules + if 'CONFIG_HAS_LD_DYNAMIC_LIST' in config_host + plugin_ldflags = ['-Wl,--dynamic-list=' + (meson.build_root() / 'qemu-plugins-ld.symbols')] + elif 'CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST' in config_host + plugin_ldflags = ['-Wl,-exported_symbols_list,' + (meson.build_root() / 'qemu-plugins-ld64.symbols')] + endif endif specific_ss.add(when: 'CONFIG_PLUGIN', if_true: [files( From patchwork Wed Dec 15 00:00:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676969 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AAA17C433F5 for ; Wed, 15 Dec 2021 00:16:54 +0000 (UTC) Received: from localhost ([::1]:52322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxHyX-0001sG-NG for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:16:53 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51802) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHo6-0002HM-0J; Tue, 14 Dec 2021 19:06:06 -0500 Received: from mail-dm6nam12on2052.outbound.protection.outlook.com ([40.107.243.52]:34081 helo=NAM12-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHo0-0004zF-PB; Tue, 14 Dec 2021 19:06:03 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Oz3S2zaFjnrZTHpcm5n9/VVU8ctVBFQ+WRPi2dph6ogDZmlVTomQCR9k5m6cU7d0QkvIRmTc2MpTXuHoR+xIicoyQH3Cy9WqJkSsiDiSvCijCgRojfP0+lSxZL0t+bIu4avsFPGT1oKgfD6inuuScvIDzGNNk9s/faMBbcjJ/SVX6kRx31ls5hJk0rzXK4LYAnOUZKkPyaTKCJcYj1bvmoDpblWIHoISfKBg09bQCkUf4Gkn7i3R1MkhW4Ma6j/w+/Zb6P3+/zdKFtYZriiLD1SpbDtIULYZXzVYgVmGFMtJY1TcXjw233LeDpo/4FU2pnJjNjq7lq5gP5v5bX5vgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BOPHl9TZ4xavFvMc8UO3kmxtOBeNhkMLiGz0TtDChdc=; b=M50MykweA9/cOlJxTp9LsuPyGTVO04PpufRq2wfkFX3QdavpEe4POEqKGu36onolbZ5aGQ1BckEsJLXJ/I/+W7tkqFgjSaZfaWCCxE3Df62QyfH3MM8CAwygc/LEUDL9XgkYgaVmBrfmYCZlpCrcAM2ZQx9OISJIZmp4CEK71452V8t4bWG5ZyuF2kFkjH9XGf48v1rwUURQKoFMYQE4dEmrXrzzYEtxIDYeIAb/eUUnjwUbO+662usf/UL4XKiKwbvzGIcLqlHuTnM6O1Fcl5c+0FTQIv2fph/7aCF0T0srhrftTxbckqN9CsYwSp8aar/XZu+fUNB6QZNt5OVeTg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BOPHl9TZ4xavFvMc8UO3kmxtOBeNhkMLiGz0TtDChdc=; b=EMvXDRtxI3lilanNiejucEY3XkJ8lv56NlNVzP+KnI6hLhnwHHIA50f36rgWsJK+fR56CQiJMjYlsaVeonZ8gG1KKjMnVhP6kBYSkmnYy9fBinwj3jtEBCbaG4mPA74Jahm5pBqJLDlvy26S6wjDMOG0MTC1kYtZ4VAVH7hpvYk= Received: from MW4PR04CA0143.namprd04.prod.outlook.com (2603:10b6:303:84::28) by DM5PR12MB2533.namprd12.prod.outlook.com (2603:10b6:4:b0::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.15; Wed, 15 Dec 2021 00:05:52 +0000 Received: from CO1NAM11FT030.eop-nam11.prod.protection.outlook.com (2603:10b6:303:84:cafe::d6) by MW4PR04CA0143.outlook.office365.com (2603:10b6:303:84::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:05:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT030.mail.protection.outlook.com (10.13.174.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.16 via Frontend Transport; Wed, 15 Dec 2021 00:05:51 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:05:50 -0600 From: Michael Roth To: CC: , Michael Tokarev , =?utf-8?q?Da?= =?utf-8?q?niel_P_=2E_Berrang=C3=A9?= , =?utf-8?q?Marc-?= =?utf-8?q?Andr=C3=A9_Lureau?= Subject: [PATCH 15/47] qemu-sockets: fix unix socket path copy (again) Date: Tue, 14 Dec 2021 18:00:53 -0600 Message-ID: <20211215000125.378126-16-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8a748a26-2e47-4f1e-d56c-08d9bf5ea7eb X-MS-TrafficTypeDiagnostic: DM5PR12MB2533:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1227; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AASTR4e9QnxcKI+Le0f5Vtp8+3BgHm29SN0JkTGECHrgD+lN04b/1XsEEVmXGaU9NdeQz/o0lYXfCsasc5PR+GJ1X5Iv30eZovG2rIxixpGka1HFQw72dvSFu4basExobemh+DYZSgUp1jbOzzqZFdmHn7+aGEdmrjS186FslGL59trOXTBvhssIqp5t31XNR6QPCsrWCfDQTlPXgU4/LKoAQXr3MSPYBn8/m+Pw3GGkFoHzm3hnX+VGOBbv2w9dgSUwxn3PQkE7yFWyjpJpufzQsZGjQIcSADowrP/QQqbIY1gY9hrG7lshgNu8LhmF/SMOfegeNgKqcBa9zxSZBodrVOJvQ5NKxRCGGEGKMt2zPgOQXrfeYI9haQGdY+w0zS1apifzV8IA6iWiRWca2J7Xo89ZIF5XWUoeQODiNivDjmO/q893SI1dutAEHSiu1YV7sTS1Hm5pSXtWluJCiBuuO8IO1Sv21csLpoOA2518Qe4wRBCUVMm5SZ5SfquSbo+TDJtL/9ySHiQhhPrNRkNpx2g5B8acyAp/xVcFV63Nsv+X7HWtV3uI3fWM+m9XPikjJ9AmnQ4G/npYIRVUmfU17rhzcpVz2vcVD6x+OEntBXUwFhoYSnRSR2V3A66qn0As2J6pbCE+tt8tAErdrw8C0ITRPiaPqYncBUlEJz4etBAgaFVxGcuGT0x0MxNQlEaDKWEVQKyeInWXcrTms2tGZu0eA+liE7AY43LVzuFiwxBVRtNtaRb1Im3r16HrnvOpO/L4bN7rrC5cyiUYe6CsfqEVl6sgtEqV6q2/SUwsXMPna44IWFLE9GNTV0eRERESDaiTvlYQlWR3h9dXMGY9tnePTPwFz/BVx2Tmzh+WfVNNxWTxTum8LadzGrCUDWKUZnpkQfxMrDdnp2sgIQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700001)(508600001)(86362001)(47076005)(44832011)(316002)(356005)(36860700001)(4326008)(81166007)(70206006)(8676002)(70586007)(5660300002)(83380400001)(6916009)(40460700001)(2616005)(8936002)(2906002)(426003)(1076003)(336012)(36756003)(186003)(966005)(82310400004)(54906003)(16526019)(26005)(36900700001)(16193025007); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:05:51.3155 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8a748a26-2e47-4f1e-d56c-08d9bf5ea7eb X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT030.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB2533 Received-SPF: softfail client-ip=40.107.243.52; envelope-from=Michael.Roth@amd.com; helo=NAM12-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Michael Tokarev Commit 4cfd970ec188558daa6214f26203fe553fb1e01f added an assert which ensures the path within an address of a unix socket returned from the kernel is at least one byte and does not exceed sun_path buffer. Both of this constraints are wrong: A unix socket can be unnamed, in this case the path is completely empty (not even \0) And some implementations (notable linux) can add extra trailing byte (\0) _after_ the sun_path buffer if we passed buffer larger than it (and we do). So remove the assertion (since it causes real-life breakage) but at the same time fix the usage of sun_path. Namely, we should not access sun_path[0] if kernel did not return it at all (this is the case for unnamed sockets), and use the returned salen when copyig actual path as an upper constraint for the amount of bytes to copy - this will ensure we wont exceed the information provided by the kernel, regardless whenever there is a trailing \0 or not. This also helps with unnamed sockets. Note the case of abstract socket, the sun_path is actually a blob and can contain \0 characters, - it should not be passed to g_strndup and the like, it should be accessed by memcpy-like functions. Fixes: 4cfd970ec188558daa6214f26203fe553fb1e01f Fixes: http://bugs.debian.org/993145 Signed-off-by: Michael Tokarev Reviewed-by: Daniel P. Berrangé Reviewed-by: Marc-André Lureau CC: qemu-stable@nongnu.org (cherry picked from commit 118d527f2e4baec5fe8060b22a6212468b8e4d3f) Signed-off-by: Michael Roth --- util/qemu-sockets.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index f2f3676d1f..c5043999e9 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -1345,25 +1345,22 @@ socket_sockaddr_to_address_unix(struct sockaddr_storage *sa, SocketAddress *addr; struct sockaddr_un *su = (struct sockaddr_un *)sa; - assert(salen >= sizeof(su->sun_family) + 1 && - salen <= sizeof(struct sockaddr_un)); - addr = g_new0(SocketAddress, 1); addr->type = SOCKET_ADDRESS_TYPE_UNIX; + salen -= offsetof(struct sockaddr_un, sun_path); #ifdef CONFIG_LINUX - if (!su->sun_path[0]) { + if (salen > 0 && !su->sun_path[0]) { /* Linux abstract socket */ - addr->u.q_unix.path = g_strndup(su->sun_path + 1, - salen - sizeof(su->sun_family) - 1); + addr->u.q_unix.path = g_strndup(su->sun_path + 1, salen - 1); addr->u.q_unix.has_abstract = true; addr->u.q_unix.abstract = true; addr->u.q_unix.has_tight = true; - addr->u.q_unix.tight = salen < sizeof(*su); + addr->u.q_unix.tight = salen < sizeof(su->sun_path); return addr; } #endif - addr->u.q_unix.path = g_strndup(su->sun_path, sizeof(su->sun_path)); + addr->u.q_unix.path = g_strndup(su->sun_path, salen); return addr; } #endif /* WIN32 */ From patchwork Wed Dec 15 00:00:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676979 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3530BC433F5 for ; Wed, 15 Dec 2021 00:20:57 +0000 (UTC) Received: from localhost ([::1]:37936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxI2S-0002lJ-7q for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:20:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51850) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHoI-0002OF-JZ; Tue, 14 Dec 2021 19:06:19 -0500 Received: from mail-bn8nam08on2069.outbound.protection.outlook.com ([40.107.100.69]:55134 helo=NAM04-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHoG-00050t-07; Tue, 14 Dec 2021 19:06:18 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZNTaMbQHSwI72WOrT0OFFp7ky4p1aNuslmb/rb1h9q0kPpxybVXwtXdrwbr5G2pgF2Mzcm6jcdVBfGkDke5uWVULUtPTcmKpVxkJUERubSXLq3eSr9RX9Tf6UgkCUcnmQhzF4udQGicX7ZbYeNCtlU3CPrDdM1Ry7BLTlzYUpCORAgJSnVbRCcOOhJc7Etx57FpXv9Qg5yJU3SBgNWdyulXlIwOhEaYJR8a+Y0ZE9QxWv/8rcnk5CBRMeXhrCAuzSBUCfr2IF/SUUOze2zV3svm3//y642XrdHTwY3nPU7bLZ5NGSkrPXemAF9YyL18RTVie5PogGW7TWLqKG1qxMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=N3QNsBIAAxpvtZw1T1s65QvgScHWIQWsUJXQgjEMl3Q=; b=cy+xj/o3aNHxQkFgtNh4e/jqOz3IwYsw9e+vsw0bpGG7VgZX9f5ti/T82EnkVQQJ/PthFgNxIr3lJOXJWdKtdb4NmfbdIzAxFACQg8kC/YkUuQk1GDlboR9CySkShM5cBmWBvy6/Itv6mm98ey8ck9lC8TRyoN5CoBizQIUwOMmkcZ5Ui/NhnNVfGTKVjAUZ4O4tqRXQVTAS4abEIwdzMLMuO9EZw+mtV5MQEdMZyDK6Dm0RSlrmHDdMZwdzJHwbi70elGhbBfb7bNPqVkK0XAbS2esSHIVrxuLBzp/ioYPmb7dzeauWExstEy6PfYkFEbyoP+YnZ7y8GA6xbXdJGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N3QNsBIAAxpvtZw1T1s65QvgScHWIQWsUJXQgjEMl3Q=; b=iFmITa88SBSMPrLM7ns/2000nKiP/Nkyo+vNhnOBWPuz+7MmyfA14hEEE7oRfHqw/viyRgIfSIVxoE6901vNNQCd+rgs2o+oIEekULiIdpYczmOnTUdif+ZtLD+7waDwu3SXIAlvm3zz2BXxDcF2Bv0VJoVvgxoqojoEa49rEAk= Received: from MWHPR15CA0026.namprd15.prod.outlook.com (2603:10b6:300:ad::12) by DM5PR12MB4663.namprd12.prod.outlook.com (2603:10b6:4:a9::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.12; Wed, 15 Dec 2021 00:06:12 +0000 Received: from CO1NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:300:ad:cafe::52) by MWHPR15CA0026.outlook.office365.com (2603:10b6:300:ad::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:06:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT044.mail.protection.outlook.com (10.13.175.188) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:06:12 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:06:11 -0600 From: Michael Roth To: CC: , Stefano Garzarella , Jiang Wang , "Michael S . Tsirkin" Subject: [PATCH 16/47] vhost-vsock: fix migration issue when seqpacket is supported Date: Tue, 14 Dec 2021 18:00:54 -0600 Message-ID: <20211215000125.378126-17-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 33e42a78-b9b2-4892-d6d3-08d9bf5eb476 X-MS-TrafficTypeDiagnostic: DM5PR12MB4663:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:311; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SZSAtjjRXd8gyNBBy3FGfxsabBZsSHkMlZSFxO6jNnhQj2jx7zKK6lfzkZevmWNlm0SKWOp7ajAzL2xlKt0Wjdz9J+aLLhROX47Tx7s8FMpWhkjJ5wTKFne9AwZquWOj0dGlcE5KBTOR6v9S4fuwMSWNsDOm7oeVHxgc+KG7S1BmULBjYTMfSENdrhafrUSFgaRfiJQNWV5tSG8o/vQgyhEjXr0y+vl4iMbBlaLwlkhvUz7hdrLMpMpLTLiyhQtNSin+3ADIMLjCvIps8P/HRcsCT0OFnuy3TzlecZDPkCmBYZG5nvFeOm3D/nSz4VUpy/8B70YoQWCOCiphegHaIwGjQK/VCteRIxxYlIC1GcwzFCwac2/AZAgUngEoEBFQo8MeLBOmuP8UVcdLDzs+nElAyIr/kkYiD5bd67Ph/SUra05SFmY0nwvB5WG/z/v0dCduYyI9e0MniQbr1LWEDbRXTI3mCtClCe2AJ6IlDJwOJ3leAvml33goTrPnt7hKqiWZVc+C1WBk7X//Dvl/iW+Ffk68+DeYzdo93igpo2uRe9Xn1fLWoSQl7dhlnIzUVSKPshoYqjScgMqK/0L6bGzFSh2IVQ8u8q2M+T6lK2zwcrY7P6SLyZh2QZaon5MLK+IE0yUikZzG01l6jN9Z//Hpgz7D5ajADiXUgPUH07UcAJUNcS7dAEQZdLZrvCwqGKYbvloMQyGWFkH3ZlCcdeeXkcToDU2R6i4PkKk9o3A/9LL+cc1LMrfQGkDWcPTN/WFShHsfBJ/hdeMOOI7TToPjWlQdZUCJxsaMj5yf/F8= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(336012)(70206006)(2616005)(5660300002)(36756003)(70586007)(6666004)(1076003)(26005)(47076005)(4326008)(316002)(81166007)(6916009)(40460700001)(186003)(86362001)(2906002)(356005)(83380400001)(54906003)(82310400004)(8936002)(16526019)(36860700001)(44832011)(426003)(8676002)(508600001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:06:12.3591 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 33e42a78-b9b2-4892-d6d3-08d9bf5eb476 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB4663 Received-SPF: softfail client-ip=40.107.100.69; envelope-from=Michael.Roth@amd.com; helo=NAM04-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Stefano Garzarella Commit 1e08fd0a46 ("vhost-vsock: SOCK_SEQPACKET feature bit support") enabled the SEQPACKET feature bit. This commit is released with QEMU 6.1, so if we try to migrate a VM where the host kernel supports SEQPACKET but machine type version is less than 6.1, we get the following errors: Features 0x130000002 unsupported. Allowed features: 0x179000000 Failed to load virtio-vhost_vsock:virtio error while loading state for instance 0x0 of device '0000:00:05.0/virtio-vhost_vsock' load of migration failed: Operation not permitted Let's disable the feature bit for machine types < 6.1. We add a new OnOffAuto property for this, called `seqpacket`. When it is `auto` (default), QEMU behaves as before, trying to enable the feature, when it is `on` QEMU will fail if the backend (vhost-vsock kernel module) doesn't support it. Fixes: 1e08fd0a46 ("vhost-vsock: SOCK_SEQPACKET feature bit support") Cc: qemu-stable@nongnu.org Reported-by: Jiang Wang Signed-off-by: Stefano Garzarella Message-Id: <20210921161642.206461-2-sgarzare@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin (cherry picked from commit d6a9378f47515c6d70dbff4912c5740c98709880) Signed-off-by: Michael Roth --- hw/core/machine.c | 1 + hw/virtio/vhost-vsock.c | 19 ++++++++++++++++--- include/hw/virtio/vhost-vsock.h | 3 +++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 54e040587d..2cf2f321f9 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -43,6 +43,7 @@ GlobalProperty hw_compat_6_0[] = { { "nvme-ns", "eui64-default", "off"}, { "e1000", "init-vet", "off" }, { "e1000e", "init-vet", "off" }, + { "vhost-vsock-device", "seqpacket", "off" }, }; const size_t hw_compat_6_0_len = G_N_ELEMENTS(hw_compat_6_0); diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c index 1b1a5c70ed..dade0da031 100644 --- a/hw/virtio/vhost-vsock.c +++ b/hw/virtio/vhost-vsock.c @@ -114,10 +114,21 @@ static uint64_t vhost_vsock_get_features(VirtIODevice *vdev, Error **errp) { VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev); + VHostVSock *vsock = VHOST_VSOCK(vdev); + + if (vsock->seqpacket != ON_OFF_AUTO_OFF) { + virtio_add_feature(&requested_features, VIRTIO_VSOCK_F_SEQPACKET); + } + + requested_features = vhost_get_features(&vvc->vhost_dev, feature_bits, + requested_features); + + if (vsock->seqpacket == ON_OFF_AUTO_ON && + !virtio_has_feature(requested_features, VIRTIO_VSOCK_F_SEQPACKET)) { + error_setg(errp, "vhost-vsock backend doesn't support seqpacket"); + } - virtio_add_feature(&requested_features, VIRTIO_VSOCK_F_SEQPACKET); - return vhost_get_features(&vvc->vhost_dev, feature_bits, - requested_features); + return requested_features; } static const VMStateDescription vmstate_virtio_vhost_vsock = { @@ -218,6 +229,8 @@ static void vhost_vsock_device_unrealize(DeviceState *dev) static Property vhost_vsock_properties[] = { DEFINE_PROP_UINT64("guest-cid", VHostVSock, conf.guest_cid, 0), DEFINE_PROP_STRING("vhostfd", VHostVSock, conf.vhostfd), + DEFINE_PROP_ON_OFF_AUTO("seqpacket", VHostVSock, seqpacket, + ON_OFF_AUTO_AUTO), DEFINE_PROP_END_OF_LIST(), }; diff --git a/include/hw/virtio/vhost-vsock.h b/include/hw/virtio/vhost-vsock.h index 84f4e727c7..3f121a624f 100644 --- a/include/hw/virtio/vhost-vsock.h +++ b/include/hw/virtio/vhost-vsock.h @@ -30,6 +30,9 @@ struct VHostVSock { VHostVSockCommon parent; VHostVSockConf conf; + /* features */ + OnOffAuto seqpacket; + /*< public >*/ }; From patchwork Wed Dec 15 00:00:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676973 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 40499C433F5 for ; Wed, 15 Dec 2021 00:18:58 +0000 (UTC) Received: from localhost ([::1]:60946 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxI0X-0007gi-3A for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:18:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHoe-0003Ej-0I; Tue, 14 Dec 2021 19:06:40 -0500 Received: from mail-mw2nam12on2070.outbound.protection.outlook.com ([40.107.244.70]:62048 helo=NAM12-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHob-00052U-BB; Tue, 14 Dec 2021 19:06:39 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f1fIVDU595dWe+tl6XXxDuHB4M/XdziV8byYD7Gq+v771nP7ko7OoGhBViMrwZr8yQcSJZlzs8Dr5kmEtT3zlVQssEjpw0y7AbZOb1aIBl2eJcjyNmB1HGDS1I5uiZ6qYuF5rTlCLmGtaFE6MwLpfDgx4XhUWmh1+IOOmEmp2aulkf7ktHi5/w9aZ4JLTe+W3nLv73DUQFVMoZCMIBl/KMfIbSYk/f9YN2OXVvvWmrzju9AISFddSZmC5xOGIZ93sNmHGPq8mdKdHQ11g8xo6FkPp1EwJJziNa4Knbu/grkO/5QdTMKGuwqzSphDjtH/W3Hb27vdGlCIAbYlkAc5Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dojY5gAGdpmgNqfOgvgxWyMUS6huRpXlIa7A9adTA+s=; b=g68PmPZutJimVgrK2G/YFhvgfAM/Hp0RZjWxh6veHVOHWUPOZDrIUOrgDzuZXJZq2sLvJ0vKxpql4h2BtFRGw67W+o9XV1UPm/KJayNmRFv4SMdtbxLOyh8t1GL8B9/UMczHMUseo2NUuR8eY3bHF8jBqIxAv0Qw1SUoycCl5nEul+SZzmlI1FdF0ahtBzoDds9tF5A5cJEUKpgpgyXUINO4Cbspn89IMtR50pahhsNv2LD8cYcX6vmoVXo9wOcT4FFSFGkmuGY/w9dv6nLRJQw7HhNKIhTORiPa3WTotDaqPMw64Znir7eQSLQITQqBB65Z//OoGq5KJhLvuXEF4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dojY5gAGdpmgNqfOgvgxWyMUS6huRpXlIa7A9adTA+s=; b=UQ0kH+KU8UTcsf5Xs0RiRdVgQ4pRefbU/+uCfNGHdjG1rQWCq0RpXWBrF1zKFGl+PoyW525KbPC2iiMvsFTc0Jk3kkSi5ww4RbIMKxfGp7kCjjgK5mtBQro1vpF+UAMyaoilzQHMh0tZ00LS8CGSt3cMYIHXXXn+b5ao7/D63F0= Received: from MWHPR1601CA0024.namprd16.prod.outlook.com (2603:10b6:300:da::34) by BYAPR12MB3624.namprd12.prod.outlook.com (2603:10b6:a03:aa::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.21; Wed, 15 Dec 2021 00:06:33 +0000 Received: from CO1NAM11FT022.eop-nam11.prod.protection.outlook.com (2603:10b6:300:da:cafe::21) by MWHPR1601CA0024.outlook.office365.com (2603:10b6:300:da::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.12 via Frontend Transport; Wed, 15 Dec 2021 00:06:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT022.mail.protection.outlook.com (10.13.175.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:06:33 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:06:32 -0600 From: Michael Roth To: CC: , Jean-Philippe Brucker , Eric Auger , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH 17/47] hw/arm/virt: Rename default_bus_bypass_iommu Date: Tue, 14 Dec 2021 18:00:55 -0600 Message-ID: <20211215000125.378126-18-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 293dfb42-b3a1-42b7-4fb1-08d9bf5ec0c9 X-MS-TrafficTypeDiagnostic: BYAPR12MB3624:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:628; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x9WNkyEEiN5oiL7wAG+0rqHw7V/dnIgZ84vPSfzRM2SnmKHLAkc38DyEjEVC+lcKQPUiYOTh9dq9i42i4ReJTxIKxBcMPSbM0I7XBLAiV8RhG977uPDSuE7oRNwm2+zW9Z3ZopFg/0LLdfsOwW02vC0esY9UEG91wVNf9TCzvB8DRdvoSrP25GIuy5qwHYi+W0yAZPCCzLsMORVBrI3BWAO3GyqFvPGzlQBz9iP+75DXa6gZzHsdC7GpNzP9SxUuLp9QfvEWIfmzg+YgI8ESk5a0L3T1qrOShCrHsheL0E1ClwyS3F4MuKecXuqrbLiiWCBcxNcFAokIAkd7OaXKRrPLH3kv6/fr6qGAr5R5gl9MJNLsCCKSu07gjKsPjJoqXpDC/wIFt+hCSFlVxcaJo7cg7W8DFHfRBiaXgA/p19gbkR859iMZEPOGoKnr0of2rDZgORIH0mQW9ktONNhW8RVgwYO80+9AiIZeKmtqVG/7m8ooiojg9Ae72B5fIps/A6KPl8r7MMq0xb4R2beNYUqKClGdgrWTbXVhIdSvQS9vdh1EX/1Y6+pp+j/en/mbaASFBkFAWZEV924KE3rrT84NBT49ScZ5eyywORl/Bk0pNctVKew/3hVOzumXYJXL1eeFZFp1rzrEb4GpJxj4kSnb9YIru9LG7dkZlw7NxfLEpZUVX5mRWmFu6J8G3+FspmDFhKJzAKi4nRvH1wKzVWzSfiKFSMCBsfN31WklsQ5E/3RinSxYFmGB3uLYyJRAq1ycRg1SsUPDl8p7sye2z0xbk68l2501zB62x7QMMf0= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700001)(44832011)(8936002)(2616005)(336012)(1076003)(186003)(36860700001)(47076005)(54906003)(26005)(426003)(356005)(508600001)(81166007)(6666004)(8676002)(70206006)(16526019)(4326008)(316002)(36756003)(83380400001)(70586007)(2906002)(86362001)(82310400004)(5660300002)(6916009)(40460700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:06:33.0166 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 293dfb42-b3a1-42b7-4fb1-08d9bf5ec0c9 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT022.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3624 Received-SPF: softfail client-ip=40.107.244.70; envelope-from=Michael.Roth@amd.com; helo=NAM12-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jean-Philippe Brucker Since commit d8fb7d0969d5 ("vl: switch -M parsing to keyval"), machine parameter definitions cannot use underscores, because keyval_dashify() transforms them to dashes and the parser doesn't find the parameter. This affects option default_bus_bypass_iommu which was introduced in the same release: $ qemu-system-aarch64 -M virt,default_bus_bypass_iommu=on qemu-system-aarch64: Property 'virt-6.1-machine.default-bus-bypass-iommu' not found Rename the parameter to "default-bus-bypass-iommu". Passing "default_bus_bypass_iommu" is still valid since the underscore are transformed automatically. Fixes: 6d7a85483a06 ("hw/arm/virt: Add default_bus_bypass_iommu machine option") Signed-off-by: Jean-Philippe Brucker Tested-by: Eric Auger Reviewed-by: Eric Auger Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20211026093733.2144161-1-jean-philippe@linaro.org> Signed-off-by: Richard Henderson (cherry picked from commit 9dad363a223df8269175d218413aa8cd265e078e) Signed-off-by: Michael Roth --- hw/arm/virt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 81eda46b0b..106be60fd4 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2677,10 +2677,10 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) "Set the IOMMU type. " "Valid values are none and smmuv3"); - object_class_property_add_bool(oc, "default_bus_bypass_iommu", + object_class_property_add_bool(oc, "default-bus-bypass-iommu", virt_get_default_bus_bypass_iommu, virt_set_default_bus_bypass_iommu); - object_class_property_set_description(oc, "default_bus_bypass_iommu", + object_class_property_set_description(oc, "default-bus-bypass-iommu", "Set on/off to enable/disable " "bypass_iommu for default root bus"); From patchwork Wed Dec 15 00:00:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676961 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 61426C433F5 for ; Wed, 15 Dec 2021 00:11:19 +0000 (UTC) Received: from localhost ([::1]:39972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxHt8-0001kt-Ax for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:11:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHp3-0004Er-RR; Tue, 14 Dec 2021 19:07:05 -0500 Received: from mail-dm6nam10on2058.outbound.protection.outlook.com ([40.107.93.58]:15840 helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHov-0005Ad-QW; Tue, 14 Dec 2021 19:07:04 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NszNREGKcwkJwESd0F1lo0KqSDpfULLYpqDtotXZtYOkMsbx7EdBQuy38LwreaQmAsNm9aZfnlTF2oqh7BFodg2r1bzaNUBhoN1PPBPNFRPDHuASez8IDCSs7ETk9nvdjTepCS8+xhKGIY6KVau5zzu94+LPGvt3krTxXxnsUkVHs+pKDmvH7z7tri6kLNMEk0rmqTpvMoH8urkaVaPrjWXb35AF1Yb8pEny0rDoJoQWdD+HRly2jiqPFgj2/qougfiWSMAEby8NbW769+KZWfQCqVuGhWZNkU6aAcd46PML0qTh7qR0KFO7ty7FymcW4BVzuBlavhHR5061rH+WVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=C6HA9xHW0rIbRYLi4CQzDQ7qsAC3V4YK/kUChnEVKuE=; b=WsRI7zcrhZ+CZaqu++BwrchAn+ecQmoSetzuD+l2yL37uCDoOPCxtGVXoC7FXb7lL54d7NyuJYZdr8ANxpECOP0Wgv323E5eRH/1vl0Q1axa91vCS43or02T3tnTxUt/xL57Zmw/Khl7QRZm/0/L/JaqUMcrXf4GXIbUWjfOKZ6fLwVEY0kD8sYq5YFTu+vs5Mn46CGsh1xRGC3yTDvWZAumhWmTNEN6hyxk1fPzXhoZADRC4AXWYk7JaFdHgX/P+ZljrwWgc1EFtc5+MMzKZBpeHINeqhdYf7UBy0otyLguA/10x7wY1V2njKvh92idhPb2R4sP/qoyyMyfiVpo4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=C6HA9xHW0rIbRYLi4CQzDQ7qsAC3V4YK/kUChnEVKuE=; b=oZLVYi3endDKbim5nfMhQ8vPVgteWXUEl0Q6QLRZl49U1JGYO/gorjPvMMayz1+0Ji1hcft1WsdzO2dqC7k/265iOX9ZMXDE4YCPouKhemV7PHJnxLUYm1E6OtfNoE8tp38gS/aUmn/0IhLqfAcMPzGMnkHBaz1vTctHLknf4q8= Received: from MW4PR04CA0369.namprd04.prod.outlook.com (2603:10b6:303:81::14) by SA0PR12MB4557.namprd12.prod.outlook.com (2603:10b6:806:9d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 00:06:55 +0000 Received: from CO1NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:303:81:cafe::7b) by MW4PR04CA0369.outlook.office365.com (2603:10b6:303:81::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17 via Frontend Transport; Wed, 15 Dec 2021 00:06:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT018.mail.protection.outlook.com (10.13.175.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:06:54 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:06:53 -0600 From: Michael Roth To: CC: , Jean-Philippe Brucker , Eric Auger , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini Subject: [PATCH 18/47] hw/i386: Rename default_bus_bypass_iommu Date: Tue, 14 Dec 2021 18:00:56 -0600 Message-ID: <20211215000125.378126-19-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 52130fb4-94bb-4ebe-418c-08d9bf5ecd82 X-MS-TrafficTypeDiagnostic: SA0PR12MB4557:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:612; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DMj4K0TlLLqUsg9YiGPOBeBTCOslgudlOywnuh1IfcybkQ9I3PIxtKVtANqKfrmip2ipxdyTCx8K0Mfyy3yZJ455Izks6HljKlBJsK1KSMTLgVicUB7F9m8J6Bkdn/aZh9QNaLGLiW4lhea3WunQZxBfoqNN/tqNCQIftmf5dBlS8skgmYPlKcqlMdn4+va/jbVyHfru+A149l75cAcpLW8jD8vvyCv+viCp3NLE8jzVt49dbsqPpo+PQXzD+WfKZ0YmlziV/OO62rTULsQy1ERjCpmpG2d7Dw8wZZw7YEDHh8iNGUjjPxX15FevW9SDLSafJcFQAwgUvL7l47JeTFqILdWfZNNxIOyJeieu7kUT2zsjgQkNn45HgDf+IfU52+ALLnxTe9GlAFhqfJ+wzCnFY6ARZ/VeIkf2LZKvE5EFD1YmhyQTZpRssMZTkF/L9TR6T5zeE4Qwbz7qyoxTeuR5LNChVj5B3C/wTQQ3z6naxSMtTaCZXP945qloX5tHql2roDbW5RYD25L4qKXA+1Y5s0AIt/uTr1cpL61d9uFr+fDs08nflOo78AmUsszvOElIs2DWLRDDbDKQ/mUbuC23doapTE519XFWdvRAPlZFnoV9bgXuAqfPdZdB8/AkMC5ehzIAHTHs3wlmJZ/4ksrhe3wb+UfEyKFEipLmM95tUkMsDRf0CCnhrSu6WCb+/jj5cB1BcYCoO7dX0ZvhYXvRZDSE3/P5QZGK7JwIuYwaYmBswxWyjczSVt4Z3zgW//KAqh/uxcAKie2/9f+61diYLY+R1PP+VKvPdXFUquI= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(70586007)(54906003)(6916009)(336012)(47076005)(81166007)(356005)(83380400001)(508600001)(8936002)(1076003)(86362001)(316002)(44832011)(8676002)(4326008)(82310400004)(2906002)(426003)(36756003)(186003)(70206006)(36860700001)(16526019)(2616005)(5660300002)(40460700001)(26005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:06:54.3613 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 52130fb4-94bb-4ebe-418c-08d9bf5ecd82 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4557 Received-SPF: softfail client-ip=40.107.93.58; envelope-from=Michael.Roth@amd.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FORGED_SPF_HELO=1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, T_SPF_TEMPERROR=0.01 autolearn=no 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jean-Philippe Brucker Since commit d8fb7d0969d5 ("vl: switch -M parsing to keyval"), machine parameter definitions cannot use underscores, because keyval_dashify() transforms them to dashes and the parser doesn't find the parameter. This affects option default_bus_bypass_iommu which was introduced in the same release: $ qemu-system-x86_64 -M q35,default_bus_bypass_iommu=on qemu-system-x86_64: Property 'pc-q35-6.1-machine.default-bus-bypass-iommu' not found Rename the parameter to "default-bus-bypass-iommu". Passing "default_bus_bypass_iommu" is still valid since the underscore are transformed automatically. Fixes: c9e96b04fc19 ("hw/i386: Add a default_bus_bypass_iommu pc machine option") Reviewed-by: Eric Auger Reviewed-by: Philippe Mathieu-Daudé Tested-by: Eric Auger Signed-off-by: Jean-Philippe Brucker Message-Id: <20211025104737.1560274-1-jean-philippe@linaro.org> Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini (cherry picked from commit 739b38630c45585cd9d372d44537f69c0b2b4346) Signed-off-by: Michael Roth --- hw/i386/pc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index c2b9d62a35..1d421ae2f8 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1763,7 +1763,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) object_class_property_add_bool(oc, "hpet", pc_machine_get_hpet, pc_machine_set_hpet); - object_class_property_add_bool(oc, "default_bus_bypass_iommu", + object_class_property_add_bool(oc, "default-bus-bypass-iommu", pc_machine_get_default_bus_bypass_iommu, pc_machine_set_default_bus_bypass_iommu); From patchwork Wed Dec 15 00:00:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676965 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D909AC433EF for ; Wed, 15 Dec 2021 00:14:30 +0000 (UTC) Received: from localhost ([::1]:47916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxHwD-0007DE-QZ for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:14:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHpK-0004uu-BX; Tue, 14 Dec 2021 19:07:22 -0500 Received: from mail-dm6nam12on2050.outbound.protection.outlook.com ([40.107.243.50]:13536 helo=NAM12-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHpH-0005CP-RC; Tue, 14 Dec 2021 19:07:21 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MTOsq6eojN3Llj21r8BJeOJit0/aCCDcb1bgoqmmV4bW6zH3ZpuPowgdV85vMjlcAaXJ6jBIrBPoRPJKFdghMWT6MbsMWZabhdArlLGo0cw2odzXy5CWw9jZmhWwyEC7XpGbXMy7PIQFRwnHiNGlCkKJK/loUrJSJA9FVqbenZaiEjyjUSOOwCaK+SGUTKyiPMNtBZdz68AltX8NfRKXloUmcwr5Pmc8qrvmX5OZpltLSqMZywmi7s9UcWQHQiC1fZFKpbYI8vzQevzDiSHdpJ8Rh1XgS2pusjJEv8IOS8J2DEadXRyrGrZJtH6uCZ2sZOFkoBdkHv/8Zo4zG1boLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YLySVQQSs0ReuB7GSwMIz/nwi/JUA+QR/iztisECgxQ=; b=lHTLnwEKicBjFxmi+wj5/1JWQPsZilMhQ42U8DHFpMB+Mf+e2rwvcMVoYBQBFWo5rg3AGHXCfjiTUBnFdbyYR5e2Jzt1QziISulthj9bOhNsgObaqyxQAfR1lH4T71+2uOzpYUoNcovRlT/lQLjLUxlQeFqnc+0ED8bXvKK88wte28o5eNLVeeyKPPeASeiSxDcBBUzPhlOiZvaUTOeb+8F1lWXQAMbXI9XY4IJYtCn2Kk8SspspjGNvQCvxwjdZUNJIDVkLenxvUBxhzPSKPFeqSz40p7O+uelSusbbx1r/nxAuqb6oeGItesOuvyG3oFMlrAjS2prI8qRWcaCf6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YLySVQQSs0ReuB7GSwMIz/nwi/JUA+QR/iztisECgxQ=; b=C7q2ub6pI6WfBNcILbDe35ut4EWvdwZrnsD7u0pdh1HiNDgeSTOQndcxbiRyYJ0ndnBnYxuBcgjn7S40crnBeFpw7ndD+QPXimI+OW6sEdmJdM8OQaJvoUuFOOLp1+SPhQc/Z+Vm7B+FdoQ8C2czWGNd2qmv0UghKf1FGHzssH8= Received: from MWHPR2201CA0057.namprd22.prod.outlook.com (2603:10b6:301:16::31) by BY5PR12MB4902.namprd12.prod.outlook.com (2603:10b6:a03:1dd::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.18; Wed, 15 Dec 2021 00:07:15 +0000 Received: from CO1NAM11FT020.eop-nam11.prod.protection.outlook.com (2603:10b6:301:16:cafe::28) by MWHPR2201CA0057.outlook.office365.com (2603:10b6:301:16::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.14 via Frontend Transport; Wed, 15 Dec 2021 00:07:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT020.mail.protection.outlook.com (10.13.174.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:07:15 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:07:14 -0600 From: Michael Roth To: CC: , Ani Sinha , Igor Mammedov , "Michael S . Tsirkin" Subject: [PATCH 19/47] bios-tables-test: allow changes in DSDT ACPI tables for q35 Date: Tue, 14 Dec 2021 18:00:57 -0600 Message-ID: <20211215000125.378126-20-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 71183a53-c57b-4369-095d-08d9bf5ed9de X-MS-TrafficTypeDiagnostic: BY5PR12MB4902:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:336; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Cl6FAZvCWYsGfBYXOx2lt6uXhcMNjXsjbmKsXHEI+jEOz1M4Hz/fuW5SR7ovk7gejCiOfCE0iL1HVhVUk4IRWNNhnlb6bjRl8OsUTi52d5+Lf9zR9Hox7bpRv8LtDoPjPGx4xl/toZKnOh9cNKCdZQGfCRK3m6ZWUyOTbkDZkqjf/DdbeKNKO3moWdHyTE1raCpmiUBbGUzb6jUdc8OwjcTscV45Pl7sDulRuxWJOcibMLY4ekuCLCHCRhxa09kEOmNcb6FPktcfMCWUFCnW2Est9onN6xkUQPxL5e+aWyWAnPckAFpJEFgK0c+VUVCwIaD06Ko6tu939G3EFNoqiala0TCgFUYSuJc480fizJKQRAydSw2Bow+je2Xrl++Pz3o2aQCK6pbH/sBdhT0jHbmaC9J4uFrDHKufzpnzurkQi1UFVOrWuZPpvSSsds2CWGUA3NDs6iiS6azY37NADA4WnIWi7mbSv+dqhuvp2mKkSF9Bz6MG2yIeESje6GSak/xfWCnc7r31cq1f1gydnlImG76Omre35MyyXONPHdqEcZ1QpxFV3Y5Ml2jlNFJAtCnynDRUcW5R9WMFxDJARQ4FoqNi85K27tqB6t+M3g1DFo/esrUQRjmjhRWsMFKwsnlJb/5EoloN8mnC4RUX4TfTFeZmAd+WlDSTVrYEuZPiXvrieS34Urqwa4pjmXXQ3Wq1eADM4TsyhiOD4Jm0nEm+3bqckSOboN0m6CPC8LogHxRZKmAwBt2WFrMPM89Dt9HIrroBBkX8qOOT9MpcKtNm/h/FMD9Aq9O9GB3lsMw= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700001)(2906002)(83380400001)(40460700001)(2616005)(44832011)(82310400004)(36860700001)(86362001)(70586007)(70206006)(36756003)(8676002)(316002)(426003)(6916009)(1076003)(336012)(8936002)(47076005)(5660300002)(4326008)(26005)(81166007)(6666004)(356005)(16526019)(508600001)(54906003)(186003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:07:15.1267 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 71183a53-c57b-4369-095d-08d9bf5ed9de X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT020.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4902 Received-SPF: softfail client-ip=40.107.243.50; envelope-from=Michael.Roth@amd.com; helo=NAM12-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Ani Sinha We are going to commit a change to fix IO address range allocated for acpi pci hotplug in q35. This affects DSDT tables. This change allows DSDT table modification so that unit tests are not broken. Signed-off-by: Ani Sinha Acked-by: Igor Mammedov Message-Id: <20210916132838.3469580-2-ani@anisinha.ca> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin (cherry picked from commit 9f29e872d5b3973003701401cf659cfb71c95013) Signed-off-by: Michael Roth --- tests/qtest/bios-tables-test-allowed-diff.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..c06da38af3 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,13 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/q35/DSDT", +"tests/data/acpi/q35/DSDT.tis.tpm12", +"tests/data/acpi/q35/DSDT.tis.tpm2", +"tests/data/acpi/q35/DSDT.bridge", +"tests/data/acpi/q35/DSDT.mmio64", +"tests/data/acpi/q35/DSDT.ipmibt", +"tests/data/acpi/q35/DSDT.cphp", +"tests/data/acpi/q35/DSDT.memhp", +"tests/data/acpi/q35/DSDT.numamem", +"tests/data/acpi/q35/DSDT.nohpet", +"tests/data/acpi/q35/DSDT.dimmpxm", +"tests/data/acpi/q35/DSDT.acpihmat", From patchwork Wed Dec 15 00:00:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676987 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D149FC4332F for ; Wed, 15 Dec 2021 00:24:07 +0000 (UTC) Received: from localhost ([::1]:47698 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxI5W-0000un-MP for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:24:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52228) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHpg-0005W0-V0; Tue, 14 Dec 2021 19:07:46 -0500 Received: from mail-dm3nam07on2053.outbound.protection.outlook.com ([40.107.95.53]:47780 helo=NAM02-DM3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHpc-0005EH-OU; Tue, 14 Dec 2021 19:07:44 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NHkaAItrzVIMp/0fgEqJrkYSf3OLLh/rPxf1KGKdYl/MXnjLGJJzkWk1BsZVpHTX4NVgSVPwgN9OOdtVAGsh6qE2deDXPFKHpa/VHdNVvUx2A/tGJ/1mkiQDGVmJfpwQH25iaDrRYnRFaq0HVREtVjlyx51lPKGwdyeLD2Y/4eEtFChM1zfPQMnHnAtMxALrJ6N9YJ1aTNOaBE0Tp3h9P0AFEmUBMd9A3p0+sbB76mFHnBpvuEB31RRG7mSGt/q3wJtFfdpO2KGXKOetl02wRG7GINBambdMwvKF1pkD1pQPeaiQ3fF6wcOuE1OVAY7jseha7EN3PC7I76BkxzQ7bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=F6tFHKPC2//piIXrCE2mb4M0D9Oj+ZTgEQ/S8nQvqQ8=; b=kDSqkzehGNy4GnU8PliQgTxJ0bpJSw+7wHopySfswN10AwvWvPCtefmkBqGfmBGOvmC+co/HbXQObmGzNa0nMAGfovzoE74h9i0nLq+38TiXJTtkvptDpg0A6rdhi/u2SYBTuZEuPFsum2CARFz/AhUIVt2TgBX38sP3rMUlB/ALalmbzGsqCvOexRYrdPYrhxhV0ugCBc1/uWVUOYRqzUt2KWgYQQKjCXZY8hDCJTPO/9WmsW6TkHdY4G1rZ5Dk9+bPZYHwJfRBi0skXKqk1c3M5G53ssVM+1qM3i3MNcCiK2lpTin95TOiSGMCEPj4a8bA1pkQYCflYwBwxQ47fw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F6tFHKPC2//piIXrCE2mb4M0D9Oj+ZTgEQ/S8nQvqQ8=; b=XJnEIhjsWJzGAvLqLcz4ckIRA7NHsqOm1QkGis1msvSdZ6VREQW+GlVRLPdMnYZ2cW7PiAqmi1u3fgbftc98leCRcazyv5whTw+O9YCOZ+ISwjES3XZ1ulRwwCRsq6jyMoZP2REp1HNXFM76W825U5awNILpJCEfUtcMK7IsHKw= Received: from MWHPR15CA0031.namprd15.prod.outlook.com (2603:10b6:300:ad::17) by DM6PR12MB3418.namprd12.prod.outlook.com (2603:10b6:5:116::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 00:07:36 +0000 Received: from CO1NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:300:ad:cafe::c2) by MWHPR15CA0031.outlook.office365.com (2603:10b6:300:ad::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14 via Frontend Transport; Wed, 15 Dec 2021 00:07:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT044.mail.protection.outlook.com (10.13.175.188) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:07:36 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:07:35 -0600 From: Michael Roth To: CC: , Ani Sinha , Igor Mammedov , Julia Suvorova , "Michael S . Tsirkin" Subject: [PATCH 20/47] hw/i386/acpi: fix conflicting IO address range for acpi pci hotplug in q35 Date: Tue, 14 Dec 2021 18:00:58 -0600 Message-ID: <20211215000125.378126-21-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 94a2aee5-3d32-4459-4f86-08d9bf5ee65a X-MS-TrafficTypeDiagnostic: DM6PR12MB3418:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Za1U/yHO53TBlBh6XGtUC/3dhLtnxeXFxik9c8/DHHOChMyigMao5iqBZ1ClgF9sEP7ky68+y10o25jJwbSVKPlzlrhWrhyUF+qW0d5u60m8TV62Vt5LYTYatPzeFIeS3Lnh4qUPZY3YvJqw2OUjbeka00IoFofymPfdveKDkliiTgeyUFTVzfPcj1c0eip/u8gyIP+sjWYvOhx74SkT+oDfdRFYcpQZI7xuLABO7e006n1/z9R/An5xxUr/W6z64VVSL3+lNH2SUDD3NGqZrVhuCzpcSZnQQXY0kovBY6vNPZcqXJj6KWL4fd7kV7beQHTrhKY6fIpkaQEEC61qbTjZm8pIYVwp203FMLC80L/iCdOMIP/5eb+DMzi+7T45PnZbq/LETS9Dj3JK7scW+jbKcrTu+HUrN0JidxtKPC8rnZ86+h7TZLmoV8wTZQ1L0/y3D6UMv/B/VeL+ZjHj+HA4+Dk4YtX2tbQNVwi+hA2s0Z4Sy3xu553ehVaCN9twrCMLvWgSFLwAjFY+dK1zqEYYeFxNI/NzUwz08aOxr1q8PrOf7aRvY5fEH9rl+2RiY6zwniCizpbS+nQpDjQkP+8Ga35ybPzG5BFyUdnI3rn2ir6hjssRssM5O3CgiLMMvexH08Zw+e1mRdzNetqWlTBl8nPs8mixj2YA2Mqr1aBvgQn+L/vwk28ubfut/rdoQkCdPVhRNARguImgZ1Z7w+V0U2uNvl+o3J1++Uz8HLHbX+4/kJYLmuhDR5zEXzfwzFuLK+yPruTfW5uLI4zawgISm1XL56AWkYep/GePJ1jJ6WEDR9o75lf540XzK26rMAIRumyS0O2TztA84s2fgyuu+w8sYPjhRlV+OAP+TQjCWeUrhD3yKwMKWbeVVzt+ X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(356005)(186003)(16526019)(47076005)(6916009)(8676002)(81166007)(4326008)(8936002)(508600001)(36860700001)(6666004)(26005)(70206006)(82310400004)(1076003)(966005)(2906002)(5660300002)(36756003)(316002)(83380400001)(40460700001)(54906003)(426003)(2616005)(336012)(44832011)(70586007)(86362001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:07:36.0582 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 94a2aee5-3d32-4459-4f86-08d9bf5ee65a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3418 Received-SPF: softfail client-ip=40.107.95.53; envelope-from=Michael.Roth@amd.com; helo=NAM02-DM3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Ani Sinha Change caf108bc58790 ("hw/i386/acpi-build: Add ACPI PCI hot-plug methods to Q35") selects an IO address range for acpi based PCI hotplug for q35 arbitrarily. It starts at address 0x0cc4 and ends at 0x0cdb. At the time when the patch was written but the final version of the patch was not yet pushed upstream, this address range was free and did not conflict with any other IO address ranges. However, with the following change, this address range was no longer conflict free as in this change, the IO address range (value of ACPI_PCIHP_SIZE) was incremented by four bytes: b32bd763a1ca92 ("pci: introduce acpi-index property for PCI device") This can be seen from the output of QMP command 'info mtree' : 0000000000000600-0000000000000603 (prio 0, i/o): acpi-evt 0000000000000604-0000000000000605 (prio 0, i/o): acpi-cnt 0000000000000608-000000000000060b (prio 0, i/o): acpi-tmr 0000000000000620-000000000000062f (prio 0, i/o): acpi-gpe0 0000000000000630-0000000000000637 (prio 0, i/o): acpi-smi 0000000000000cc4-0000000000000cdb (prio 0, i/o): acpi-pci-hotplug 0000000000000cd8-0000000000000ce3 (prio 0, i/o): acpi-cpu-hotplug It shows that there is a region of conflict between IO regions of acpi pci hotplug and acpi cpu hotplug. Unfortunately, the change caf108bc58790 did not update the IO address range appropriately before it was pushed upstream to accommodate the increased length of the IO address space introduced in change b32bd763a1ca92. Due to this bug, windows guests complain 'This device cannot find enough free resources it can use' in the device manager panel for extended IO buses. This issue also breaks the correct functioning of pci hotplug as the following shows that the IO space for pci hotplug has been truncated: (qemu) info mtree -f FlatView #0 AS "I/O", root: io Root memory region: io 0000000000000cc4-0000000000000cd7 (prio 0, i/o): acpi-pci-hotplug 0000000000000cd8-0000000000000cf7 (prio 0, i/o): acpi-cpu-hotplug Therefore, in this fix, we adjust the IO address range for the acpi pci hotplug so that it does not conflict with cpu hotplug and there is no truncation of IO spaces. The starting IO address of PCI hotplug region has been decremented by four bytes in order to accommodate four byte increment in the IO address space introduced by change b32bd763a1ca92 ("pci: introduce acpi-index property for PCI device") After fixing, the following are the corrected IO ranges: 0000000000000600-0000000000000603 (prio 0, i/o): acpi-evt 0000000000000604-0000000000000605 (prio 0, i/o): acpi-cnt 0000000000000608-000000000000060b (prio 0, i/o): acpi-tmr 0000000000000620-000000000000062f (prio 0, i/o): acpi-gpe0 0000000000000630-0000000000000637 (prio 0, i/o): acpi-smi 0000000000000cc0-0000000000000cd7 (prio 0, i/o): acpi-pci-hotplug 0000000000000cd8-0000000000000ce3 (prio 0, i/o): acpi-cpu-hotplug This change has been tested using a Windows Server 2019 guest VM. Windows no longer complains after this change. Fixes: caf108bc58790 ("hw/i386/acpi-build: Add ACPI PCI hot-plug methods to Q35") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/561 Signed-off-by: Ani Sinha Reviewed-by: Igor Mammedov Reviewed-by: Julia Suvorova Message-Id: <20210916132838.3469580-3-ani@anisinha.ca> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin (cherry picked from commit 0e780da76a6fe283a20283856718bca3986c104f) Signed-off-by: Michael Roth --- include/hw/acpi/ich9.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h index a329ce43ab..f04f1791bd 100644 --- a/include/hw/acpi/ich9.h +++ b/include/hw/acpi/ich9.h @@ -29,7 +29,7 @@ #include "hw/acpi/acpi_dev_interface.h" #include "hw/acpi/tco.h" -#define ACPI_PCIHP_ADDR_ICH9 0x0cc4 +#define ACPI_PCIHP_ADDR_ICH9 0x0cc0 typedef struct ICH9LPCPMRegs { /* From patchwork Wed Dec 15 00:00:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676995 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 79577C433EF for ; Wed, 15 Dec 2021 00:27:10 +0000 (UTC) Received: from localhost ([::1]:57850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxI8T-0007jU-Ji for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:27:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHqK-00073d-B5; Tue, 14 Dec 2021 19:08:24 -0500 Received: from mail-dm6nam10on2076.outbound.protection.outlook.com ([40.107.93.76]:5600 helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHqH-0005Gt-KD; Tue, 14 Dec 2021 19:08:24 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZQf+PVunSroV+6CfdN6g9I0xyEkm10wuFf+N1mfJ6ECqpsaNMWnBRn3V+McC7MGpjLjsnSOtGUjhCpLK7d3zHgMkQfBUHp3Ddiisu8/qnQpe6ueoxjIZrv3yiIfXi8WyHR9kfGQzEvDTOC3NTsD3+DeFgn8oShwxMG1HafLGEoCyBB7kIsNRr9hBOu3S4kUASLgIFXnn0jJqJg7ZQinE8CogLIQJx6o3Fjdk3mWT3tUFwIJUs8cKKn4e++9syM0YNrDZZqYl6CPZckj+/KcBl3mh+A7Q24VjoLU0dfOR4wfCODUlGZ84X5yNEh89sl+1tKawg1kdTGCAvJFbFfbb7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4izxwDlccvM/JuaIGtof56N7mFc5Hp/oNB80yeNv6PQ=; b=Bl5pFMdcCQn4bIHD2+/PZm4lKXdc6gg+MgE7BCJLe8PgB3Nr1PgecQ8M5JnN2fx1NtksrwUqgYqmGcslUlSYbp5h1fEi9ZUWbBOlPWrnpXJOPkNXtOJ0jIGURxWyGVgboVWRkvvlRHL5frOAraUpgIGZyoCILcNN6NX0QQbQXtX+2Dyihh/OA9I4rmSWanV4MAPiebI2IoOY+75q5VHR3xlH3lAGqPrwDZQSbrKg8fgSnpSQkSyN9n91JibeZRLOtytJ8Zd+DXdr6J14X8hGHgj6qhUcj+K0ew2D95DqGJJcw8B3k6AfYZwP+wuxGZsZ8e0yAQnBtoKLmurGSuVjYg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4izxwDlccvM/JuaIGtof56N7mFc5Hp/oNB80yeNv6PQ=; b=bZ2vyWQij3yFP0FqJHz0HnCOPpz8UjTOp/kqjOjev7ik9Ksloquth+oPLPqXa7oWkcJWZbDMsyj39Zfwgzb0i4mi2BHvS5a07XUUJeeEUaaJuT6biMMOecGK5LFiRis3tiMWtcYhouanUQKSSDlBJAsoQT/vn+7sHdxaXjNy4ZM= Received: from MW4PR04CA0146.namprd04.prod.outlook.com (2603:10b6:303:84::31) by MW2PR12MB4681.namprd12.prod.outlook.com (2603:10b6:302:12::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16; Wed, 15 Dec 2021 00:08:18 +0000 Received: from CO1NAM11FT046.eop-nam11.prod.protection.outlook.com (2603:10b6:303:84:cafe::4c) by MW4PR04CA0146.outlook.office365.com (2603:10b6:303:84::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17 via Frontend Transport; Wed, 15 Dec 2021 00:08:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT046.mail.protection.outlook.com (10.13.174.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:08:17 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:08:17 -0600 From: Michael Roth To: CC: , Ani Sinha , Igor Mammedov , "Michael S . Tsirkin" Subject: [PATCH 21/47] bios-tables-test: Update ACPI DSDT table golden blobs for q35 Date: Tue, 14 Dec 2021 18:00:59 -0600 Message-ID: <20211215000125.378126-22-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ac13a32d-3865-42a4-44a6-08d9bf5eff48 X-MS-TrafficTypeDiagnostic: MW2PR12MB4681:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:409; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cDPYhp5Mgc314bi4jrIon1/lbEZagczmw1vmG5ZfyW5NCJsq+QC8Waiu1AupK9jgs69Yh8qx3ErXrtzXNgrpI6zAi/8dkEg8f1aXYTQBhJVnCwfnIVxpp0kFv8RDksPhBzviGZ5USelurjPUmJswvvp4Y0HXI9DTSLrIr4pX06Bj3W53rmblSBXp01yAQh5mxxNLS0080Z/xhxMnSPxgMMRWftPlae47IJJqTJlHaSzmfgXepKOKbPQBcP48ZfqI+fdwWepX9b3MGk739FWB9b5MfETVWJIAoL+dBDD0t0omOg4Lb+Hho9xmaq2/7BucfdVWJUcWharx1SmOg8bs0CM4c+bTvRcfiRUFbni/GD0xyos7wQ/o5SX5A5A0+SCBuFIdBrcYsxNIsw7zSGvrHWRkYYXsI7PNVs17HXq7H5r1PV3U2XQ63J+wFEB2i9TPvZOiqK5l09lZzpEkQMjyhXqHUwNpxKeb9P/2xtbmNeF9AFvMOb1A7MJlJqDUI6vNn3EP5u4g7SAXzGG+vTEBl++jlTwhFDJ2K2W4yeCTePaFGn/k4a692KSinBOKX4ZToffAivRr+kbqG0W87ee54Z/JfzHJRfxksdLzqQDQwEWHCOSu0L/a6ZhUSfjHeLY2LbJykDqStb8AwQn3YjiJopi/ygQQp0gz0uSP2bNaKZLmSB26BAlBofkqzI/+Zv+MNDNjYylOQ5TMpa75hsHPvk5LWJNNCgtfa+s/ymlmOQ/PqbdF7IRnW34SQURcCgBlQ790kK+6wp9oSrEPs88ZDQ360hgUdUmD3V74ExrJiSY= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(19627235002)(70206006)(5660300002)(86362001)(8936002)(336012)(6916009)(316002)(83380400001)(15650500001)(6666004)(186003)(70586007)(2906002)(16526019)(26005)(426003)(1076003)(54906003)(47076005)(4326008)(44832011)(508600001)(40460700001)(36756003)(82310400004)(36860700001)(81166007)(8676002)(2616005)(356005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:08:17.8830 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac13a32d-3865-42a4-44a6-08d9bf5eff48 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT046.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR12MB4681 Received-SPF: softfail client-ip=40.107.93.76; envelope-from=Michael.Roth@amd.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Ani Sinha We have modified the IO address range for ACPI pci hotplug in q35. See change: 5adcc9e39e6a5 ("hw/i386/acpi: fix conflicting IO address range for acpi pci hotplug in q35") The ACPI DSDT table golden blobs must be regenrated in order to make the unit tests pass. This change updates the golden ACPI DSDT table blobs. Following is the ASL diff between the blobs: @@ -1,30 +1,30 @@ /* * Intel ACPI Component Architecture * AML/ASL+ Disassembler version 20190509 (64-bit version) * Copyright (c) 2000 - 2019 Intel Corporation * * Disassembling to symbolic ASL+ operators * - * Disassembly of tests/data/acpi/q35/DSDT, Tue Sep 14 09:04:06 2021 + * Disassembly of /tmp/aml-52DP90, Tue Sep 14 09:04:06 2021 * * Original Table Header: * Signature "DSDT" * Length 0x00002061 (8289) * Revision 0x01 **** 32-bit table (V1), no 64-bit math support - * Checksum 0xE5 + * Checksum 0xF9 * OEM ID "BOCHS " * OEM Table ID "BXPC " * OEM Revision 0x00000001 (1) * Compiler ID "BXPC" * Compiler Version 0x00000001 (1) */ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ", 0x00000001) { Scope (\) { OperationRegion (DBG, SystemIO, 0x0402, One) Field (DBG, ByteAcc, NoLock, Preserve) { DBGB, 8 } @@ -226,46 +226,46 @@ Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings { IO (Decode16, 0x0070, // Range Minimum 0x0070, // Range Maximum 0x01, // Alignment 0x08, // Length ) IRQNoFlags () {8} }) } } Scope (_SB.PCI0) { - OperationRegion (PCST, SystemIO, 0x0CC4, 0x08) + OperationRegion (PCST, SystemIO, 0x0CC0, 0x08) Field (PCST, DWordAcc, NoLock, WriteAsZeros) { PCIU, 32, PCID, 32 } - OperationRegion (SEJ, SystemIO, 0x0CCC, 0x04) + OperationRegion (SEJ, SystemIO, 0x0CC8, 0x04) Field (SEJ, DWordAcc, NoLock, WriteAsZeros) { B0EJ, 32 } - OperationRegion (BNMR, SystemIO, 0x0CD4, 0x08) + OperationRegion (BNMR, SystemIO, 0x0CD0, 0x08) Field (BNMR, DWordAcc, NoLock, WriteAsZeros) { BNUM, 32, PIDX, 32 } Mutex (BLCK, 0x00) Method (PCEJ, 2, NotSerialized) { Acquire (BLCK, 0xFFFF) BNUM = Arg0 B0EJ = (One << Arg1) Release (BLCK) Return (Zero) } @@ -3185,34 +3185,34 @@ 0x0620, // Range Minimum 0x0620, // Range Maximum 0x01, // Alignment 0x10, // Length ) }) } Device (PHPR) { Name (_HID, "PNP0A06" /* Generic Container Device */) // _HID: Hardware ID Name (_UID, "PCI Hotplug resources") // _UID: Unique ID Name (_STA, 0x0B) // _STA: Status Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings { IO (Decode16, - 0x0CC4, // Range Minimum - 0x0CC4, // Range Maximum + 0x0CC0, // Range Minimum + 0x0CC0, // Range Maximum 0x01, // Alignment 0x18, // Length ) }) } } Scope (\) { Name (_S3, Package (0x04) // _S3_: S3 System State { One, One, Zero, Zero }) Signed-off-by: Ani Sinha Acked-by: Igor Mammedov Message-Id: <20210916132838.3469580-4-ani@anisinha.ca> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin (cherry picked from commit 500eb21cff08dfb0478db9b34f2fdba69eb31496) *drop dependency on 75539b886a ("tests: acpi: tpm1.2: Add expected TPM 1.2 ACPI blobs") Signed-off-by: Michael Roth --- tests/data/acpi/q35/DSDT | Bin 8289 -> 8289 bytes tests/data/acpi/q35/DSDT.acpihmat | Bin 9614 -> 9614 bytes tests/data/acpi/q35/DSDT.bridge | Bin 11003 -> 11003 bytes tests/data/acpi/q35/DSDT.cphp | Bin 8753 -> 8753 bytes tests/data/acpi/q35/DSDT.dimmpxm | Bin 9943 -> 9943 bytes tests/data/acpi/q35/DSDT.ipmibt | Bin 8364 -> 8364 bytes tests/data/acpi/q35/DSDT.memhp | Bin 9648 -> 9648 bytes tests/data/acpi/q35/DSDT.mmio64 | Bin 9419 -> 9419 bytes tests/data/acpi/q35/DSDT.nohpet | Bin 8147 -> 8147 bytes tests/data/acpi/q35/DSDT.numamem | Bin 8295 -> 8295 bytes tests/data/acpi/q35/DSDT.tis | Bin 8894 -> 8894 bytes tests/qtest/bios-tables-test-allowed-diff.h | 12 ------------ 12 files changed, 12 deletions(-) diff --git a/tests/data/acpi/q35/DSDT b/tests/data/acpi/q35/DSDT index 842533f53e6db40935c3cdecd1d182edba6c17d4..281fc82c03b2562d2e6b7caec0d817b034a47138 100644 GIT binary patch delta 65 zcmaFp@X&$FCD+tn9LO9j!+e0}z~trfy8v~b6W9O% delta 65 zcmaFp@X&$FCD+to9LO9j!+eD2$mHeny8v@q6W9O% diff --git a/tests/data/acpi/q35/DSDT.acpihmat b/tests/data/acpi/q35/DSDT.acpihmat index 8d00f2ea0dd78f962e136273d68cb0c568e43c27..8c1e05a11a328ec1cc6f86e36e52c28f41f9744e 100644 GIT binary patch delta 65 zcmeD4?(^ny33dtTQ)OUa+_sU6pPBK%WGQA@sS`Y0EYXeJ!LDBM&Q1odUJB6-PJX^Y VjNBJC2QoJ(G9TbMF!_qgE&x%Q6Po}4 delta 65 zcmeD4?(^ny33dtTQ)OUaT(pskpPBK+tn9LO9j!+e0}z~<%hA>06yixa5; delta 66 zcmewz`a6`%CDF$oF?J&tKQrTj$x_U+QYU!0SfU%bgI&Giot+F^y%eGwocw%) V7`ZQO4rErAV?MxhU~;+QE&wzZ5?TNN delta 65 zcmdn!veAXhCDF$o(Q_jgKQrTz$x_U+QfGL$SfU%bgI&Giot+F^y%eGwocw%) V7`d-(4rErAV?M%jWOBLUE&wso5?TNN diff --git a/tests/data/acpi/q35/DSDT.dimmpxm b/tests/data/acpi/q35/DSDT.dimmpxm index b062e30117f955c7a2ac9629a0512324bbd28bf2..fe5820d93d057ef09a001662369b15afbc5b87e2 100644 GIT binary patch delta 65 zcmccad)=4ICD+tn9LRi9iTMD}fyuIJy8v+to9LRi9iTMc6k;$@Zy8v&d6QKYA diff --git a/tests/data/acpi/q35/DSDT.ipmibt b/tests/data/acpi/q35/DSDT.ipmibt index 1c5737692f56fc678e685a4ad0bb1df38d487a14..631741065860fd5036aa303904dabd1d2839f9c6 100644 GIT binary patch delta 89 zcmZ4ExWnjRFDA!6D88&YqzPK*B{Kx*^!rE1r@2 p1P>QWbR##2IIZ=^79R1njRFDA!6D88&YqzPK*B{Kx*^!rE1r@2 p3=bDebR##2IIZ=^79R1+tn9LO9g!+e0}z~r^^y8vk#6QBS9 delta 65 zcmaFv@Z5pRCDxg*6QBS9 diff --git a/tests/data/acpi/q35/DSDT.tis b/tests/data/acpi/q35/DSDT.tis index d1433e3c14570bbd17b029a9aec6bc53134c3b7d..c92d4d29c79352a60974ea9f665d0b9a410a4bac 100644 GIT binary patch delta 66 zcmdnzy3du%CD X-Patchwork-Id: 12676991 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9861FC433F5 for ; Wed, 15 Dec 2021 00:25:57 +0000 (UTC) Received: from localhost ([::1]:53332 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxI7G-0004eA-9Q for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:25:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHqg-00088G-4g; Tue, 14 Dec 2021 19:08:46 -0500 Received: from mail-mw2nam12on2056.outbound.protection.outlook.com ([40.107.244.56]:22737 helo=NAM12-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHqd-0005J1-Kc; Tue, 14 Dec 2021 19:08:45 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ja1I3OhfiMWIG1x7st8Ix5b7IRs4K0zOkujdTuMQa2fQ9aC93sorzCjTiFm/vgJbCTTqy3YxrKgbHG88GpYeHKw/8nVj6hLqt2qQisO9bla1886Z875apCfdYyEifu+0DDhWgaWXyaar+Dg7QyysaiDwipXo/PJfLVkFrrQhCfncepK7H6jEY5MO1b8ufo1WmyZTGlnwuiSfDa6M02xNZeoxVpEahxprcBBqkk73Duzfs3mrWaAumExzgJm/tA1pFwv8SMqpzyUx4nKEPOAvXEICmPf9FijZBXfxRnImzMSBywsuaUTfs2EMp5y4JS70Ig2OD6UIhHI6IiYsR455Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OWsFGujV6wZzyGQ51qVHla/QaxHpusuYgK5meW5BNJM=; b=a96W/AiyZphiUqJ3MKOqwh1yDooR8BrUf8+0nFFOCPKi/RyiOhAI0Or0sb9qWS5cSgm77yi5DevSBVOD1yB/+thAMWoyJPZiB4IyKXYcUud2FVIhYM6YXsDxZCdRzT49dFjRt6PyHaxMFaJwuHH1VQA7enTKf1g5z6ZIB4Vm9hX24Sliim5hvzjdzoGi54a2/srXHW9cdyORIFKfSI3zencoHpbHNha05ZKkX7sepb3FrNtosIibnrmGj5VAk0TxEpNGNftLirmKJAQR5GR1cRj8GgAQYeI41xaGtbQ6SBRMBIgBLMNTJH4/FLbfT6+pRg3E2Yr80cXYT13/u5aN/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OWsFGujV6wZzyGQ51qVHla/QaxHpusuYgK5meW5BNJM=; b=xUEWj4P52YZ/vMoKrH8o6wmLfHcCrHIUZLVf+sQuqWkcHmRgeiy0ZhQLLpb92BeEp72Esxivfc2FYosYFz4d/WZL8SP1mUZ4/4T1k2eahNXSJ5LkOTIlb3QzI5p8orte/uitZO8UqlX5jY7+M/D3BSKOK/q9cQCCtbrKe5MO2QU= Received: from MW4PR04CA0167.namprd04.prod.outlook.com (2603:10b6:303:85::22) by DM5PR12MB2423.namprd12.prod.outlook.com (2603:10b6:4:b3::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.11; Wed, 15 Dec 2021 00:08:39 +0000 Received: from CO1NAM11FT034.eop-nam11.prod.protection.outlook.com (2603:10b6:303:85:cafe::43) by MW4PR04CA0167.outlook.office365.com (2603:10b6:303:85::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14 via Frontend Transport; Wed, 15 Dec 2021 00:08:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT034.mail.protection.outlook.com (10.13.174.248) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:08:39 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:08:37 -0600 From: Michael Roth To: CC: , Paolo Bonzini , Halil Pasic , Hanna Reitz , Kevin Wolf , Subject: [PATCH 22/47] block: introduce max_hw_iov for use in scsi-generic Date: Tue, 14 Dec 2021 18:01:00 -0600 Message-ID: <20211215000125.378126-23-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a0ef2db9-cafc-45fd-4225-08d9bf5f0c3f X-MS-TrafficTypeDiagnostic: DM5PR12MB2423:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:126; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V+6moM+u8xzIvkC31+So+n8EAZKdvbd7PwqyKwRycIL3Ef8CKJW7/L6o/R121xZxU+Ps2DwMSPAgmC1wnGz5yDEn967iWDd3W7NDivVwUpDeu/qLnzfPZ9C1twCFaWs0NPblsCAO9CFitNFo0DTMX1+NhPDu47JhQPxP5NISRkyC3/cb7p7IFepVBwXfW+xNDivrh8GnjS0IjgFALyvhRFpIHIMj6xJw+sdJr5Hl5wGrCTm9+LHtk645X3ATpSjKiCwUZ9BPVa8sI23Yt47hAHklD7RX8WhZ+QAXHC5HYt3NQlCztLBn80UVcr8Tw8yhrywVym6RGI+L9ZiDetDq2JKDTW0k1Qx9WY/dnrsq96RYYXppNuHsWnjbPSRm8/DNkfakFJwdnWsjGBETemlrDWsDtPZwbokhpM8n/375rE2JjCqfmK78mukod0TSPJskCkb+of7oH7u4B0LW6NsoEypEpwNbs9isLDtAlKCDRlHlhtpTffZ8f1evQ4PruOmjKkidzOvdtcmKRaqWXB7cIYEq0Bc36zSObv3Np7rv6ITcdm2HsuCrxm0+DD9yIWwJIecTRyKga0sTf5z+pHeT5on3Ot8vqBx2jJaVlQDYLattfuaYqgoJarHA7plHrSMxQkG+ICe5wo6smprmEjlJhPvvCkFNM1w5AmlMfkfzuj0VGXk6bDG9kVcf7W7HkVVQ+wPj+/tKg1/ndXeJqLEeK22bILQbHfii7s5b1ceWHvQazWgbkLWvye5DqkG60Ea3jNjTu6f91/NBhnRS3St0dMFyT2IMO5yF44zHn1mClBXc4HukEY/Zi8jcZFIJtR+C9i2EQI/OwMDXZJPTm+GO0w== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700001)(426003)(40460700001)(2906002)(508600001)(44832011)(6916009)(8936002)(54906003)(83380400001)(2616005)(81166007)(36860700001)(5660300002)(8676002)(82310400004)(316002)(356005)(26005)(1076003)(36756003)(6666004)(86362001)(186003)(4326008)(16526019)(47076005)(336012)(70206006)(70586007)(41533002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:08:39.6284 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a0ef2db9-cafc-45fd-4225-08d9bf5f0c3f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT034.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB2423 Received-SPF: softfail client-ip=40.107.244.56; envelope-from=Michael.Roth@amd.com; helo=NAM12-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Linux limits the size of iovecs to 1024 (UIO_MAXIOV in the kernel sources, IOV_MAX in POSIX). Because of this, on some host adapters requests with many iovecs are rejected with -EINVAL by the io_submit() or readv()/writev() system calls. In fact, the same limit applies to SG_IO as well. To fix both the EINVAL and the possible performance issues from using fewer iovecs than allowed by Linux (some HBAs have max_segments as low as 128), introduce a separate entry in BlockLimits to hold the max_segments value from sysfs. This new limit is used only for SG_IO and clamped to bs->bl.max_iov anyway, just like max_hw_transfer is clamped to bs->bl.max_transfer. Reported-by: Halil Pasic Cc: Hanna Reitz Cc: Kevin Wolf Cc: qemu-block@nongnu.org Cc: qemu-stable@nongnu.org Fixes: 18473467d5 ("file-posix: try BLKSECTGET on block devices too, do not round to power of 2", 2021-06-25) Signed-off-by: Paolo Bonzini Message-Id: <20210923130436.1187591-1-pbonzini@redhat.com> Signed-off-by: Kevin Wolf (cherry picked from commit cc071629539dc1f303175a7e2d4ab854c0a8b20f) Signed-off-by: Michael Roth --- block/block-backend.c | 6 ++++++ block/file-posix.c | 2 +- block/io.c | 1 + hw/scsi/scsi-generic.c | 2 +- include/block/block_int.h | 7 +++++++ include/sysemu/block-backend.h | 1 + 6 files changed, 17 insertions(+), 2 deletions(-) diff --git a/block/block-backend.c b/block/block-backend.c index deb55c272e..6320752aa2 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1978,6 +1978,12 @@ uint32_t blk_get_max_transfer(BlockBackend *blk) return ROUND_DOWN(max, blk_get_request_alignment(blk)); } +int blk_get_max_hw_iov(BlockBackend *blk) +{ + return MIN_NON_ZERO(blk->root->bs->bl.max_hw_iov, + blk->root->bs->bl.max_iov); +} + int blk_get_max_iov(BlockBackend *blk) { return blk->root->bs->bl.max_iov; diff --git a/block/file-posix.c b/block/file-posix.c index cb9bffe047..1567edb3d5 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1273,7 +1273,7 @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp) ret = hdev_get_max_segments(s->fd, &st); if (ret > 0) { - bs->bl.max_iov = ret; + bs->bl.max_hw_iov = ret; } } } diff --git a/block/io.c b/block/io.c index a19942718b..f38e7f81d8 100644 --- a/block/io.c +++ b/block/io.c @@ -136,6 +136,7 @@ static void bdrv_merge_limits(BlockLimits *dst, const BlockLimits *src) dst->min_mem_alignment = MAX(dst->min_mem_alignment, src->min_mem_alignment); dst->max_iov = MIN_NON_ZERO(dst->max_iov, src->max_iov); + dst->max_hw_iov = MIN_NON_ZERO(dst->max_hw_iov, src->max_hw_iov); } typedef struct BdrvRefreshLimitsState { diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index 665baf900e..0306ccc7b1 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -180,7 +180,7 @@ static int scsi_handle_inquiry_reply(SCSIGenericReq *r, SCSIDevice *s, int len) page = r->req.cmd.buf[2]; if (page == 0xb0) { uint64_t max_transfer = blk_get_max_hw_transfer(s->conf.blk); - uint32_t max_iov = blk_get_max_iov(s->conf.blk); + uint32_t max_iov = blk_get_max_hw_iov(s->conf.blk); assert(max_transfer); max_transfer = MIN_NON_ZERO(max_transfer, max_iov * qemu_real_host_page_size) diff --git a/include/block/block_int.h b/include/block/block_int.h index f1a54db0f8..c31cbd034a 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -702,6 +702,13 @@ typedef struct BlockLimits { */ uint64_t max_hw_transfer; + /* Maximal number of scatter/gather elements allowed by the hardware. + * Applies whenever transfers to the device bypass the kernel I/O + * scheduler, for example with SG_IO. If larger than max_iov + * or if zero, blk_get_max_hw_iov will fall back to max_iov. + */ + int max_hw_iov; + /* memory alignment, in bytes so that no bounce buffer is needed */ size_t min_mem_alignment; diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index 9ac5f7bbd3..5daec61f6e 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -210,6 +210,7 @@ uint32_t blk_get_request_alignment(BlockBackend *blk); uint32_t blk_get_max_transfer(BlockBackend *blk); uint64_t blk_get_max_hw_transfer(BlockBackend *blk); int blk_get_max_iov(BlockBackend *blk); +int blk_get_max_hw_iov(BlockBackend *blk); void blk_set_guest_block_size(BlockBackend *blk, int align); void *blk_try_blockalign(BlockBackend *blk, size_t size); void *blk_blockalign(BlockBackend *blk, size_t size); From patchwork Wed Dec 15 00:01:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676999 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6165CC433F5 for ; Wed, 15 Dec 2021 00:28:06 +0000 (UTC) Received: from localhost ([::1]:33564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxI9N-000208-7O for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:28:05 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHr0-0000UN-HG; Tue, 14 Dec 2021 19:09:06 -0500 Received: from mail-bn8nam11on2068.outbound.protection.outlook.com ([40.107.236.68]:32481 helo=NAM11-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHqx-0005Jf-0B; Tue, 14 Dec 2021 19:09:05 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mb/QFpPe/Zqt2U1btGnQAqOLTCgf54W5TB/Nui3ZhETg5PDp98oJnAsTUqzUhroqbYZu6OdhVu6YPF1xDcCWx7T4mCwap3eGMwNJ+ZItkKnklch6+5CU2jRnAvMXO8TQybIQhVGh6AaquDo2YUnCKekXW28JsVIE0q0TaXxqhoV0qP5y6l+zEPZWY4RJNyuw7gTT2rD6chU1Kr8dbN6Xz4tKMN+4KNTHx2V5yEn75jcEXyiJBfhcbydtI9mEm16wro9V8H27IEo34Lm/XiiCziwlC5YZrFj+e+FvQ/LfY9V/wddFfkr6OQo1hLLzOlwCHMiuAyBYP0Vg+sggf4i/cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=e7o5PoOj9k4Bu4+LVt0hJRob+/pynn9F2kPl20ynBAM=; b=KPe0uNTK8ba862pIqf2WzR/ZX6qkdrZEdIXo5Lbr5tuqJFfbXyXwwRvFPKdFxvMeEW7uScO5VG2kTCabggWBMHfkDYz+HkWhJS3745PGO6p0LzvxhaVkidCrKJZCcI20gMcP6CYmk66PZdVwkVgKc7nu1kY72X6DFJx/R5WfyuSl2keb8n1crhQatbq8Ycm33WnkLx45yup9cJnBlmSiB2lbN2o3e5bo43vFSIJ/RW8X1/yv42gKQriU9L+F0kHA9xyS9LObwiVmacJCvyjCDbM/JAAhXLVuPoqVzRFwVDMv3ZFlO+fv1GJq/vZZ28YPHbXnZ4zmhFXFFKM5ashfug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=e7o5PoOj9k4Bu4+LVt0hJRob+/pynn9F2kPl20ynBAM=; b=U9pcnIsJVncDFXhn68dBzJ2rHT5PZgnhsSOUwxR6AaxPsRiRbiJSEyqTFX03ff98gk1OFd/MhsIQHyzAhzUOiqyTRNhO1QOBz1GUU220M3R3+62pE93DVIcJis3iD8d3IRCjLd5SpCtet3RPwaOQ8CSTbyHBo735LARO5uePTIg= Received: from MW3PR05CA0003.namprd05.prod.outlook.com (2603:10b6:303:2b::8) by MN2PR12MB3375.namprd12.prod.outlook.com (2603:10b6:208:cc::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Wed, 15 Dec 2021 00:09:00 +0000 Received: from CO1NAM11FT047.eop-nam11.prod.protection.outlook.com (2603:10b6:303:2b:cafe::60) by MW3PR05CA0003.outlook.office365.com (2603:10b6:303:2b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.11 via Frontend Transport; Wed, 15 Dec 2021 00:09:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT047.mail.protection.outlook.com (10.13.174.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:08:59 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:08:58 -0600 From: Michael Roth To: CC: , "Michael S. Tsirkin" , , , , Thomas Huth , =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 23/47] pci: fix PCI resource reserve capability on BE Date: Tue, 14 Dec 2021 18:01:01 -0600 Message-ID: <20211215000125.378126-24-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a18854b8-7bbe-45cc-f464-08d9bf5f182b X-MS-TrafficTypeDiagnostic: MN2PR12MB3375:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:586; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WpJ7MufF/p2Elqzvtw6OKiteYbKnTRmTyCBCM1lCtlQZGYz6NzaCVumTzGPgqwHrZRE3rsch78bPicfz9T860VgikMMeLnC5+0z9DL8eSNiwFKVmBS1iR/EXDuOmL1fIQtDXufYacMHfU7J4J2kjenbJNR1CDp/U5h8RPI7HeSVhSOR640OIGhK6gFmH00tsXy88a9XvZwFX43MwsSFtapNBuH9zkYsRybDjWux5HEgsBbkit3/IH0P76yu+tBCTWonY66FCwWzJf2tFk22SPZPAcftgIDcLf69Z3S7+M/N8XF8YqHecQeVWfb6I+5TQkvkTpxAEgw6iGIkjBUFR+Y9PLdBMxQGRj8Br3RAAvEr0dCZOSiMpbjTIPOHZTKgfjhXkGvhG0R/1DyO6qNw8oqprhXNiNK7uaQMp0insdDZoYmLryCqOjRe5xtbDzTcaXlFEr/59vJ4TG4jN5hVe3fKhqTvCBWAPYNWlhQUG2v60ew9SJutJAGRDrztzbZsrDX6zZXkBCejzKFH/xwXZ9qJrmyxkNrGDbBikiAdU/jcOUD9QIw7EuN8dgb8zDelhEvxRHJB1lDic07b7F8CHU5n1iMTaThzLFPjV4tzzh/3AKR9zk8jRYPz0Xwprizh2rMskWsaBGQ38xrRoLH37kZPdAXBaMS1tzvFbM8JYy+k7O3fz+tfTo9y6ocrjWEjAc665HAy68/ChY8O/1yyDjXtsbgAfqmD6Ar/UUjctxNz6buCD6GCdW2Iyi9AUAB6UGO07Sf1A+9g22LeQrxoeAG2ijedC+lTk9eTcDnbZHec= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700001)(426003)(70586007)(36756003)(81166007)(336012)(5660300002)(44832011)(70206006)(36860700001)(82310400004)(83380400001)(8936002)(508600001)(356005)(47076005)(2616005)(2906002)(1076003)(4326008)(8676002)(26005)(86362001)(16526019)(40460700001)(6666004)(6916009)(54906003)(186003)(316002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:08:59.6405 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a18854b8-7bbe-45cc-f464-08d9bf5f182b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT047.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3375 Received-SPF: softfail client-ip=40.107.236.68; envelope-from=Michael.Roth@amd.com; helo=NAM11-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Michael S. Tsirkin" PCI resource reserve capability should use LE format as all other PCI things. If we don't then seabios won't boot: === PCI new allocation pass #1 === PCI: check devices PCI: QEMU resource reserve cap: size 10000000000000 type io PCI: secondary bus 1 size 10000000000000 type io PCI: secondary bus 1 size 00200000 type mem PCI: secondary bus 1 size 00200000 type prefmem === PCI new allocation pass #2 === PCI: out of I/O address space This became more important since we started reserving IO by default, previously no one noticed. Fixes: e2a6290aab ("hw/pcie-root-port: Fix hotplug for PCI devices requiring IO") Cc: marcel.apfelbaum@gmail.com Fixes: 226263fb5c ("hw/pci: add QEMU-specific PCI capability to the Generic PCI Express Root Port") Cc: zuban32s@gmail.com Fixes: 6755e618d0 ("hw/pci: add PCI resource reserve capability to legacy PCI bridge") Cc: jing2.liu@linux.intel.com Tested-by: Thomas Huth Signed-off-by: Michael S. Tsirkin Reviewed-by: Philippe Mathieu-Daudé (cherry picked from commit 0e464f7d993113119f0fd17b890831440734ce15) Signed-off-by: Michael Roth --- hw/pci/pci_bridge.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c index 3789c17edc..6a1e8e433c 100644 --- a/hw/pci/pci_bridge.c +++ b/hw/pci/pci_bridge.c @@ -448,11 +448,11 @@ int pci_bridge_qemu_reserve_cap_init(PCIDevice *dev, int cap_offset, PCIBridgeQemuCap cap = { .len = cap_len, .type = REDHAT_PCI_CAP_RESOURCE_RESERVE, - .bus_res = res_reserve.bus, - .io = res_reserve.io, - .mem = res_reserve.mem_non_pref, - .mem_pref_32 = res_reserve.mem_pref_32, - .mem_pref_64 = res_reserve.mem_pref_64 + .bus_res = cpu_to_le32(res_reserve.bus), + .io = cpu_to_le64(res_reserve.io), + .mem = cpu_to_le32(res_reserve.mem_non_pref), + .mem_pref_32 = cpu_to_le32(res_reserve.mem_pref_32), + .mem_pref_64 = cpu_to_le64(res_reserve.mem_pref_64) }; int offset = pci_add_capability(dev, PCI_CAP_ID_VNDR, From patchwork Wed Dec 15 00:01:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677015 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5DDE7C433EF for ; Wed, 15 Dec 2021 00:30:03 +0000 (UTC) Received: from localhost ([::1]:40202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxIBG-0006Vn-7L for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:30:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHrJ-0000n4-W7; Tue, 14 Dec 2021 19:09:26 -0500 Received: from mail-dm6nam11on2073.outbound.protection.outlook.com ([40.107.223.73]:12957 helo=NAM11-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHrH-0005Kn-Rt; Tue, 14 Dec 2021 19:09:25 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LT/uZTthpWOYVHuQXSeftcaklFBsyrkkxJ/8jAxzMWXQH6zmw8gZB4NwxABHK0JvsOkDcJezLR8hMm1dTGYndYh4CpnMPx3KW6iFCSdPG9uTWA8Ro1saUYSEeYLcna0mttgX24VIA3TKSXLrcNmethxn2ipHBzNd3USgyErCmpYr5mPQOdhe9FCkrKhAHpHmyjQCVxCRc1fO8N8cp/l9N0COB6taiBdPvLtOXceg9WsSK2JsVucJt7kTlllcekPSCZj/8TZDV5CFbEFQrdSZeGH6BpE3oZnyRaDkupqaOJzrBxXvOT5xbH9dfWhXQGhF5CA9B3stcQ3wBW/uwXxiuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PilaNm/eLzo+8DV5CCqH2aP8mI7kdYzWft/M9wReY3Y=; b=DwoV/7855wjexq457+Bcaz288h34kUxmrA0gcQh3zhIqpcwrZRKPLaMTyhn89FH9MutqPMb8E7zY+KTalUu5Ctf9F6TyJEC3tLRR2tDfC2FoyajK7+BNVuGyAxNDthPFHxKyk95hos9A1KncMli40XsuiIcz+TQXwr2q1byWfhq/zvZ7pv72nOYu7C7Hs691wgpwaG6ty6E2b0rFJC3iHWfTLtBfNLRoP19X5v8XAqyHShQ+I58AE/o5ez6JpbTV0JNEoHFHbK8j2Sd72Ako9jY0wLGrvd/31td5f6bcCrC1COkS3vy/v2djCDlOtkcrcxELeoO6Nkp2JEKtDZdg6g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PilaNm/eLzo+8DV5CCqH2aP8mI7kdYzWft/M9wReY3Y=; b=XCXau5rskwDaQKBAN6S9OfvFym58K0/2ttRAq9LixmSVIP8dHdBsXs7q2l303O9CuEyipj6z60j69d46G8YtU/rR61a7AuVDuLtRuQk4YoppwffJMDmidL5Vm7YhqT7PdOALO2FsLvlLNI9EtJy1joCxc7P+rw0/3YLV/i6fmHM= Received: from MWHPR10CA0058.namprd10.prod.outlook.com (2603:10b6:300:2c::20) by CY4PR1201MB2533.namprd12.prod.outlook.com (2603:10b6:903:d9::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 00:09:21 +0000 Received: from CO1NAM11FT066.eop-nam11.prod.protection.outlook.com (2603:10b6:300:2c:cafe::a8) by MWHPR10CA0058.outlook.office365.com (2603:10b6:300:2c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.12 via Frontend Transport; Wed, 15 Dec 2021 00:09:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT066.mail.protection.outlook.com (10.13.175.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:09:20 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:09:19 -0600 From: Michael Roth To: CC: , Ani Sinha , "Michael S . Tsirkin" , Igor Mammedov Subject: [PATCH 24/47] tests/acpi/bios-tables-test: add and allow changes to a new q35 DSDT table blob Date: Tue, 14 Dec 2021 18:01:02 -0600 Message-ID: <20211215000125.378126-25-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 64717c27-b7d2-48ce-2578-08d9bf5f24aa X-MS-TrafficTypeDiagnostic: CY4PR1201MB2533:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:366; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d8ZIZ0Wv4x0u0Am7vbC52xGdvcgYgq/TBB/cRVSZ6qYer7ggzAH3wc1HQljNDIGpRNvXAzsrfnOLzW0bHBsFABr0m2vUjcMu7N7HhpSMYPt8TlrX380Xrbn43/nyv5qoWk6ualZ/e0wjhpdhGdx8lXlKLgtBvoALBiwj+at1QCKvOtom4bZk4KiIv2nXcLeVXAQee8nX2WFOaasc0ED26U2wexuRwf5P8fmrFTsWwwAMqgQ4aT1msjrNsW4a0IlYy9dvHXBWqFO3BbcesN2asUZ6LKgwMepANSOrUdckAgvOc8zuX/CUTnxBu/2elPP1TuTbtmN517+GS2i0pEFJKIwBEqz82E1Ht29gWNONT6bzV8MCcTJCIx1m+LrzvGmR7YM/5yP1R63NkbKQSbTCL4tHZTTbhOWHV55UEYuigyo26kGBaJJzS0pwyKarhT1+EM1qSZ4kXKlkQ6XIWBIaCMAFx5gGz3mnDIbcS5LtthLO2w0/Rn+Y2JQNiXVbG5KrSnCIPxgLnGoW9G1pkpc2DrpeK1a7cEOnDxVKGEYp1vO9G5ENCSPNjrO/GKpIHNiPZn8Z0S/+ngiITQHfJ4AVQV+IHtK/wJPCtQKohaIWsWJYAYCz89vdwjQgbV0nLx2nFHIh56p5pvh9Dm6IAYQVzQtNBF4K04NXW3LjSwhOhLlIWa+QjHqcnPFDd17aMM/YT4zh1GXucDOlX9QbtIVqEcXX8gg+snaAdFrFzQkHu6Wq9GZKZiEBI0pr7dB8c+EgkqBIjILJ6EWD3dkWVQW8x4HUqfbLsOTX/JbmJ3k93g8= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(2616005)(336012)(4326008)(316002)(44832011)(1076003)(86362001)(5660300002)(54906003)(508600001)(426003)(40460700001)(8936002)(36860700001)(70586007)(6916009)(356005)(186003)(70206006)(16526019)(83380400001)(26005)(82310400004)(8676002)(81166007)(2906002)(36756003)(47076005)(6666004)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:09:20.6002 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 64717c27-b7d2-48ce-2578-08d9bf5f24aa X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT066.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB2533 Received-SPF: softfail client-ip=40.107.223.73; envelope-from=Michael.Roth@amd.com; helo=NAM11-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Ani Sinha We are adding a new unit test to cover the acpi hotplug support in q35 for multi-function bridges. This test uses a new table DSDT.multi-bridge. We need to allow changes in DSDT acpi table for addition of this new unit test. Signed-off-by: Ani Sinha Message-Id: <20211007135750.1277213-2-ani@anisinha.ca> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Acked-by: Igor Mammedov (cherry picked from commit 6dcb1cc9512c6b4cd8f85abc537abaf6f6c0738b) Signed-off-by: Michael Roth --- tests/data/acpi/q35/DSDT.multi-bridge | 0 tests/qtest/bios-tables-test-allowed-diff.h | 1 + 2 files changed, 1 insertion(+) create mode 100644 tests/data/acpi/q35/DSDT.multi-bridge diff --git a/tests/data/acpi/q35/DSDT.multi-bridge b/tests/data/acpi/q35/DSDT.multi-bridge new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..dabc024f53 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,2 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/q35/DSDT.multi-bridge", From patchwork Wed Dec 15 00:01:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677023 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 79BA8C433F5 for ; Wed, 15 Dec 2021 00:33:47 +0000 (UTC) Received: from localhost ([::1]:48814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxIEs-0003xn-6k for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:33:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52442) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHrh-0000u8-Fn; Tue, 14 Dec 2021 19:09:49 -0500 Received: from mail-mw2nam10on2055.outbound.protection.outlook.com ([40.107.94.55]:57381 helo=NAM10-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHrf-0005Ms-0P; Tue, 14 Dec 2021 19:09:49 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cv2fsucRPzWwsytMGflu4yAWmtJv69B4VhKz2YDezQecjSKmYb+ZxK7t9GNNS7swwcjULgae71PsuDOk2zV6eohevc5/O95AGNphVvn5O8PRvU31OeTUvjjCQKK7RyRfjFiP5mE3/ulgUvoUL5ydFb6SzLjBlLclu+1m/mgQOusHeXvtSLW9udLNg6HOGBrjAcAnc5+F4gqJhZlbnXkGwOUvUYFB7oeBd3+SGj/hVk+SYWE6J/3itTOmh8K9wxIdFemobIAr63ZA0UtIWoIB8sboRV7U/LVINdb1OZokl8bv774CF7STHNhx8A+pJ/A6faHs8Q02Dtq3BR67hnNepg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CUGJVy9MKFAadviJiXnIN5zeOpHz4uyFhM3aDK2Bh4Y=; b=Vu4dppB4SQK4sQK9lMafIncL8e/67/kH5nKPtH/R8/hPjxHiWKrHKHESvj8fhtwxxxf+e70f7+ySzAaVSnkufKVJUaEEjZQbDd3B0YXi1NW/VY2epG0yR5KfgorbolsgHjSUAeDLQxqsjmi4u0xDEWqXWH2RkJJwnW6HlLQxrr4EhoL3GfNg65Hm0H1gI79lqAQcJYezPN2o0MAj3HLWdW0DG68ib/MwPq2WcCrIKndzJvPrfbt249q9u0HC6kK37sQo1rKW/QhI2sBHEbDFL9BFOiK2rKTEpzOrh4de2T/2NfVR9WotI1c6kfmLeFB1Tfg3SxtveM1PCS28CyJEGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CUGJVy9MKFAadviJiXnIN5zeOpHz4uyFhM3aDK2Bh4Y=; b=Qasxhf/Gr/ozi/keBbgzZyD8BrdUCVfamhog9oHtMStMk53SQHo/9FVaAjmxoUk/icbUZqOoOeum8AFpVeDN2Iwf+gtpVkbJ4EPqDweSMeovXF1KqWTGdnPCdbcwfQQqSGf+7VDDY9TSV8VwkI5Npfjji9h7iLSH/Ed7FHFw6Yg= Received: from MW4PR04CA0157.namprd04.prod.outlook.com (2603:10b6:303:85::12) by DM5PR12MB1626.namprd12.prod.outlook.com (2603:10b6:4:d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 00:09:42 +0000 Received: from CO1NAM11FT031.eop-nam11.prod.protection.outlook.com (2603:10b6:303:85:cafe::27) by MW4PR04CA0157.outlook.office365.com (2603:10b6:303:85::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17 via Frontend Transport; Wed, 15 Dec 2021 00:09:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT031.mail.protection.outlook.com (10.13.174.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.16 via Frontend Transport; Wed, 15 Dec 2021 00:09:41 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:09:40 -0600 From: Michael Roth To: CC: , Ani Sinha , "Michael S . Tsirkin" , Igor Mammedov Subject: [PATCH 25/47] tests/acpi/pcihp: add unit tests for hotplug on multifunction bridges for q35 Date: Tue, 14 Dec 2021 18:01:03 -0600 Message-ID: <20211215000125.378126-26-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e0587d17-faa0-45fb-c32d-08d9bf5f3123 X-MS-TrafficTypeDiagnostic: DM5PR12MB1626:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O2088tey2ViL2BD9AHEGjItw1sphPrKVIhznu5rTBXSGgE+PJVgr9eyYbQgzJNfJOsiw1IcufpyFvHowZgNnwyA6P4eifI/4PnNdq7pufiTqrJv7ds19bZyneLNYpIOYXAVLhvOSTorXYmW23ckbfLZ8kMuRj54Xk07i9kaWHv8KqyiZANd+XWzvRPZoDC80aCmnFRVInfL0Zcpq8mxkhLEzW3HR5v+b+e1xDjf3ZAbeYTCw9bXEAkBhDJdQhPugEEG1UpUbmLnHbpNHOOVlY+6/FkrCcXHVn0oBUtSD4H5EmHLBBNeLgfB9MQAl1r34gnPPj1zrHJxccxWPBvRyCJyVxtOpQtflRjs1gY7XQo5GCFT7zRaX8mcn08qdBYWC8dONiPsvWEHkFIkudJMuka8x5Uvp6BUUhD7q3ClOJFLK/g2Mh0sXXiS/jJrWq1jCG4pFCplZUmXvwB5Uwb2vv3Ttw4fje1obP/M6Pq6Klkiz9e7oDDHPQDVwfcwCPI4bPrHcFdPfRoJKMy6ns0iv6YoP+hG0yw7YEnyyJcXG10rLuvho12nkyfpDyT7b++jRXGpoyr1RY7an/Wtl18S4eZyB7d0zME32PZ3UoQEh+iHf3Je7IKmb174SERrbJJeQpgpYgm0QrpJ1Cgt9xi1GsAiG0tErPMFp4jkomu3pku+Sr6ASF8F5SSg3/J+EaQ4zUzcpNsyxiIlsN7aUnvpS2lpVqk6QYTroetdUfGDvkZHqtysC4KINAwmwR/yXoILO/ArKBjnxMqEwWZjKZiJLz7G+0w4TyzKoUip7FuJ3T+g= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(336012)(508600001)(86362001)(2616005)(81166007)(186003)(5660300002)(6916009)(36756003)(16526019)(70586007)(44832011)(70206006)(426003)(47076005)(26005)(83380400001)(356005)(8676002)(1076003)(4326008)(82310400004)(54906003)(2906002)(8936002)(6666004)(316002)(40460700001)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:09:41.5142 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e0587d17-faa0-45fb-c32d-08d9bf5f3123 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT031.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1626 Received-SPF: softfail client-ip=40.107.94.55; envelope-from=Michael.Roth@amd.com; helo=NAM10-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Ani Sinha commit d7346e614f4ec ("acpi: x86: pcihp: add support hotplug on multifunction bridges") added ACPI hotplug descriptions for cold plugged bridges for functions other than 0. For all other devices, the ACPI hotplug descriptions are limited to function 0 only. This change adds unit tests for this feature. This test adds the following devices to qemu and then checks the changes introduced in the DSDT table due to the addition of the following devices: (a) a multifunction bridge device (b) a bridge device with function 1 (c) a non-bridge device with function 2 In the DSDT table, we should see AML hotplug descriptions for (a) and (b). For (a) we should find a hotplug AML description for function 0. The following diff compares the DSDT table AML with the new unit test before and after the change d7346e614f4ec is introduced. In other words, this diff reflects the changes that occurs in the DSDT table due to the change d7346e614f4ec . @@ -1,60 +1,38 @@ /* * Intel ACPI Component Architecture * AML/ASL+ Disassembler version 20190509 (64-bit version) * Copyright (c) 2000 - 2019 Intel Corporation * * Disassembling to symbolic ASL+ operators * - * Disassembly of tests/data/acpi/q35/DSDT.multi-bridge, Thu Oct 7 18:56:05 2021 + * Disassembly of /tmp/aml-AN0DA1, Thu Oct 7 18:56:05 2021 * * Original Table Header: * Signature "DSDT" - * Length 0x000020FE (8446) + * Length 0x00002187 (8583) * Revision 0x01 **** 32-bit table (V1), no 64-bit math support - * Checksum 0xDE + * Checksum 0x8D * OEM ID "BOCHS " * OEM Table ID "BXPC " * OEM Revision 0x00000001 (1) * Compiler ID "BXPC" * Compiler Version 0x00000001 (1) */ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ", 0x00000001) { - /* - * iASL Warning: There was 1 external control method found during - * disassembly, but only 0 were resolved (1 unresolved). Additional - * ACPI tables may be required to properly disassemble the code. This - * resulting disassembler output file may not compile because the - * disassembler did not know how many arguments to assign to the - * unresolved methods. Note: SSDTs can be dynamically loaded at - * runtime and may or may not be available via the host OS. - * - * In addition, the -fe option can be used to specify a file containing - * control method external declarations with the associated method - * argument counts. Each line of the file must be of the form: - * External (, MethodObj, ) - * Invocation: - * iasl -fe refs.txt -d dsdt.aml - * - * The following methods were unresolved and many not compile properly - * because the disassembler had to guess at the number of arguments - * required for each: - */ - External (_SB_.PCI0.S19_.PCNT, MethodObj) // Warning: Unknown method, guessing 1 arguments - Scope (\) { OperationRegion (DBG, SystemIO, 0x0402, One) Field (DBG, ByteAcc, NoLock, Preserve) { DBGB, 8 } Method (DBUG, 1, NotSerialized) { ToHexString (Arg0, Local0) ToBuffer (Local0, Local0) Local1 = (SizeOf (Local0) - One) Local2 = Zero While ((Local2 < Local1)) { @@ -3322,24 +3300,60 @@ Method (DVNT, 2, NotSerialized) { If ((Arg0 & One)) { Notify (S00, Arg1) } } Method (PCNT, 0, NotSerialized) { BNUM = One DVNT (PCIU, One) DVNT (PCID, 0x03) } } + Device (S19) + { + Name (_ADR, 0x00030001) // _ADR: Address + Name (BSEL, Zero) + Device (S00) + { + Name (_SUN, Zero) // _SUN: Slot User Number + Name (_ADR, Zero) // _ADR: Address + Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device, x=0-9 + { + PCEJ (BSEL, _SUN) + } + + Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method + { + Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN)) + } + } + + Method (DVNT, 2, NotSerialized) + { + If ((Arg0 & One)) + { + Notify (S00, Arg1) + } + } + + Method (PCNT, 0, NotSerialized) + { + BNUM = Zero + DVNT (PCIU, One) + DVNT (PCID, 0x03) + } + } + Method (PCNT, 0, NotSerialized) { - ^S19.PCNT (^S10.PCNT ()) + ^S19.PCNT () + ^S10.PCNT () } } } } Signed-off-by: Ani Sinha Message-Id: <20211007135750.1277213-3-ani@anisinha.ca> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Igor Mammedov (cherry picked from commit 04dd78b9e85720226a148eef54b45cb02b463034) Signed-off-by: Michael Roth --- tests/qtest/bios-tables-test.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 51d3a4e239..921f676e4c 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -859,6 +859,23 @@ static void test_acpi_q35_tcg_bridge(void) free_test_data(&data); } +static void test_acpi_q35_multif_bridge(void) +{ + test_data data = { + .machine = MACHINE_Q35, + .variant = ".multi-bridge", + }; + test_acpi_one("-device pcie-root-port,id=pcie-root-port-0," + "multifunction=on," + "port=0x0,chassis=1,addr=0x2,bus=pcie.0 " + "-device pcie-root-port,id=pcie-root-port-1," + "port=0x1,chassis=2,addr=0x3.0x1,bus=pcie.0 " + "-device virtio-balloon,id=balloon0," + "bus=pcie.0,addr=0x4.0x2", + &data); + free_test_data(&data); +} + static void test_acpi_q35_tcg_mmio64(void) { test_data data = { @@ -1528,6 +1545,7 @@ int main(int argc, char *argv[]) test_acpi_piix4_no_acpi_pci_hotplug); qtest_add_func("acpi/q35", test_acpi_q35_tcg); qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge); + qtest_add_func("acpi/q35/multif-bridge", test_acpi_q35_multif_bridge); qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64); qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi); qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi); From patchwork Wed Dec 15 00:01:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677019 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DDA7FC433FE for ; Wed, 15 Dec 2021 00:32:23 +0000 (UTC) Received: from localhost ([::1]:44548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxIDW-00014c-MS for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:32:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52550) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHs4-0001Gn-Sq; Tue, 14 Dec 2021 19:10:16 -0500 Received: from mail-bn7nam10on2080.outbound.protection.outlook.com ([40.107.92.80]:44513 helo=NAM10-BN7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHs0-0005Ow-KH; Tue, 14 Dec 2021 19:10:11 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MROayHlSfMpOX6vnj6E0ARzYmtKeYlDfPoEKTxw+7DjIUJsysxrH8Go+ONMtK/FXhOYRTiL+ZCU9kS8lsJRK6yemdapH12F6uJ62QA9jnKkipMXWIK4I2FadhU9LRJ8AorCpnsxEYAhZu7I5ILJ8osMRaENzzBeETNjJYkLSw1xKTbU5UxTaWDPVk+edO6M/5J9ge6Azv4s4cjYFeQFx+ZKBVlqrTkywISteNhAh5SEF0bBIrG7w7QigpjU/QUUWtG8PIvPCn5l4NPFBZhOLNTXq37Se0aLQe2oavPzgx/5xFt7YykMt8Q2EYCGZMRuhuyiBSD3CjDALnW1ckSEZlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NbMLtgL5Amo3xeZ70Rl2YYWJKN9FUHJkbJctfm5AM60=; b=fRKPsq3QGFwWJXjoOqYYJEyV/YmTbDSIVuU4lBzt41bSMNzBdfowlpICISDSXwoZbHZrUQWw3HYRpBkd2wlMtuFHS1azbUZwMJfd3lBwWat5wtLmSIrjYwuUSKf4Wnf/yHrXm0nCfKNhkAh1SpoqsD47jmhuNvL534qys26aQTxpL1pTfqho6CwpL3rfmKZ8npBxYYFVTRcnHwX+c/qX+/OnSZOycjHZMQHxx90UlRG3jXQWvRJF+IBnLnEhTuCetytY+mRgXc5boHcT/93+xsnsO4IczdRKWxqgsefx7cuxu8HsO4G4SIvUE6m6Q2vyRRj34lO9YsNxalciAubAQw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NbMLtgL5Amo3xeZ70Rl2YYWJKN9FUHJkbJctfm5AM60=; b=oj7Ii27Hkm/iIzMBoWMkVZ7o12aNJTOm61ekGlDSeceim84YIvvJLH7u9VS3ELuzFrfNdmw98arENR2RyT8PFDLWogcFK1dtxb0vcjjtrL0zwfuLd12YJ2ZhHbgeK/B2T1+sT1Xvllnm9ajCz5LOjzRwSkn8wXBCv3xZuJaon9c= Received: from MW4PR03CA0170.namprd03.prod.outlook.com (2603:10b6:303:8d::25) by MWHPR12MB1709.namprd12.prod.outlook.com (2603:10b6:300:111::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 00:10:02 +0000 Received: from CO1NAM11FT041.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8d:cafe::9a) by MW4PR03CA0170.outlook.office365.com (2603:10b6:303:8d::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:10:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT041.mail.protection.outlook.com (10.13.174.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:10:02 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:10:01 -0600 From: Michael Roth To: CC: , Ani Sinha , "Michael S . Tsirkin" , Igor Mammedov Subject: [PATCH 26/47] tests/acpi/bios-tables-test: update DSDT blob for multifunction bridge test Date: Tue, 14 Dec 2021 18:01:04 -0600 Message-ID: <20211215000125.378126-27-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8bec52b7-3f14-46e3-f30c-08d9bf5f3d91 X-MS-TrafficTypeDiagnostic: MWHPR12MB1709:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:46; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: is1mJmZNEeefE9V9EoZ49Vo2bjZ5TjN+uUiSTZ2jpe8onlzz1+mEV1zILpa8PtSuc2Jq3aW1P6RjvrKQKn1vtANAspjg1NnWMiWk0SQgtFP9fMQHiQfAHQ9Eo+rt7wXH86q76mLXMz69T7+3PMona7Ng5oLge32YD7Ip4S6LUjxtkMfiMRWJhoHKkyG8LO2VY90VHs120fMIiHcKd87krtWtQiQjbkcmDXYBu7oqHa1fUGxMwVMkVP7H4nik7qvoTo5YDaT/E1+mjtULISyox9MinWJhsUeAyxldxMOVg4BlGI0Me2vFSV08gVH2SPiYW6A7Gn+iYG7VuDdulvNavZoL1R5mKXg6ucO27SB+X9JiAlPyDc3OtL/Lizhv9W21E+dYxF3gP+E0CpGNud8gEhZSuUY6Otn7bl5BoMJRLqrMDL0Rmtbh5iFuQQMcrsNRI//weu+0NbY5O8rTTKseH8hdKYn/Ck0I+T8/QzUPDArOIJ8tJTNQOHadijaHDkkVjwrKDGlcNe31PZlGUkmDAns87/boDFNe+J3vDoCJHG3l8j2gMVBX/kKYb9WozJ/Zfp8LukUsX/OqPS1gV7SJp0tyIqVx9NIBXMqluLaH0T+wD1rg7AHH2jaoUQOSnplobqUY9uD4G6kR2AnZZlhd1O8K3yLD0hM/Ibud826C62Ljg1+G3wZR3Pe0/GGvkZOTJ9+5urNriz4QJqig+klTNQo7amKIJns/OSIEVTAhQ6ZQWGf2hqVkXJ1aYvjoU3Tdi1IsPf4Blkg5l1IlXlsZcMxvc7c+caceiDSU3/6xbGw= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(36756003)(2616005)(81166007)(8676002)(15650500001)(356005)(36860700001)(426003)(336012)(4326008)(86362001)(5660300002)(508600001)(44832011)(1076003)(70586007)(47076005)(40460700001)(8936002)(70206006)(82310400004)(83380400001)(16526019)(26005)(186003)(2906002)(54906003)(6916009)(316002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:10:02.3846 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8bec52b7-3f14-46e3-f30c-08d9bf5f3d91 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT041.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1709 Received-SPF: softfail client-ip=40.107.92.80; envelope-from=Michael.Roth@amd.com; helo=NAM10-BN7-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Ani Sinha We added a new unit test for testing acpi hotplug on multifunction bridges in q35 machines. Here, we update the DSDT table gloden master blob for this unit test. The test adds the following devices to qemu and then checks the changes introduced in the DSDT table due to the addition of the following devices: (a) a multifunction bridge device (b) a bridge device with function 1 (c) a non-bridge device with function 2 In the DSDT table, we should see AML hotplug descriptions for (a) and (b). For (a) we should find a hotplug AML description for function 0. Following is the ASL diff between the original DSDT table and the modified DSDT table due to the unit test. We see that multifunction bridge on bus 2 and single function bridge on bus 3 function 1 are described, not the non-bridge balloon device on bus 4, function 2. @@ -1,30 +1,30 @@ /* * Intel ACPI Component Architecture * AML/ASL+ Disassembler version 20190509 (64-bit version) * Copyright (c) 2000 - 2019 Intel Corporation * * Disassembling to symbolic ASL+ operators * - * Disassembly of tests/data/acpi/q35/DSDT, Thu Oct 7 18:29:19 2021 + * Disassembly of /tmp/aml-C7JCA1, Thu Oct 7 18:29:19 2021 * * Original Table Header: * Signature "DSDT" - * Length 0x00002061 (8289) + * Length 0x00002187 (8583) * Revision 0x01 **** 32-bit table (V1), no 64-bit math support - * Checksum 0xF9 + * Checksum 0x8D * OEM ID "BOCHS " * OEM Table ID "BXPC " * OEM Revision 0x00000001 (1) * Compiler ID "BXPC" * Compiler Version 0x00000001 (1) */ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ", 0x00000001) { Scope (\) { OperationRegion (DBG, SystemIO, 0x0402, One) Field (DBG, ByteAcc, NoLock, Preserve) { DBGB, 8 } @@ -3265,23 +3265,95 @@ Method (_S1D, 0, NotSerialized) // _S1D: S1 Device State { Return (Zero) } Method (_S2D, 0, NotSerialized) // _S2D: S2 Device State { Return (Zero) } Method (_S3D, 0, NotSerialized) // _S3D: S3 Device State { Return (Zero) } } + Device (S10) + { + Name (_ADR, 0x00020000) // _ADR: Address + Name (BSEL, One) + Device (S00) + { + Name (_SUN, Zero) // _SUN: Slot User Number + Name (_ADR, Zero) // _ADR: Address + Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device, x=0-9 + { + PCEJ (BSEL, _SUN) + } + + Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method + { + Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN)) + } + } + + Method (DVNT, 2, NotSerialized) + { + If ((Arg0 & One)) + { + Notify (S00, Arg1) + } + } + + Method (PCNT, 0, NotSerialized) + { + BNUM = One + DVNT (PCIU, One) + DVNT (PCID, 0x03) + } + } + + Device (S19) + { + Name (_ADR, 0x00030001) // _ADR: Address + Name (BSEL, Zero) + Device (S00) + { + Name (_SUN, Zero) // _SUN: Slot User Number + Name (_ADR, Zero) // _ADR: Address + Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device, x=0-9 + { + PCEJ (BSEL, _SUN) + } + + Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method + { + Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN)) + } + } + + Method (DVNT, 2, NotSerialized) + { + If ((Arg0 & One)) + { + Notify (S00, Arg1) + } + } + + Method (PCNT, 0, NotSerialized) + { + BNUM = Zero + DVNT (PCIU, One) + DVNT (PCID, 0x03) + } + } + Method (PCNT, 0, NotSerialized) { + ^S19.PCNT () + ^S10.PCNT () } } } } Signed-off-by: Ani Sinha Message-Id: <20211007135750.1277213-4-ani@anisinha.ca> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Acked-by: Igor Mammedov (cherry picked from commit a8339e07f94a47f99560baef59d65a9e039aaf45) Signed-off-by: Michael Roth --- tests/data/acpi/q35/DSDT.multi-bridge | Bin 0 -> 8583 bytes tests/qtest/bios-tables-test-allowed-diff.h | 1 - 2 files changed, 1 deletion(-) diff --git a/tests/data/acpi/q35/DSDT.multi-bridge b/tests/data/acpi/q35/DSDT.multi-bridge index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..a24c713d22102a1a1583b5c902edffe1694e5cfe 100644 GIT binary patch literal 8583 zcmcIpOKcm*8J^`sS}j-7l3Gc&>_n`S^pzr^>^%DjO78Myi4?`9;si8G%5qxCPLV|t z14)bkvH~QIfd)<31U=FL1N7FOdaZ$8+M90;&{Ge+wvgpJq&UJ!9r+w&I z4X>IrJC&+$=kHpk+400#-0bB2CNn$RRiC*V)1A%0OWeB3JpaO4zn<*vr57xxUHj*` zuUAk1{Id&h=I{LMAHTeH)k*+x7Jp6rJr~lUd%bI|cKgmJy?x_dqVsEO{e@3@{IY0s z=t|h7mfN;yqOR5kSKEir`OUn?Yn*M=8#ynxhPu3FkY2S;f3VD$O@l+fKMjY&zlc-j zyv>}NDO48CN~744Dh+5ORqcaHqg7)zV|Twvu|)fZL-E3k#k!wuH2qH2eWnw%@+_p5 zZb(f#?{qDv+qXaNby=^Q8V(1nKlgEOhy8BHX8-zca=-@Gyr?a0&AmTEwcP!NB^X0B z-+h9rq491Xu2h43hYvB*ucDMjwYe3ux|Z#%&p#QLKti<-pIR^Y0E>GRNA;*mra56P zmW?j!GQ%hvm)T|fJrhH=_Ti(o&Fv%B{DQ_Zt>hURq4wd~jYext_MH&-+t9F%HCr~` zioX>%%`*qQ=d<2s?TC{E8lyRZb1!}`&df6o=RDSIc}LZxqWj0Y4q3`x1Gho&$bVO;(5%1zu6XUT#5p(kSm_Yg+jg7G*Wj3jRLPw z->zjFRsW@I+bC>!>&$(u;T6xv+K*5)9EN*@2;VmL8THZr9yJe``*m#wOcU+Wf{Z~R9I#l^x z#(99skeKM7V`H2NY!newLSu|G0p(1D#6&e58|O?}L7Wj&LgRu7C}$!hrp$tQC9u4o z1ZPTULNI0V2vwa)O=prbB{V6RvUr55&M8gj6lY54l&%w@s&iV?Ij!lO)^#FOb()$^ zQ`2ecIuWWm@di>xdPdVZqw7Sd>a;YSmZsCvbs|)CrZk-?O=n8iiBQ#vccF4WZB3`G z>qMyPoYi#BYC30iod{K(bDGXMP3N4h6QQbeUeh_R>73VfB2;xcnodX4>F7EUsyfq} z&a|d8t?NXn>da_5Gn&qft`niEb3xO&py^!Dbs|)Cx|&W`)9LCu5vn>DHJyu^&P81( zLRIIIrgKTtxuokvsOrR*1fD+m9$MCPF6%lGsya_-I!|aiPv|-ksya_{Wb5b46z&RGFtV<|&PNN@pTenWr`8X^nYWXChRY4{6MYH0DD( z6QRm{m@}ozJj|K$9sjUk$`?06V#+(Xs^whOa<1w*5sI893^cD8XgR1NH8)cO=SUnG zC<3GvK^%ch3Ii25Zb=3smaNY}QUN_OP=rz%3{+sHfhtfkPyszMP=u&P8mPcV5#>}3 zR6vgm6d@|&SQx0lMp2}ZL&-n|REDZf7^vu$Ghv_#lnfN1bVV{ygiR6seC3>2Z%2?G^a&V+#~P%=;f= z3{*fllMEE0)CmI>Sk8ojDo`>|0p(0GP=rz^ z3{+q_69%e4$v_2^Gs!>^N}VuJf#pmXr~)Me6;RG314Srx!axOM_lrzad5lWpfP=V!47^ngz0~Jut zBm+e#b;3XemNQ|X3X}{~Ksl2P6rt1!0~J`#gn=qhGEf2KOfpb}QYQ>lU^x>8szAv= z1(Y+%KoLrvFi?TzOcu&LjgxD0RX>5h(_WNHtJ|s(~U@3{+vlKouq#sKO)z zRhTePg$V;ym}H;|lMGa0!ax-!3{+u~fhtTgP=yHtRhTePg-HggFv&m_CJYpjyt^<^ zM7U#oFv&m>;x@>Tm~w1kporwy!axzpu_XgVD94rz6d{(1Rywdy*0+27pVa~VLwb9P z{^Z*?e*9#d{!67*4O;Io8qKXd9Cxcg2agWE$*}gaRiyJ09m;g5nC?P#3#$SBnd{cU z9u`?<23E>_s=DPhX8>sC(sNeo!znhySAyPVx2VlZ;#du@?^*MV&QL@XOD`MK_(sUf zB@Y|RHMAIHqU<2OWG#F+$7bSiH-`5&!<;37Ua%YcHyS(o=hsy)cp;iznYYdqK%w;MohPPt9I%Cuc9T4{M}dETv(& zFVb$s9w5D^r1yAwZzR2UOnNU$?~jPLu%Pv=)%!|%pQran()-7x_oMX1(e#N2NMBUa z7kT>PNc!S2>5EbN(rEhR1Eeo0=}SC)X(WB=nDnJ6eR(wf)B~h1E9uKTeR(8(`Iz+O zD1Bu#{qzH*uPEs&Jbh&(edU<+6{Jtlt86sABht&42R-NpK?-sVp6DUUxiucPip zr?HjRyTiA}Sa+grVs~TnGNX5g50J6$MBBvf#^xE8fN7pdVfZQ;>rS*y>~3t{xO#W^ zR2l0|v`y@8Y#uD?-QoLXtUJ**vAeP7dP(mNA2nm$iMEN|jXkH!dUyEJ8S758>D@V} z?yqMb&Ih#uwpy^QV#l%O?`*yxb|)&<#rrG%jb<^BPpO5;32&P98r#{*Yj1|HUi(${ z^;h0_?b_?Rue`z9hS%6wkDk_9%PJdR+F#m+ja7Yk5-pv7Xw~UaOOmVyOJt08g&rpM@0OOlz^j|b$S}Qn@j@mx4B2jI zT>jk8^e!7AyBr$bknMcFVgI(*H9p-%Q#aflP00n1HsYrAmp>hC#ckRBqCeByv4%+V zML6kt|Ix9Lqx&B2-lQ6L*tH#0b^F==(_=9HWZ?GgTJdmfU~mzPTPLOs_mO&;djjJFxI>|=&`^3yWbKL#({pD;F|6&r0O=#|k%4D-b5 z+V4F_&ot&gewZG3uFU~G-IxKjd@G%@Oor74`VMvHuxZ*#kr=kOf5kn8$y06=JH^~t z7R`8?Nc2oOn+dwaCw?@ia?ddLd0^KV4aCuopxCie8X8`mSE?bL+M<}Ld{c<;m7Y&o zf4(`(Vpt-;Z%7C17~Zq**@lUB1MejKzQ*Ny_E9{GJtW5d!#7#^b^0tG4(YR)elezP zzna*_`lGnQ{-9mCgMHa=#FaZQ+pt6`8zQ?m7Oy9PUrbVqta-KA*OBQ`<-BrCcIzA`?_P_v5gbhru@N0 zqz}$@GE)fywd4G$PR2}FF$;@$h@Pe^q{R8j{oBw!e4=#06TUaQRjh5}F*-|VZ04#J zJ4q)=Z*j+8zR0)sHkRlvwhvQ5E+_VkF(f|>a?gnXcg$cg<6zBa*tEpSS$T4fPTGfM zGgyn50LPeF!21RtF+UX@2HSO%LA(8KrbDhko1+Bj;0nH|u&-$kXm=A2@ztaDjQ?W2 z73-(2?-}fU>S*6xrDu_a2JNQORg}GLL?^x#7lk|@RSnw_g`mLyQz7h_LfjQz=r5iK P)}F_He7!|yIezv(me~h+ literal 0 HcmV?d00001 diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dabc024f53..dfb8523c8b 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1,2 +1 @@ /* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/q35/DSDT.multi-bridge", From patchwork Wed Dec 15 00:01:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677029 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1C390C433EF for ; Wed, 15 Dec 2021 00:35:38 +0000 (UTC) Received: from localhost ([::1]:53544 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxIGf-000785-8S for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:35:37 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHsO-0001NM-4p; Tue, 14 Dec 2021 19:10:32 -0500 Received: from mail-mw2nam12on2081.outbound.protection.outlook.com ([40.107.244.81]:16896 helo=NAM12-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHsL-0005VS-Jx; Tue, 14 Dec 2021 19:10:31 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ipuXNRLRXYoWP9k0RNpj4YUNvuU4eqshppMp4Jm7QdE46qov9/2zsOoSMzWXeopgaFczbpRq57GuT+p30ax7t3Uk3S8eEA58aXVbn/feSNKv/FQslgGPvKLSqs7rCUIl6KyqdIxh3s+Y4TxIER8cy7nwVCd4nEsyUcp5H6Lzyqli5ajxRxoexKYPYISV0wmbdbpU2V+cmtZmiD5YfGRlzSw/40NoqvpfujWgGlp2NSHNmm1oyZAbX0Gf81i4Eo21c38jYdsX6BRZEJYCZqU/9VhUqmFqAwPe5TkgMZaBridnXU0IGbdBgyKnJHwI5epmmOzObi2LO1uXLqGxeEVrEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=X11cfneiBeTamFhEkZ/2DS9tVJ1XkSeqwyW5aXl7nE8=; b=geWk6/I5udrBT20f+LbEnUKyZB4Kwq9y+Iy7+WO2zD6nRcBHOtXYqBrGt9tUL14037lt1BGBQPM5UNfDPu2aXY6L4OQB82SpuGz6tfZhF0n6uFRcW2GN31Ba+VXU5LFLEHg+gnW7wQARNtrKSUdXz1tFDngGcQsML/lqcT4wXx94saNXwMqylpchubMuVwinoNHpTP9W6x8rIZ661WdcFk7m1QiWLh7Mqv6lcWUnM5PakSyjrXn/EVZXGXcszU+J/ukKjXvDykoyLGSiRjpFRPmpqzuQ4AVNmLfzAEtVqpO/ehuoLYQU5FH4Q9yzZT8s7Lkogh7TmMnYjxlZsi2/2w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=X11cfneiBeTamFhEkZ/2DS9tVJ1XkSeqwyW5aXl7nE8=; b=T/Tzlzm/V2VIhdFjVAHW22hl6UBS9bOsyDY2STc9scgSgZ7qrYJ6Sz3ff13V+NpJajk7PyVazqMAahBurvfzWRNSedo4qhD7GwSugpkguCVgU6oSspdylqAV3sSumUXhYasLE8eiTnP9bS887xw8LNuA3pxpRvuRKHJDfTPkF/U= Received: from MWHPR08CA0052.namprd08.prod.outlook.com (2603:10b6:300:c0::26) by BYAPR12MB2999.namprd12.prod.outlook.com (2603:10b6:a03:df::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 00:10:25 +0000 Received: from CO1NAM11FT026.eop-nam11.prod.protection.outlook.com (2603:10b6:300:c0:cafe::ae) by MWHPR08CA0052.outlook.office365.com (2603:10b6:300:c0::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:10:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT026.mail.protection.outlook.com (10.13.175.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:10:25 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:10:22 -0600 From: Michael Roth To: CC: , Ari Sundholm , Emil Karlson , Akihiko Odaki , Stefan Hajnoczi , Kevin Wolf Subject: [PATCH 27/47] block/file-posix: Fix return value translation for AIO discards Date: Tue, 14 Dec 2021 18:01:05 -0600 Message-ID: <20211215000125.378126-28-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3a3528e0-b692-4fee-e318-08d9bf5f4b19 X-MS-TrafficTypeDiagnostic: BYAPR12MB2999:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1728; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I7V4Avgkp7gBp5R4/O3n50NaKZXnoKTzW1dgMlriXmMQfrS52Bs73O9aVTM/Q67zRoUwdyDazwpguy+LXInIOggO5mp21A3uLjUtefgKK79AtEUYl7N6v0YvnP9hdxso6tXf5IVIjYtpkrmiZyIAJ4W1s+c4sUCKO/vZ4cd0SEUHYSCGtpu9KeQmoCn8X/7aba4XcEEl3EUo48/F48tI7yc8b+YPQgS6h8IcVIcNKVL/rJtWC++Hu7W0limj1HqsmmKSfChudH9lWw6/7JLRgPU6Y39/jQS7r2Gmxn5lTc2Lqr439aKoJr2oOz/nIWK4Ms4IUCFm4swnWkfZ5fqVvsPSCqXTUC8zpXpUwksafEs5uG8RQhJFJZXmnj5fHGEXndgpPl4Obno3Krzz5xuTpYcp83dDar7a5YZVg3G402NI8gJrKbI+zPwyFzgEZctYmBzJOsA0KKUX8BEaWCZAh6wWWYWMXrjWR8aWEJpFi1j7j6iQkcs3uUq7vJxg8nOdf3gpD3zkIwE6m+PE70uB12KSraG6ErMoAkHjLsLb26HiPfR37y085k7MGZD3nkaEAa7OT/u36IubmJIG0YHvRoe2uaE5WYbTiJp8A6lWEeQPVg5++NRBFUjdldvJPks2aXdKAMXLoWbRvCeo9l4eYfnySUWsWERfAeJwqvBL3T924z5zdA95Lqnd8vtFmv2bZpKYGTJhVfnpG/fsU0sKeMLFCLEhQEVkZZAdbiiL+QP9Vu52xqntJgdRyzDy9HnhkgEe1/j7GvnUFIu8Tu3iQ4e961uT9yiAZDA2DpoEOzQ= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(36756003)(82310400004)(36860700001)(356005)(86362001)(44832011)(2906002)(2616005)(81166007)(508600001)(26005)(47076005)(5660300002)(336012)(186003)(1076003)(83380400001)(8676002)(54906003)(40460700001)(6666004)(316002)(426003)(6916009)(70206006)(4326008)(8936002)(70586007)(16526019)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:10:25.0919 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3a3528e0-b692-4fee-e318-08d9bf5f4b19 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT026.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2999 Received-SPF: softfail client-ip=40.107.244.81; envelope-from=Michael.Roth@amd.com; helo=NAM12-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Ari Sundholm AIO discards regressed as a result of the following commit: 0dfc7af2 block/file-posix: Optimize for macOS When trying to run blkdiscard within a Linux guest, the request would fail, with some errors in dmesg: ---- [ snip ] ---- [ 4.010070] sd 2:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE [ 4.011061] sd 2:0:0:0: [sda] tag#0 Sense Key : Aborted Command [current] [ 4.011061] sd 2:0:0:0: [sda] tag#0 Add. Sense: I/O process terminated [ 4.011061] sd 2:0:0:0: [sda] tag#0 CDB: Unmap/Read sub-channel 42 00 00 00 00 00 00 00 18 00 [ 4.011061] blk_update_request: I/O error, dev sda, sector 0 ---- [ snip ] ---- This turns out to be a result of a flaw in changes to the error value translation logic in handle_aiocb_discard(). The default return value may be left untranslated in some configurations, and the wrong variable is used in one translation. Fix both issues. Fixes: 0dfc7af2b28 ("block/file-posix: Optimize for macOS") Cc: qemu-stable@nongnu.org Signed-off-by: Ari Sundholm Signed-off-by: Emil Karlson Reviewed-by: Akihiko Odaki Reviewed-by: Stefan Hajnoczi Message-Id: <20211019110954.4170931-1-ari@tuxera.com> Signed-off-by: Kevin Wolf (cherry picked from commit 13a028336f2c05e7ff47dfdaf30dfac7f4883e80) Signed-off-by: Michael Roth --- block/file-posix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index 1567edb3d5..dd295cfc6d 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1807,7 +1807,7 @@ static int handle_aiocb_copy_range(void *opaque) static int handle_aiocb_discard(void *opaque) { RawPosixAIOData *aiocb = opaque; - int ret = -EOPNOTSUPP; + int ret = -ENOTSUP; BDRVRawState *s = aiocb->bs->opaque; if (!s->has_discard) { @@ -1829,7 +1829,7 @@ static int handle_aiocb_discard(void *opaque) #ifdef CONFIG_FALLOCATE_PUNCH_HOLE ret = do_fallocate(s->fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, aiocb->aio_offset, aiocb->aio_nbytes); - ret = translate_err(-errno); + ret = translate_err(ret); #elif defined(__APPLE__) && (__MACH__) fpunchhole_t fpunchhole; fpunchhole.fp_flags = 0; From patchwork Wed Dec 15 00:01:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677037 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 66F4FC433EF for ; Wed, 15 Dec 2021 00:40:20 +0000 (UTC) Received: from localhost ([::1]:33828 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxILD-0004Yj-Dz for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:40:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52682) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHsq-0001ix-8d; Tue, 14 Dec 2021 19:11:00 -0500 Received: from mail-mw2nam12on2080.outbound.protection.outlook.com ([40.107.244.80]:26272 helo=NAM12-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHsf-0005cZ-PM; Tue, 14 Dec 2021 19:10:59 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C6Wl3uTC0nTj9FMkWsfvi6rPltuBGhuTxpmu3CgcHWYsnPE8KLmji+9tZUKWbfkK3WfMWPL4slWdYYVhEleWBZ/yMyqpxn0EW9w/LwYb8TIlgwfgCBYMzR7lSEWOIygOdFvbor4wI1328WfTt44YKf3G3i6AAXWk1JQlp/doBYIaSIdWAU3KGKEBrOGsNGtKN8P4kVZLX79AjwiR1ZFbHW67USjKtPKDJX4hf9Sg0VDVBKueGqEVP4OmDugPaB9NC2qqFwJF2Ke5XKWq4VytIVpV8j726QI6sglWehLao50AdFWSoFGvEqI04RkJnVKA4DLtfh3wu5Ke9aCoLDIjUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5nFAYyG/zwx0dsf/QQOoIjCAp60iDyS+FBdQhppE09M=; b=MCFI5GZzKPSeXGloixCloyYrEDgOwGpS+LMMoxSTiYeLLhZAy0gGkGHcIwS5Tj3qZrTeYLwHSPYvDPughwltNldUIG7Qn/WV/Ab+GcwvinPICPAKYQHb2GqrDxBY2VAiO8dZ/UahCNxndcFFJOD4feJ0m9cDBMg2h5c36kWSFkpDTG7dTSLxK+Kvr83BE1W+qQvnJPOYutb6oBaPgsJge0Mic1Mt8wtv4l/0gZwq/4ksXTZ5ikj5Kai4yR65AtONiGaQg3s8N1jxeMJvdCvQuN+kKWHRQOrbR5ZjFgp1cMcwyZb7ACB2etMWGdebfvwTG84ERvPlWAV55HYsI/Jvug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5nFAYyG/zwx0dsf/QQOoIjCAp60iDyS+FBdQhppE09M=; b=em5n/5Fw4fP5eFFI0xfHAjqJjdWznK485GjBnIg8iCNk2jHHPZC+Z30+hJ/1QRUZMTKbdQc/vexOL0hNIH3Jpkk05QHkqnO/1oXUXz7Ufn37fquOGc1k1EW3tztESko3+rniC0JjUNfXCuU0+5dvjYkz50yvM5ZrZXgDZ7o+WxE= Received: from CO1PR15CA0055.namprd15.prod.outlook.com (2603:10b6:101:1f::23) by BN7PR12MB2724.namprd12.prod.outlook.com (2603:10b6:408:31::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 00:10:44 +0000 Received: from CO1NAM11FT037.eop-nam11.prod.protection.outlook.com (2603:10b6:101:1f:cafe::9e) by CO1PR15CA0055.outlook.office365.com (2603:10b6:101:1f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:10:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT037.mail.protection.outlook.com (10.13.174.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:10:44 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:10:43 -0600 From: Michael Roth To: CC: , Jessica Clarke , Christian Ehrhardt , Paolo Bonzini Subject: [PATCH 28/47] Partially revert "build: -no-pie is no functional linker flag" Date: Tue, 14 Dec 2021 18:01:06 -0600 Message-ID: <20211215000125.378126-29-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f7de5a28-fca2-4d1c-2dc3-08d9bf5f566f X-MS-TrafficTypeDiagnostic: BN7PR12MB2724:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2733; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AAeStbqGihALXyuG6tpLSwn8yZfkcaJ39S9nEAEJDvsl0lS7dB88HmXnz50uH7cRxhOCrt9ZHjmO/LH44aUxznsUi5MZTJ0HjLJr0EmSBViD0GzUHRvIB7BhVq0rzY4q5sy5Sfpj+a8Z2E6JwtvbI8XpcvxGxELmVUBjtI0DgEfBNgr231L1A1a6cgdOBEgBHVNGD+E50aLHFj/zW2RpJZV7ftVYC59AaVRuOMT4rYoa2ivnSkxHZn7/38Sz8ZwVVdIaUNFnRJ6HUJMVNFIkIGemXV+/lN+2fQtJUMsUNYrM6iohAzskf4pQiUtrryFpEWUwBym+UXuovfx/uwHduYaEPyrYY7uEtGYAbi4PT8Spoqo1xSry21b2mWCoyM5Re6sXSTEnsnSTDiYFCP+GKBIccKZ8c2rwmG+h4ZkOUYIVcqYlbF16iavT4HubfDo0EA2SuSgBptmUFZELjYJ0b0LsXOTxNckvV8zL8wkVYnTY3Oxad1HVi6T+VQezMrE3/0315j97IihzSVqLHcfiLVirkfUCeiwRWpC/yV6/Dw/VbbHOlhSgfhxNg0KiVBAWMywMlLojf+oysXSq6wSaYeEqM4ThtDtRmdvm7bfUZL0GXa77M+cWDBTnOnQ/YsVa/RdQFicSch/50pVUXNl3oHg/k30OY6De/Gb2S2JvUUs4Mn5QyCRE2fi9Jk0y5GOiFx1pV87gU/1k4pFWDqcaGJRiVb67xK2elMzGFSPpW0oJnXwrwTAg7MtJ2yHFkD0H4hZ4g4GSaECevAMi/j84e0XfbLKLD2znx1lxjKR2ZzQ= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(16526019)(40460700001)(81166007)(47076005)(186003)(26005)(6666004)(336012)(70586007)(426003)(2906002)(356005)(82310400004)(508600001)(70206006)(86362001)(2616005)(8936002)(6916009)(4326008)(54906003)(1076003)(44832011)(8676002)(36860700001)(83380400001)(316002)(5660300002)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:10:44.0998 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f7de5a28-fca2-4d1c-2dc3-08d9bf5f566f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT037.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR12MB2724 Received-SPF: softfail client-ip=40.107.244.80; envelope-from=Michael.Roth@amd.com; helo=NAM12-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jessica Clarke This partially reverts commit bbd2d5a8120771ec59b86a80a1f51884e0a26e53. This commit was misguided and broke using --disable-pie on any distro that enables PIE by default in their compiler driver, including Debian and its derivatives. Whilst -no-pie is not a linker flag, it is a compiler driver flag that ensures -pie is not automatically passed by it to the linker. Without it, all compile_prog checks will fail as any code built with the explicit -fno-pie will fail to link with the implicit default -pie due to trying to use position-dependent relocations. The only bug that needed fixing was LDFLAGS_NOPIE being used as a flag for the linker itself in pc-bios/optionrom/Makefile. Note this does not reinstate exporting LDFLAGS_NOPIE, as it is unused, since the only previous use was the one that should not have existed. I have also updated the comment for the -fno-pie and -no-pie checks to reflect what they're actually needed for. Fixes: bbd2d5a8120771ec59b86a80a1f51884e0a26e53 Cc: Christian Ehrhardt Cc: Paolo Bonzini Cc: qemu-stable@nongnu.org Signed-off-by: Jessica Clarke Message-Id: <20210805192545.38279-1-jrtc27@jrtc27.com> Signed-off-by: Paolo Bonzini (cherry picked from commit ffd205ef2901bd65fcfbd09a98c0ff7cfcec5e4d) Signed-off-by: Michael Roth --- configure | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 7659870810..6e308ed77f 100755 --- a/configure +++ b/configure @@ -2246,9 +2246,11 @@ static THREAD int tls_var; int main(void) { return tls_var; } EOF -# Check we support --no-pie first; we will need this for building ROMs. +# Check we support -fno-pie and -no-pie first; we will need the former for +# building ROMs, and both for everything if --disable-pie is passed. if compile_prog "-Werror -fno-pie" "-no-pie"; then CFLAGS_NOPIE="-fno-pie" + LDFLAGS_NOPIE="-no-pie" fi if test "$static" = "yes"; then @@ -2264,6 +2266,7 @@ if test "$static" = "yes"; then fi elif test "$pie" = "no"; then CONFIGURE_CFLAGS="$CFLAGS_NOPIE $CONFIGURE_CFLAGS" + CONFIGURE_LDFLAGS="$LDFLAGS_NOPIE $CONFIGURE_LDFLAGS" elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS" CONFIGURE_LDFLAGS="-pie $CONFIGURE_LDFLAGS" From patchwork Wed Dec 15 00:01:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676977 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A7EEAC433EF for ; Wed, 15 Dec 2021 00:19:16 +0000 (UTC) Received: from localhost ([::1]:33200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxI0p-00080Q-Ov for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:19:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52754) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHt1-0002Cy-DS; Tue, 14 Dec 2021 19:11:11 -0500 Received: from mail-mw2nam10on2076.outbound.protection.outlook.com ([40.107.94.76]:29057 helo=NAM10-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHsy-0005ea-Uw; Tue, 14 Dec 2021 19:11:11 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TqJwfe3DHoqVUCZLDRV70IyRZGQ8m8ueztA9pZRH5DuRUd38XDRisjejTiE69RkG3MMrpplf8Y0V72DtSBeysY54JaSJ7GDE982Zz/O7aD/iZMyzwDWjdTnqeTEOtFq3vigHOPkXSZKoST9EwrmLHBJ38a1WWbGgiy/+paQaEJO9RRcLo7oWvYJqLmdLXew7BxfNH0TrOeaZQoWymb9j4TlrV1HT1EBNjYRL1leUvyKbkxhAQIxvm/r5+ij6gyydsTJSTbYfxy9g3ZnjZWRS2dgW0DIg/3FJ13+c+B4U7bk6Bx5VXMhxfizJvjn7cD2mawyK4o9zy0caoBGRdJC7lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mx7+9Ejo7oDq2KCbdfHMy0z423O59dIWRaxqfqHMZUk=; b=i/Tbf1CvtJ6ZjOopr1kJoiJjOrXYWl1nVIXMf5r5VnLANmVjlrajh4LQsqkCVgaa32G5mifunbb2K76+ZvIvQdk8rnIdX2IP7R+EHgxX2zNyqSiLdjyovHZ/Sm282JrVdvVLs5JFYKKVIO0EMpw/1242V5Ocw42mkizHBm28Z9bWKA3TB1IX6jbaRFgHPLyymi0urOo7Xt+8XMRwI8Ugb/XapTyW/qWcCeKGSft5ZikKr/F3Cu2y5O5J43taIenvT1FGCeWAOuGA3r6XuXXTq5ilOG//EdTdq3ni2LOvR/S+B0tWFnO4H+n2a14cWT9xB+yNmF0q9Q/ZEhpbJuVwdQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mx7+9Ejo7oDq2KCbdfHMy0z423O59dIWRaxqfqHMZUk=; b=AU65ZuiiwfEL7C2xicXv0oW1prUSDJQFBEkHuF0z8qz1/qqjlLsuTOSSDLq4YU0J4pEsFTquzDJUepvV26o+XHlxagqRq4lIXceXyBTvY1wTHUkfYYgHPQcNVm3MxPW2g7zjd2EzYoC22frZRw57nNffpwyELj3z6Wqo0quYLG0= Received: from CO2PR04CA0174.namprd04.prod.outlook.com (2603:10b6:104:4::28) by BY5PR12MB4308.namprd12.prod.outlook.com (2603:10b6:a03:20a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.12; Wed, 15 Dec 2021 00:11:05 +0000 Received: from CO1NAM11FT048.eop-nam11.prod.protection.outlook.com (2603:10b6:104:4:cafe::18) by CO2PR04CA0174.outlook.office365.com (2603:10b6:104:4::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.14 via Frontend Transport; Wed, 15 Dec 2021 00:11:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT048.mail.protection.outlook.com (10.13.175.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:11:04 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:11:04 -0600 From: Michael Roth To: CC: , Paolo Bonzini Subject: [PATCH 29/47] target-i386: mmu: use pg_mode instead of HF_LMA_MASK Date: Tue, 14 Dec 2021 18:01:07 -0600 Message-ID: <20211215000125.378126-30-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5d09a9eb-5c2e-4054-61fa-08d9bf5f62bb X-MS-TrafficTypeDiagnostic: BY5PR12MB4308:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:773; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LOZ+sVSnT4UfesGOA6N4UfWOVRQpgWt/0Vt7eqSdsJsyMGm63RgFzO0ifu827g7zjWoQadWEvHCJOPPF6mDJ+cdlcDlm5W5P4h0lc9ViWZzEzwjS5CKk9+QyhzXoCbP+gXXaf8d/3tdAfwDsfxAJwaYmdZ37trpwKzrVMD9/EZnKZs6+ytRAVRaLK2J5XZSHZc8Tr/zm4HKt7bekoADqbCsjjmxNs9bK0rGBnBonUSDOQoSdlbCcHJ4coRucQ1cZOEa9jL1LiaIR5scSxbD1B/y5rrSKGiWSr74z+OfRRW834a14HbZc5jzw74xBYoJmv+C3pE40l78ylXCAjwdSjcpaMKIkFm4h8ItRZiydPkv9ZrrPqj8G6/pF5WOVLZvpUbq0dhVsPkwozXcPMtPnaPFxdwD2QqGRA1Ol0PVZNEUx7rH/X9Dua8FMQkbU1nlDS9IPoMAvOZ6/OaccqzcuKrr4Hw1b6JbjjuHf1hqFbrjGRFizBfcpV5BD2psxZLWCPoNeQoUm+33MU/XUMTwSuM8XIQikoRtnBqkohknumLhkMh1loYzk/ZUaIKzFGXoOVsyv68paXGA7Q3kvR0VUK9G/qekf06BMlHqJkufg29HmRGkjMWwDWCRfjAz/n0LzUsisZJ7In+1fpDwGiwdBghYluk7B8UU2VU5V8O9LpJQLSs7d8Nf0WeC5CPXg4pzwotdC9Ad37Smoh403xuXNOrpitOXAXlIMVPwNt5YuWCMlDtNcknacsm4Izz7AU4/KCHwOb6iMc28OvWl75amSRKCuubgHaLjOZdvjyOE07sw= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(70586007)(1076003)(81166007)(186003)(47076005)(2616005)(8936002)(70206006)(356005)(316002)(426003)(336012)(2906002)(40460700001)(16526019)(26005)(54906003)(6916009)(86362001)(36756003)(44832011)(508600001)(82310400004)(4326008)(8676002)(5660300002)(36860700001)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:11:04.7475 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5d09a9eb-5c2e-4054-61fa-08d9bf5f62bb X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT048.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4308 Received-SPF: softfail client-ip=40.107.94.76; envelope-from=Michael.Roth@amd.com; helo=NAM10-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Correctly look up the paging mode of the hypervisor when it is using 64-bit mode but the guest is not. Fixes: 68746930ae ("target/i386: use mmu_translate for NPT walk", 2021-05-11) Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini (cherry picked from commit 93eae3583256896dd91a4c2ca38dcbb8d4051cff) Signed-off-by: Michael Roth --- target/i386/tcg/sysemu/excp_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/i386/tcg/sysemu/excp_helper.c b/target/i386/tcg/sysemu/excp_helper.c index b6d940e04e..2dea4a248e 100644 --- a/target/i386/tcg/sysemu/excp_helper.c +++ b/target/i386/tcg/sysemu/excp_helper.c @@ -90,7 +90,7 @@ static int mmu_translate(CPUState *cs, hwaddr addr, MMUTranslateFunc get_hphys_f target_ulong pdpe_addr; #ifdef TARGET_X86_64 - if (env->hflags & HF_LMA_MASK) { + if (pg_mode & PG_MODE_LMA) { bool la57 = pg_mode & PG_MODE_LA57; uint64_t pml5e_addr, pml5e; uint64_t pml4e_addr, pml4e; @@ -287,7 +287,7 @@ do_check_protect_pse36: *prot |= PAGE_EXEC; } - if (!(env->hflags & HF_LMA_MASK)) { + if (!(pg_mode & PG_MODE_LMA)) { pkr = 0; } else if (ptep & PG_USER_MASK) { pkr = pg_mode & PG_MODE_PKE ? env->pkru : 0; From patchwork Wed Dec 15 00:01:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677035 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9FE6CC433EF for ; Wed, 15 Dec 2021 00:37:47 +0000 (UTC) Received: from localhost ([::1]:59926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxIIk-00031f-Ia for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:37:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52782) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHtU-0002uw-Nv; Tue, 14 Dec 2021 19:11:42 -0500 Received: from mail-dm6nam11on2046.outbound.protection.outlook.com ([40.107.223.46]:5984 helo=NAM11-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHtM-0005fy-HF; Tue, 14 Dec 2021 19:11:39 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DimdPShWFVshfoC9vhAgs2NlWaghjzqzu7P8xAccbenRoruPdcjjwW+lKRaytTJ8SJIpViFPtzsIxcZKdFNGI1OEGvlya++PbASIhyE9RuhCUYut18grM/QgNTslxY909q0DcojR89zfAhhJTTxqkwFO6XN4J1y5yTdQF0cBXvUhy++4uP/LJOljbY0d5UxNWfIWK5SHuuF/XlRfeupVw/VlmZKaIPRehr20tYS5qu6Ta+nugGhco354gP3/Drmho3742zHe9dMt8LtNVOhKgnffOyVc4Nu9ZSLicV5oQWsOiPvQtHGeVI+hqbF6CreTo35+soEWU9vQxHJbcOZmlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lwxovqaTRYl9CpleMQy5WtqMwM62WmUna1KfC6QdglE=; b=iC0hxtd/Cmb6FVa8EMgEbu057BjB9i4560o9FHzxrccklkfHgqFa/c8eVPW3Do4WiMEZwgWHCx2i9t4NXuwOCD1mz46wmoE5kzovwkM/c52qID7FdFyD1GLAv6NmboJp5wrgEbvQPKmrE8aGRS9hhLznhTtQBAF+t3RNCFYA6ut9oI6gDlfhf1iNYl9tRkwf8bh92LNxm1waIJPc7CPZez4h7CLJcsztadpppsmTOCOh6IRbWzL5udRJBn3jNQyUcdriEYPm5GycDoPdsn9tDJYaoWzcNvM1L8ug1YkkqS4BBLvJqJD9stRVNIOnczfGmftgcggkvAwku7CNo/vN8Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lwxovqaTRYl9CpleMQy5WtqMwM62WmUna1KfC6QdglE=; b=Vqllg5GEQha6Yy+sv39dLCO0BAdq50LFBsDa/DmYEeWFkINyT/QYXcGci/U/slWXr7PPyTnLYQWwmpF8ZkVAhKu5PuqCMg6Oqwj/k6DTa+ROackJMwAvcsieCjUac+OAf1SsWDLc6lNyQveT5aUmTeU35txG+6rwyN58IBtyZCo= Received: from DM6PR05CA0052.namprd05.prod.outlook.com (2603:10b6:5:335::21) by BN8PR12MB3075.namprd12.prod.outlook.com (2603:10b6:408:67::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 00:11:26 +0000 Received: from DM6NAM11FT039.eop-nam11.prod.protection.outlook.com (2603:10b6:5:335:cafe::6c) by DM6PR05CA0052.outlook.office365.com (2603:10b6:5:335::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.13 via Frontend Transport; Wed, 15 Dec 2021 00:11:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT039.mail.protection.outlook.com (10.13.172.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:11:25 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:11:25 -0600 From: Michael Roth To: CC: , Paolo Bonzini , Mark Cave-Ayland Subject: [PATCH 30/47] target-i386: mmu: fix handling of noncanonical virtual addresses Date: Tue, 14 Dec 2021 18:01:08 -0600 Message-ID: <20211215000125.378126-31-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5520e330-628c-47e8-ac5d-08d9bf5f6f35 X-MS-TrafficTypeDiagnostic: BN8PR12MB3075:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:862; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kCHLE0x4qcjtAX4Mq5m9d+SyLCuRGynevbVoRLBpyReSxOZXBM6vZl44E580jVniRA0dP+7HWmyFeFlaL5tgepkYNfzUCyYqrA5UwNMOFQwzNqbvnIZKX99P46YqzC+l/i/2zAakwP6GYcmINbR41P7aosA55gaBtHk/u2ERvn7e08MusdUgw4M/akE4f/tqNbV2eguCl3G34nvL5muRRNLcHYaPjmL0Fgxkrbrx5SazZu3/h7ipgVJLH4GhmaJ1h1RDKH5duSh+8rlvKiN1bem1NhczzAF7KMJMo9ms7Qnu06eQT2k+LCOPeMj3meHK6po0xa0JIsZ8GObiLIUNbdAfPANY23EIITu/SQsiG3d3+Pydm/UkjTt+fEbC/W571NSjm12mCOcjHQHEuG8Vi5EAcfV9lJVs7AC/2f1rmaITAwwCxPy29CCBPfdE9tnoEtzmv5b0SZMlZx+TAntBSb6Q0hs6rEWLy6Q6a1QuZoQG0QXl/cPG6wzN5LeD93yh49/E5XMKaahpsWLLrz6v/PgpgHDJvCf4fKBcNzMDg+js40+yTwlHvtUEF1g59d2r88ADxvl7T7aSngfhjOeKzhgW/bt7fbvwzJRhFmSPizajV3eURRY8Kf1kMMH5gbU1Y+z/zy4hTEwx0mEJblmUz8sLmj989RDfS/mabKBn+3ELkEBFym0A9N9HI6U7X+q++jgTUWBgXiUABAFizz66mKmbUMZWqvS0AQXbYX6gUXi3e9zJrwCcEKTYkfqoTywP/Vr7pgMk00bzxNC78TvKuRJb/YPI0rcxqSrmqDMtMIY= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(508600001)(5660300002)(316002)(1076003)(8676002)(81166007)(70206006)(83380400001)(2616005)(6666004)(70586007)(54906003)(186003)(16526019)(6916009)(36860700001)(26005)(356005)(336012)(8936002)(86362001)(44832011)(47076005)(426003)(4326008)(40460700001)(2906002)(36756003)(82310400004)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:11:25.5254 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5520e330-628c-47e8-ac5d-08d9bf5f6f35 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT039.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3075 Received-SPF: softfail client-ip=40.107.223.46; envelope-from=Michael.Roth@amd.com; helo=NAM11-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini mmu_translate is supposed to return an error code for page faults; it is not able to handle other exceptions. The #GP case for noncanonical virtual addresses is not handled correctly, and incorrectly raised as a page fault with error code 1. Since it cannot happen for nested page tables, move it directly to handle_mmu_fault, even before the invocation of mmu_translate. Fixes: #676 Fixes: 661ff4879e ("target/i386: extract mmu_translate", 2021-05-11) Cc: qemu-stable@nongnu.org Tested-by: Mark Cave-Ayland Signed-off-by: Paolo Bonzini (cherry picked from commit b04dc92e013d55c9ac8082caefff45dcfb1310e7) Signed-off-by: Michael Roth --- target/i386/tcg/sysemu/excp_helper.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/target/i386/tcg/sysemu/excp_helper.c b/target/i386/tcg/sysemu/excp_helper.c index 2dea4a248e..9fb59058ef 100644 --- a/target/i386/tcg/sysemu/excp_helper.c +++ b/target/i386/tcg/sysemu/excp_helper.c @@ -94,15 +94,6 @@ static int mmu_translate(CPUState *cs, hwaddr addr, MMUTranslateFunc get_hphys_f bool la57 = pg_mode & PG_MODE_LA57; uint64_t pml5e_addr, pml5e; uint64_t pml4e_addr, pml4e; - int32_t sext; - - /* test virtual address sign extension */ - sext = la57 ? (int64_t)addr >> 56 : (int64_t)addr >> 47; - if (get_hphys_func && sext != 0 && sext != -1) { - env->error_code = 0; - cs->exception_index = EXCP0D_GPF; - return 1; - } if (la57) { pml5e_addr = ((cr3 & ~0xfff) + @@ -423,6 +414,18 @@ static int handle_mmu_fault(CPUState *cs, vaddr addr, int size, page_size = 4096; } else { pg_mode = get_pg_mode(env); + if (pg_mode & PG_MODE_LMA) { + int32_t sext; + + /* test virtual address sign extension */ + sext = (int64_t)addr >> (pg_mode & PG_MODE_LA57 ? 56 : 47); + if (sext != 0 && sext != -1) { + env->error_code = 0; + cs->exception_index = EXCP0D_GPF; + return 1; + } + } + error_code = mmu_translate(cs, addr, get_hphys, env->cr[3], is_write1, mmu_idx, pg_mode, &paddr, &page_size, &prot); From patchwork Wed Dec 15 00:01:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676985 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E6D01C433F5 for ; Wed, 15 Dec 2021 00:23:45 +0000 (UTC) Received: from localhost ([::1]:45972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxI5A-0008CB-Rg for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:23:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52864) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHu2-0003it-Fk; Tue, 14 Dec 2021 19:12:14 -0500 Received: from mail-dm3nam07on2045.outbound.protection.outlook.com ([40.107.95.45]:43009 helo=NAM02-DM3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHtz-0005ip-WF; Tue, 14 Dec 2021 19:12:14 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GcJUPYuasYqUlZN1nES3M0auiQGPohTG+GvrIsCy+KGgQQsPdRqhshD7z5wOffW2a2514z2Th4/+HdBqjm/TBQAy/JHJw9Z4rpoX0SpeguK0gNWxTXVV/PCXL5qzBBstswUBN1fZa97eaNZbMVGGptoAFlc5X83kNlSy2bYgzJWIdfpSFklcc9k1TZvKBxzPOCUPSiMhNhwLtPHkBkWDL9vX4I2nI8vLRkL8t1at0WOS+Tm5Aypm0XIQRrbDve5KuNZ1EZSCRqI48CpxtndbGv+UhKRRmnZpK04hQT5QNYYZkeBVY/9nVgkdSCj6zkGVjflaAE6XjZmhBRQxHYFI6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yzHw6xVcP7JPT9KyWOihzF5g83dU2a2sHZZIZT22jvc=; b=Q09DKlyEtO5cAubmzxBB11ijfjePqhUFj5MQ91BLM2FOKb7hU6cOGxL+w0siOrnvLn2Fx981skQH1U/lEJVzxnP7B8lYuX5OF+7JKOhPGZKdMy7D/OYbGtl6m6F1/egK1yBtEgnAdnII7mCuCWREslclBiTm/U59LS+tyrwDYWfLEN80SSTPgJ9PfKNiVxNOexbZjhWZq7dkDlM2+XAQ0s4Fo0B4wEf+PlDirHdkXDQlk+VDCY3r8+CTOeaopG8tx+jvDZJpi5dlCjT2vACk6egK08rbbjHcZzBHPI+Qr0omTLrnlpoyXXL1LbX5wJ8k3Zc5fazuQhZqT5leJuVpEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yzHw6xVcP7JPT9KyWOihzF5g83dU2a2sHZZIZT22jvc=; b=g/VpG4ayL0zPXnJqnWol3zyHcQBnZdmVxYvCxiIXidmxwEpnZnJhQfBnPh+qrYneKebBqmXw/AZfEuHu7t025u2ULb6Nyv0cMYDduBwj9UWPfLncQQxYsiaVZVJ/RXh31rlimqF8tMlH4CJF2dmu0YPkY4b1OU0mev/TN8sNIJM= Received: from DM5PR11CA0003.namprd11.prod.outlook.com (2603:10b6:3:115::13) by MWHPR12MB1775.namprd12.prod.outlook.com (2603:10b6:300:109::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 00:12:07 +0000 Received: from DM6NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:3:115:cafe::61) by DM5PR11CA0003.outlook.office365.com (2603:10b6:3:115::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.15 via Frontend Transport; Wed, 15 Dec 2021 00:12:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT044.mail.protection.outlook.com (10.13.173.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:12:07 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:12:06 -0600 From: Michael Roth To: CC: , Mauro Matteo Cascella , Alexander Bulekov , Qiuhao Li , Paolo Bonzini Subject: [PATCH 31/47] hw/scsi/scsi-disk: MODE_PAGE_ALLS not allowed in MODE SELECT commands Date: Tue, 14 Dec 2021 18:01:09 -0600 Message-ID: <20211215000125.378126-32-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 008ae836-6d87-4994-0b00-08d9bf5f8805 X-MS-TrafficTypeDiagnostic: MWHPR12MB1775:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:51; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6A2MUMLiIZjphnWouBImdTJIzJuWVYEsRnI7dXQH2MHAi0xXFYtgcuoQMBm/hISnMisLgnS9DCe0lFUWFKrLDl1/2cSf0wC61kzmG2VyvHQy72skjkvSGATsXjk8Sq5jcs+aHh+oV4SE0TMiNjR/ea6VY5gPKY6DsRsyG4S9G/fV89sxbRsZWjkTRN1k9QiJDo3SR9cDy/jGWntGhUkUgSAJ+UyEbnuACWD1RvridstHV6qTJJvlhZnJxm6a/+sSfNfoXhH1HwPZHLLumddPEwpW+bg4X920HIQHDcN0XOKK2gJEsTUuS6+2xmeFqHBg3GnJCXtFl1LPRzy6QQvRAOEa1Xbn76YJjLG1JNVRNUwYCNL9NDa4jdKZncMrwj06jRLprsCTBu5qecmxt9fy916fNqPlTkfMuEawFDiqEiQjmSpouh24vfd3l5zDM73pCILPyrTAca/pfmxQ4eAa1jl6lWCQdinLZLHg1BGR7YuCBWRcKM4WgTIk6az4nTNuxeoNM+PeMJ+iPFZ0Ga+OrPP8CuTIJojY7lgOXsao1x04h5alekqwAYOcNcG+n0MH5Jv3RNfSNpgjclqcEWjEHSvpyXwWoTwzBljk9NEbNegy//dzZFlwzGg5ZtjIB3HL+6MRvX7Unv5+patz7Efu5ArOrYJcaAZVkZU2ML7Nr27Oi4hI/gbakIDYyyjrd0OcotP3BDux9iJRje8puITVJf5dc5Pqh4Bhm5Tsc39+HfiEki+NVT1v47RsM2mxPSRyDIOkPNNZL7koOV/AZJ0SaFUmWpbLgFI996rMYbICLko= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(40470700001)(44832011)(1076003)(54906003)(8936002)(70206006)(70586007)(186003)(16526019)(8676002)(2616005)(4326008)(36860700001)(508600001)(336012)(40460700001)(36756003)(316002)(426003)(26005)(2906002)(82310400004)(356005)(45080400002)(81166007)(86362001)(5660300002)(6916009)(32650700002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:12:07.3413 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 008ae836-6d87-4994-0b00-08d9bf5f8805 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1775 Received-SPF: softfail client-ip=40.107.95.45; envelope-from=Michael.Roth@amd.com; helo=NAM02-DM3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Mauro Matteo Cascella This avoids an off-by-one read of 'mode_sense_valid' buffer in hw/scsi/scsi-disk.c:mode_sense_page(). Fixes: CVE-2021-3930 Cc: qemu-stable@nongnu.org Reported-by: Alexander Bulekov Fixes: a8f4bbe2900 ("scsi-disk: store valid mode pages in a table") Fixes: #546 Reported-by: Qiuhao Li Signed-off-by: Mauro Matteo Cascella Signed-off-by: Paolo Bonzini (cherry picked from commit b3af7fdf9cc537f8f0dd3e2423d83f5c99a457e8) Signed-off-by: Michael Roth --- hw/scsi/scsi-disk.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index e8a547dbb7..d4914178ea 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1087,6 +1087,7 @@ static int mode_sense_page(SCSIDiskState *s, int page, uint8_t **p_outbuf, uint8_t *p = *p_outbuf + 2; int length; + assert(page < ARRAY_SIZE(mode_sense_valid)); if ((mode_sense_valid[page] & (1 << s->qdev.type)) == 0) { return -1; } @@ -1428,6 +1429,11 @@ static int scsi_disk_check_mode_select(SCSIDiskState *s, int page, return -1; } + /* MODE_PAGE_ALLS is only valid for MODE SENSE commands */ + if (page == MODE_PAGE_ALLS) { + return -1; + } + p = mode_current; memset(mode_current, 0, inlen + 2); len = mode_sense_page(s, page, &p, 0); From patchwork Wed Dec 15 00:01:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676993 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4C2FCC433EF for ; Wed, 15 Dec 2021 00:26:22 +0000 (UTC) Received: from localhost ([::1]:54590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxI7h-0005Yd-6t for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:26:21 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHuO-0004cR-AG; Tue, 14 Dec 2021 19:12:36 -0500 Received: from mail-sn1anam02on2070.outbound.protection.outlook.com ([40.107.96.70]:3722 helo=NAM02-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHuK-0005kt-F8; Tue, 14 Dec 2021 19:12:36 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hFsJKfpXkFLGxdtO3NuWeDVLB1HhU22RXmWP/wLhirPYDddqCjR87qc3DW1pg42T4yefSmPRTNTpIKR2/NYRJ2YX9Vnc2RGe9yS5Dy+8WOVFdCWrzQHC1KTPcUB7vsC86UhtARaO+ORJY4hk4DnKp/9VG0XkyXOpvi/1NX0LnD/kWsjEPxxA2i3EV5gwrWP/wbBfzS0kjLfW1zO8PK6ULkUd0z9cKjQla08yPGxvFiU18YvAR0dxT1JbUEIhbZnhGAsQR3yyXWlKi1T4Afa9rseymNZ9xV4+MfuI/f6J2j5eAMSz92wIvDUMqHm9jaAloPTubEYanVsE871lMbh+DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8jjlg8j7uE0kLAtkoFMk8R6boU6/m82+LAr9NWo0tbg=; b=CRjE6uOIucWj5RZQ/MgK0THER+d3Yha+8BuRjJkvDoERcnUiYezUbiWIPvlYaJ6Qfm6p36VfnYdhkGgFuZyYP3fhk6Vqa1DhKvNYU+bRLNP8g6W8aDam3y4jIS1wBg8lBlueXtHqXIq4vZqGmT/w6HqQ9BZGXq5BZSQ5L99NlgCi7lOeANRntBjwZFuiPhXQ2nHMTL/bJOsVsF629TefbH6P5QWGbNGPB3CzWQjAXhGSLZeNRHBWku2asQeqotUFKpglR65U+ipfvZoyAnckoYI5FrK8WCLCz0y9SufXW919Qhnc+Jw3EsWUjdcLLl15/uolBujSAa+8SRtJoWEXKA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8jjlg8j7uE0kLAtkoFMk8R6boU6/m82+LAr9NWo0tbg=; b=y0tnrZnk8tmb9nBlCzgOf5yq+/lDDOH+I/6oJmO2fCO5qB8ugng1R+O6JompcXVE3vsG+XQ/lHBB6EowhKEld7Lqy7/GA3oqNiaSOTGrym3krBIMCMh4NNfjmjELHAT6gM990Wh+mbu4Uhrh44ukOkY5ShTfDHLvT9RYgTsueNQ= Received: from DM6PR06CA0043.namprd06.prod.outlook.com (2603:10b6:5:54::20) by MWHPR12MB1472.namprd12.prod.outlook.com (2603:10b6:301:11::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Wed, 15 Dec 2021 00:12:28 +0000 Received: from DM6NAM11FT055.eop-nam11.prod.protection.outlook.com (2603:10b6:5:54:cafe::c7) by DM6PR06CA0043.outlook.office365.com (2603:10b6:5:54::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:12:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT055.mail.protection.outlook.com (10.13.173.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:12:28 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:12:27 -0600 From: Michael Roth To: CC: , Laurent Vivier Subject: [PATCH 32/47] hw: m68k: virt: Add compat machine for 6.1 Date: Tue, 14 Dec 2021 18:01:10 -0600 Message-ID: <20211215000125.378126-33-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f89740ff-5665-47b1-3902-08d9bf5f946b X-MS-TrafficTypeDiagnostic: MWHPR12MB1472:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:256; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Xt4nZEx8xpinNDIcnFYI6ia2HoZU6qib28HTnolJuXo/ecLPGJLW3qnmwpj9P8JYiNkKpXH7qGBaw3cV919Grc7U0Twq9jq3AWTSTvvHGS/lfNww0/Cmg1VzP7JJcQFjHZ+9zPdGKu/PJKvUm3gp+2vcy7C+k2eypf8vpxEhlP7KUM5eD9fe0mFAaYmQSgVLQqRH36ovpNT2vjFNAbbjcmkPO2r6EIgDmRhDcRMscR8TTSztVwxi7/cG3G2IETttHFWpXAl5OfpKywesG9qfy2QR8dvqV+bXVhRxrY7WOScZRjgrP2mESmGWIPtkIIO4K3TGDTe7UUr34UiivPXamLVtT6nRF0mrq+YFhWxbclymrIB1TWHnyqOATk8Gf3UIZKeZTjfh8VUDOC7epOQp3pqr424liu9KmM1mqJD4Yqgfrq7Tl7IBWLC1Qwi06osin03MeSXr784txoZHchHQ+cJmc+sJie84qObm5/98JDaWbhPbrsIGARRjpPI/gSVJSN37F5bwxdTmz8NP9yMm6GIAFJXeVIgV3pCGswR9rRru+jW5kfMzAunudfo2tm9YF2KasPR3WVxvPBwxHRp7AFbQUIqvBR0jYOPEougkwMsdQD+q+gX1IEMLSgLAOx4w+zRGL7JYkNQowBdcS7F0hXXwyvY403mtxTsSAA7irSSh1FSWztDJ5wWxe2AMwt4HNX4cm1+7ZwYUWwg9MJXGRjHeKUGRhzrh+twyzjT5PTlOFTSSnyuYTMq2AL842MPF++PECwKAyWcOtp8RD/lHpmTdD64CicenxwbZt0CAPQ8= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(26005)(426003)(2616005)(336012)(47076005)(2906002)(16526019)(54906003)(44832011)(86362001)(36756003)(316002)(186003)(81166007)(40460700001)(356005)(82310400004)(70206006)(508600001)(6916009)(1076003)(36860700001)(6666004)(70586007)(8676002)(4326008)(8936002)(5660300002)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:12:28.1395 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f89740ff-5665-47b1-3902-08d9bf5f946b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT055.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1472 Received-SPF: softfail client-ip=40.107.96.70; envelope-from=Michael.Roth@amd.com; helo=NAM02-SN1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Laurent Vivier Add the missing machine type for m68k/virt Cc: qemu-stable@nongnu.org Signed-off-by: Laurent Vivier Message-Id: <20211106194158.4068596-2-laurent@vivier.eu> Signed-off-by: Laurent Vivier (cherry picked from commit 6837f299762679429924242a63f16490862578e3) Signed-off-by: Michael Roth --- hw/m68k/virt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c index 4e8bce5aa6..0d9e3f83c1 100644 --- a/hw/m68k/virt.c +++ b/hw/m68k/virt.c @@ -304,7 +304,14 @@ type_init(virt_machine_register_types) } \ type_init(machvirt_machine_##major##_##minor##_init); +static void virt_machine_6_1_options(MachineClass *mc) +{ +} +DEFINE_VIRT_MACHINE(6, 1, true) + static void virt_machine_6_0_options(MachineClass *mc) { + virt_machine_6_1_options(mc); + compat_props_add(mc->compat_props, hw_compat_6_0, hw_compat_6_0_len); } -DEFINE_VIRT_MACHINE(6, 0, true) +DEFINE_VIRT_MACHINE(6, 0, false) From patchwork Wed Dec 15 00:01:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676975 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3ADD8C433F5 for ; Wed, 15 Dec 2021 00:19:01 +0000 (UTC) Received: from localhost ([::1]:60894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxI0a-0007eZ-8H for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:19:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52976) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHui-0005W8-00; Tue, 14 Dec 2021 19:12:56 -0500 Received: from mail-mw2nam10on2065.outbound.protection.outlook.com ([40.107.94.65]:22241 helo=NAM10-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHuf-0005nW-3N; Tue, 14 Dec 2021 19:12:55 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lLeHLXMUx55tdGSjxl2fq7FIoHyL8BjGFuvkDcQTwRDXhm6WG9UrlRPgcUdQfucf55dCJpeQpwTw8SzF+k/xrPF2/YolhlywgZ5Lf84uxQHmn26a+2cgQxdBZ/YZbYkE3ogUcadgZRCg7LvCV3Vx1pld0+qOlbtLRzYErYGxJyrJeA1QpcYS6/XSEJIqs+hcLzNoasyBhcD+oGj9XdDIIQMcBvzUGOYTPcP/UnTmFi2uk8dfQ0BAFv2zR7CnV3Hl+GcnLFKv8jlv+o0tlAeob3L7o9APCA4AnO+A0cFKOEaTqVKnxYGBnUNA+O+hTNJhhVQg5bQA/ZJfywWQtSh5nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Bz9nhSKbhpDvpoQv6ltenATNG0v8B5ioh69SSjaa3Ok=; b=TYrFshl7grgIyCjQtFbim9Mo40XSamEI1fk9DgObSfqyKQfv3eFtPWzw8w+FzccQe5Oqw8Fx6t2BkekviHfxz2qOfpyVWrvu4XAwhn5+dAdrgSaT3ppiuE/KQ+AWcwp2YkXKyzexRYTd74IOxUXkSmbx0WUgWN6tXgIs5FtfMXUbXyxZEEqbOn4S27Q395C0urse4eaKCcQMa4v+lFNwG7V3RfR9RMhVtWBJj0TW+C2BI00/4WyIiXqvRHDQYtDAzYNKm0vS+awUubBiEmcKLY3W8+31Hfb0K/ZXHVgYmKwT8SHeLC6BD/6YWX6YIbQrRdJhdsUFMI89UrMHia8W6A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Bz9nhSKbhpDvpoQv6ltenATNG0v8B5ioh69SSjaa3Ok=; b=jPT8TCdwfh1GH9i6SWLyOzoW30DlYyY8iO09nxLviCCwGnonWZXGCw+BvvJ4LWmPHihsW3glKsP1r52dZIz00RVNt+Jqfp68e5c4vQyos9CfToElA9Yd4DrsgMQyG1KOsRIvcu4GX/Gx+IYBOf1Xcxh7gPaUpkW6giZXU3O1QrU= Received: from DM6PR11CA0050.namprd11.prod.outlook.com (2603:10b6:5:14c::27) by BN9PR12MB5049.namprd12.prod.outlook.com (2603:10b6:408:132::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16; Wed, 15 Dec 2021 00:12:49 +0000 Received: from DM6NAM11FT013.eop-nam11.prod.protection.outlook.com (2603:10b6:5:14c:cafe::f5) by DM6PR11CA0050.outlook.office365.com (2603:10b6:5:14c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:12:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT013.mail.protection.outlook.com (10.13.173.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:12:48 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:12:48 -0600 From: Michael Roth To: CC: , Greg Kurz , Paolo Bonzini , Richard Henderson Subject: [PATCH 33/47] rcu: Introduce force_rcu notifier Date: Tue, 14 Dec 2021 18:01:11 -0600 Message-ID: <20211215000125.378126-34-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 36de5dc2-503a-48b7-7c62-08d9bf5fa0d6 X-MS-TrafficTypeDiagnostic: BN9PR12MB5049:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1850; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M2pz0QmMuso/eTBvz7Lmco3/+R8ncfUBiScPTino0fQM8lgK/k6D0azKk6fOIpqB5HuMOh4B7sBlUCWE5wKeqEs05JAgt87OC1Dhy1acdLKLoVPBwiRrVShqlqN2JL07qyKqLsA0+y6KeMfcMx/1kdumqdCybT1vsQQ9tMt82V2AODufZFx7uyeRJp+IybERskjZnvpQTttecEMvVSI/b6jzUo6M9v3hK2HdjOo72Q9e/YypEQv5YAs5IzZ1o8dJpVZ+91B8xp6/btYzom30qFEE4Uj0l9Cmu9vEDfCUcblTlCCwaPkklOHZX8MbzVKudQ3lVeCDyaIPyfMrdwWyol/qUpi7/08kYV92Uvvz2jmM3Dbw/xR7z5/SQfvu1o42Hurs0mW+tJnAp6rmBAilaJf4Ukh/WNXMmULBZ176k8VcU8l9V4a7l9AZi6q5ygkyg/GIZ/PiH+LVBdY3LtqirHQK+Ur20Relid4Mtqw6/2j1IzgzVGkJ01D0TvXPn8o+wA1m7obKXvo7LrKLM04PaQrYS1AW5/OjR64VqQlqFLBpGQTg4WR2KeZm1QoDJIUtq9WGtDgTWUo5x++4kzZcebn2SDY5jl7JNuZYx75jt3RMRNvWbONblpYCEMKD7UYqa4rs0Ep4NEZ6db4zPfDPiKjEvBYGLfl34dHY3R3qceYicHiBRT5OiSf27JHK6O3hzaUjmSSYOQp4jVYx9dKG4fVjQTAETyGeDAxkMtBI89ebxRcU4+NQAkULyB3GmyZbhsqlwYj+MPQWDVwj6b+ungP/JM80jPVM3Ji9QHkNQGTIzt1H5Lx5vmso653I6gl20kYjkTMXLJMl6J+m2Qxl2JJH412KMMML9uRYoyrGefsHg6mT+zB5q4/5gJA4HvaA X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(336012)(26005)(36860700001)(316002)(356005)(54906003)(82310400004)(2906002)(2616005)(81166007)(36756003)(16526019)(508600001)(5660300002)(40460700001)(6916009)(86362001)(186003)(8676002)(4326008)(44832011)(966005)(426003)(83380400001)(70206006)(70586007)(1076003)(47076005)(6666004)(8936002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:12:48.9971 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 36de5dc2-503a-48b7-7c62-08d9bf5fa0d6 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT013.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5049 Received-SPF: softfail client-ip=40.107.94.65; envelope-from=Michael.Roth@amd.com; helo=NAM10-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Greg Kurz The drain_rcu_call() function can be blocked as long as an RCU reader stays in a read-side critical section. This is typically what happens when a TCG vCPU is executing a busy loop. It can deadlock the QEMU monitor as reported in https://gitlab.com/qemu-project/qemu/-/issues/650 . This can be avoided by allowing drain_rcu_call() to enforce an RCU grace period. Since each reader might need to do specific actions to end a read-side critical section, do it with notifiers. Prepare ground for this by adding a notifier list to the RCU reader struct and use it in wait_for_readers() if drain_rcu_call() is in progress. An API is added for readers to register their notifiers. This is largely based on a draft from Paolo Bonzini. Suggested-by: Paolo Bonzini Signed-off-by: Greg Kurz Reviewed-by: Richard Henderson Message-Id: <20211109183523.47726-2-groug@kaod.org> Signed-off-by: Paolo Bonzini (cherry picked from commit ef149763a8fcce70b85dfda27cc1222ecf765750) Signed-off-by: Michael Roth --- include/qemu/rcu.h | 15 +++++++++++++++ util/rcu.c | 19 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h index 515d327cf1..e69efbd47f 100644 --- a/include/qemu/rcu.h +++ b/include/qemu/rcu.h @@ -27,6 +27,7 @@ #include "qemu/thread.h" #include "qemu/queue.h" #include "qemu/atomic.h" +#include "qemu/notify.h" #include "qemu/sys_membarrier.h" #ifdef __cplusplus @@ -66,6 +67,13 @@ struct rcu_reader_data { /* Data used for registry, protected by rcu_registry_lock */ QLIST_ENTRY(rcu_reader_data) node; + + /* + * NotifierList used to force an RCU grace period. Accessed under + * rcu_registry_lock. Note that the notifier is called _outside_ + * the thread! + */ + NotifierList force_rcu; }; extern __thread struct rcu_reader_data rcu_reader; @@ -180,6 +188,13 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(RCUReadAuto, rcu_read_auto_unlock) #define RCU_READ_LOCK_GUARD() \ g_autoptr(RCUReadAuto) _rcu_read_auto __attribute__((unused)) = rcu_read_auto_lock() +/* + * Force-RCU notifiers tell readers that they should exit their + * read-side critical section. + */ +void rcu_add_force_rcu_notifier(Notifier *n); +void rcu_remove_force_rcu_notifier(Notifier *n); + #ifdef __cplusplus } #endif diff --git a/util/rcu.c b/util/rcu.c index 13ac0f75cb..c91da9f137 100644 --- a/util/rcu.c +++ b/util/rcu.c @@ -46,6 +46,7 @@ unsigned long rcu_gp_ctr = RCU_GP_LOCKED; QemuEvent rcu_gp_event; +static int in_drain_call_rcu; static QemuMutex rcu_registry_lock; static QemuMutex rcu_sync_lock; @@ -107,6 +108,8 @@ static void wait_for_readers(void) * get some extra futex wakeups. */ qatomic_set(&index->waiting, false); + } else if (qatomic_read(&in_drain_call_rcu)) { + notifier_list_notify(&index->force_rcu, NULL); } } @@ -339,8 +342,10 @@ void drain_call_rcu(void) * assumed. */ + qatomic_inc(&in_drain_call_rcu); call_rcu1(&rcu_drain.rcu, drain_rcu_callback); qemu_event_wait(&rcu_drain.drain_complete_event); + qatomic_dec(&in_drain_call_rcu); if (locked) { qemu_mutex_lock_iothread(); @@ -363,6 +368,20 @@ void rcu_unregister_thread(void) qemu_mutex_unlock(&rcu_registry_lock); } +void rcu_add_force_rcu_notifier(Notifier *n) +{ + qemu_mutex_lock(&rcu_registry_lock); + notifier_list_add(&rcu_reader.force_rcu, n); + qemu_mutex_unlock(&rcu_registry_lock); +} + +void rcu_remove_force_rcu_notifier(Notifier *n) +{ + qemu_mutex_lock(&rcu_registry_lock); + notifier_remove(n); + qemu_mutex_unlock(&rcu_registry_lock); +} + static void rcu_init_complete(void) { QemuThread thread; From patchwork Wed Dec 15 00:01:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677063 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 01714C433F5 for ; Wed, 15 Dec 2021 00:51:06 +0000 (UTC) Received: from localhost ([::1]:45102 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxIVd-00045v-RO for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:51:05 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53012) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHv3-0005xN-NN; Tue, 14 Dec 2021 19:13:17 -0500 Received: from mail-co1nam11on2084.outbound.protection.outlook.com ([40.107.220.84]:13537 helo=NAM11-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHuz-0005oE-RF; Tue, 14 Dec 2021 19:13:17 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IZ1/+Om3pPLLXT/Q6OCb9l2HRzUh5G6j/hJ3LnSnAk2dlzaRah2EJ7DzvIWP+bjUNP6YXuQ/PBqWvmznv89T9u6uOM+RQF4cjW54GI4jNvzv15F+R300SDsWUTIWZYOnn4Bi/sXb/uWMEl9IS1Szqf4EIkNpxEI/GIE/c8ChUHYmi0SZrXF4PMc7awsxS4R4w6kH3IShRAwrMUAtsCMb3Lle3+hXsZWAlKgXy0FMXHnk5iQzf17a5toiXnQg+5pVmoPi4e80ZqTdQffLGfRPFOZBUIQBjGXG8AF+HG0lb3SM9nrrlqap3SVZV2IbD6MVm53KejR0eMl+ro8H0VnMFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1Yo2dFdhUZyw09j4ZkDFcAPqi6n8mM6gCKojG61+iF8=; b=Uz3RQ+PhTrt2EWtaLW4C8Uhj8+hBvqYGhcXb7Q36rOIEYIjejJOOB9MQQugrJmVBmVRJN5m/cwwkYPrKDp8JpSk7SFTijiKJA85SvpV0iwHg2tYPKrpbTL+3bAuAxNMek5NYqQWV4zo98KQzSyRJruIfY7kUy4tit2zBzfLs2awCYGXWP9siVWb5KG6FUNc6UhgX5eqVsleq23f6vgDuBVkPGnSXN8K5JbOX9P0nEEI7kanHh6kM63jUzeUPCjdcx9bH4MpKgCRw0//E10vVe3ttXeDD/J5tejeyyLRvvD2w/Hy9CjAqjwQuXSgRWAQsHA5/4V0cMRyMQqSuMjEKgQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1Yo2dFdhUZyw09j4ZkDFcAPqi6n8mM6gCKojG61+iF8=; b=oksErmY9kB550FCDkvVtQiWAwjhvB2NAdP5+mcqpEhifCZtl2c4BfBb0deRyE336KMLzDNWYBIenq+/N4k38XlMl9WvbwoC9PXWg/XohFSBNfjQ9qo1abUAIadD8KJ37TTtsFIyiKgzYDlrXDCagdfYamBsgRhQUSRYiWdePk48= Received: from DM5PR08CA0030.namprd08.prod.outlook.com (2603:10b6:4:60::19) by DM6PR12MB4058.namprd12.prod.outlook.com (2603:10b6:5:21d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Wed, 15 Dec 2021 00:13:10 +0000 Received: from DM6NAM11FT038.eop-nam11.prod.protection.outlook.com (2603:10b6:4:60:cafe::c2) by DM5PR08CA0030.outlook.office365.com (2603:10b6:4:60::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.12 via Frontend Transport; Wed, 15 Dec 2021 00:13:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT038.mail.protection.outlook.com (10.13.173.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:13:09 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:13:09 -0600 From: Michael Roth To: CC: , Greg Kurz , Paolo Bonzini , Richard Henderson Subject: [PATCH 34/47] accel/tcg: Register a force_rcu notifier Date: Tue, 14 Dec 2021 18:01:12 -0600 Message-ID: <20211215000125.378126-35-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 123671ca-d312-4cd8-130a-08d9bf5fad48 X-MS-TrafficTypeDiagnostic: DM6PR12MB4058:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:608; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rWP4ObEGAnMKSOtQA11HtJzWKx0xKB/4QrszoI2YWL6joPc48NctG1W3bLk57DyM/ac0hzQvcmlILjJbr5cUVRdFJHtmQvKnnJ5AHpNu9IE51zxdQAcrrSK/Cp0rFwj1AI18OzyBwIsoTcLeSFg4hLKXmXhnRqC+ARBMbtnNdkGhBegMQPQ4+Rt8gX0JCmMZjrFoWzNz9A8aTMdqL9LsdgMKmS2ggl7nFVMu/MFfjj5emFNEOTm7Ivjk27fJeVvraAPp0KHwU7q8tL8QIYizXYwD1f5u5icL6VnRLllhTwUnhU54Dz7EAVvtCvaNSiUQUolSktW5W2DZPn4NmjgPPa+ZUmOWC1S7WTwMF72bEW67KYZs0T3iDTcaxf59lAEB29CmwecBlBePrK/ySNxcnfWHfSxau3fooTFg94ZdzQO/CaGE+hyc9ZrqCNN3j0luShdjKZ5jipOnW6xpVkCAyGBJuS2BVQDiq6fmwtgBDDMysw8mQ4Cm0OIge/SdNKAAQsP7BiBuZaru/t9zUfDSFDn4ZJqKIqfHy93b6Urq1yDg6TJU525uedZ8pBd+7e9q7noDdW5HjiGA8Kx0PxwEfJ+9AOaw1r3S26uuhuoQbNV7zCz1E+bCbRUQXb3QbIIYDp6RQXfPq4N+rXb/kDiByxFZUA1XfFkXQtfDgd3NWSj5Zi2VXoaLgKs9v2gA9X8ppx02XzWc40DmWGC+b3W0bKEhzHiHWz2sTfLjHOq9OoNRWpLiIjAh3i1ounvhRmDUly2WiJWoILfjrTjnAdcnu7NqMqEl1SylK3YE6DNTZl3OiWbOQOsRnOS3Qyzoei6j97ikpUnkzn+23LeY82T9sK78kZQPViQ/UK14+nMCmbm4Iu291qxLdPNtXDbWt9D9 X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700001)(70586007)(2906002)(47076005)(356005)(6916009)(8676002)(508600001)(83380400001)(81166007)(36756003)(44832011)(40460700001)(86362001)(8936002)(36860700001)(70206006)(26005)(966005)(2616005)(5660300002)(6666004)(186003)(4326008)(16526019)(316002)(1076003)(336012)(426003)(82310400004)(54906003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:13:09.8834 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 123671ca-d312-4cd8-130a-08d9bf5fad48 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT038.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4058 Received-SPF: softfail client-ip=40.107.220.84; envelope-from=Michael.Roth@amd.com; helo=NAM11-CO1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Greg Kurz A TCG vCPU doing a busy loop systematicaly hangs the QEMU monitor if the user passes 'device_add' without argument. This is because drain_cpu_all() which is called from qmp_device_add() cannot return if readers don't exit read-side critical sections. That is typically what busy-looping TCG vCPUs do: int cpu_exec(CPUState *cpu) { [...] rcu_read_lock(); [...] while (!cpu_handle_exception(cpu, &ret)) { // Busy loop keeps vCPU here } [...] rcu_read_unlock(); return ret; } For MTTCG, have all vCPU threads register a force_rcu notifier that will kick them out of the loop using async_run_on_cpu(). The notifier is called with the rcu_registry_lock mutex held, using async_run_on_cpu() ensures there are no deadlocks. For RR, a single thread runs all vCPUs. Just register a single notifier that kicks the current vCPU to the next one. For MTTCG: Suggested-by: Paolo Bonzini For RR: Suggested-by: Richard Henderson Fixes: 7bed89958bfb ("device_core: use drain_call_rcu in in qmp_device_add") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/650 Signed-off-by: Greg Kurz Reviewed-by: Richard Henderson Message-Id: <20211109183523.47726-3-groug@kaod.org> Signed-off-by: Paolo Bonzini (cherry picked from commit dd47a8f654d84f666b235ce8891e17ee76f9be8b) Signed-off-by: Michael Roth --- accel/tcg/tcg-accel-ops-mttcg.c | 26 ++++++++++++++++++++++++++ accel/tcg/tcg-accel-ops-rr.c | 10 ++++++++++ 2 files changed, 36 insertions(+) diff --git a/accel/tcg/tcg-accel-ops-mttcg.c b/accel/tcg/tcg-accel-ops-mttcg.c index 847d2079d2..29632bd4c0 100644 --- a/accel/tcg/tcg-accel-ops-mttcg.c +++ b/accel/tcg/tcg-accel-ops-mttcg.c @@ -28,6 +28,7 @@ #include "sysemu/tcg.h" #include "sysemu/replay.h" #include "qemu/main-loop.h" +#include "qemu/notify.h" #include "qemu/guest-random.h" #include "exec/exec-all.h" #include "hw/boards.h" @@ -35,6 +36,26 @@ #include "tcg-accel-ops.h" #include "tcg-accel-ops-mttcg.h" +typedef struct MttcgForceRcuNotifier { + Notifier notifier; + CPUState *cpu; +} MttcgForceRcuNotifier; + +static void do_nothing(CPUState *cpu, run_on_cpu_data d) +{ +} + +static void mttcg_force_rcu(Notifier *notify, void *data) +{ + CPUState *cpu = container_of(notify, MttcgForceRcuNotifier, notifier)->cpu; + + /* + * Called with rcu_registry_lock held, using async_run_on_cpu() ensures + * that there are no deadlocks. + */ + async_run_on_cpu(cpu, do_nothing, RUN_ON_CPU_NULL); +} + /* * In the multi-threaded case each vCPU has its own thread. The TLS * variable current_cpu can be used deep in the code to find the @@ -43,12 +64,16 @@ static void *mttcg_cpu_thread_fn(void *arg) { + MttcgForceRcuNotifier force_rcu; CPUState *cpu = arg; assert(tcg_enabled()); g_assert(!icount_enabled()); rcu_register_thread(); + force_rcu.notifier.notify = mttcg_force_rcu; + force_rcu.cpu = cpu; + rcu_add_force_rcu_notifier(&force_rcu.notifier); tcg_register_thread(); qemu_mutex_lock_iothread(); @@ -100,6 +125,7 @@ static void *mttcg_cpu_thread_fn(void *arg) tcg_cpus_destroy(cpu); qemu_mutex_unlock_iothread(); + rcu_remove_force_rcu_notifier(&force_rcu.notifier); rcu_unregister_thread(); return NULL; } diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c index c02c061ecb..aa5b4ac247 100644 --- a/accel/tcg/tcg-accel-ops-rr.c +++ b/accel/tcg/tcg-accel-ops-rr.c @@ -28,6 +28,7 @@ #include "sysemu/tcg.h" #include "sysemu/replay.h" #include "qemu/main-loop.h" +#include "qemu/notify.h" #include "qemu/guest-random.h" #include "exec/exec-all.h" @@ -135,6 +136,11 @@ static void rr_deal_with_unplugged_cpus(void) } } +static void rr_force_rcu(Notifier *notify, void *data) +{ + rr_kick_next_cpu(); +} + /* * In the single-threaded case each vCPU is simulated in turn. If * there is more than a single vCPU we create a simple timer to kick @@ -145,10 +151,13 @@ static void rr_deal_with_unplugged_cpus(void) static void *rr_cpu_thread_fn(void *arg) { + Notifier force_rcu; CPUState *cpu = arg; assert(tcg_enabled()); rcu_register_thread(); + force_rcu.notify = rr_force_rcu; + rcu_add_force_rcu_notifier(&force_rcu); tcg_register_thread(); qemu_mutex_lock_iothread(); @@ -257,6 +266,7 @@ static void *rr_cpu_thread_fn(void *arg) rr_deal_with_unplugged_cpus(); } + rcu_remove_force_rcu_notifier(&force_rcu); rcu_unregister_thread(); return NULL; } From patchwork Wed Dec 15 00:01:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676981 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 78EA2C433EF for ; Wed, 15 Dec 2021 00:23:01 +0000 (UTC) Received: from localhost ([::1]:42642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxI4R-0005zD-7T for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:22:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53040) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHvP-0006vT-82; Tue, 14 Dec 2021 19:13:39 -0500 Received: from mail-bn7nam10on2051.outbound.protection.outlook.com ([40.107.92.51]:42272 helo=NAM10-BN7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHvL-0005p0-GC; Tue, 14 Dec 2021 19:13:38 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FnoTviIgGi4W04VeywBqlvBGT7ag5JURP9T4UGhq3SGnIl1oOmfxXk6a5ia6BXtwGT9tVEbH1hf2ztOd7P37u9Oy674cP9kn57QMxWXyRON0NUbIZoHlrAuibvAFKMzb1Cdrfy3XY9LiyYygE5EVHLZhpxFpUoMtzSWbaKtg0bOnrKmT6SOcY3eSUx1XFmJx8+qoXuaaLEDEoEoL/7IK+tcq+QihqIt2Wj820UG8pc7K8ntRIk5uy4pcdAwAj7nWuYA32KA/tkrgLMxQiKG3Wyhhw7N0yFf1UnvaUq3KlwsMEIvmrYwOHFwOLZBrd4Z07LDDYOy2TvPejatbIjkUDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=alZ/gXq5UFzojMHyvYcTFTm06U2HspNU3QrjMGhP61c=; b=HcpXN76YMr74awTqIWvvYxtxQNnQ551ifM40SOcLoCH9Jir16Mjhj4ebtD6pblcjrBviYHtEieDSyNPyNUdsv6M92S7O/ai39IrD2xSZLChIbrqE3/bSFDe9i2lrS7v0wuKKT3I/6uP1VmelvrPJ+RbwbYskudsMvDATK8P+UltCQ0/7FoyEdazcQLf64pIMm+3WP7Iv4VOjJR51xYEbwJuPrxacQYNHNKa+fSxDAzTIsVLouRkGgiPsVi40ITpbQhtfpeKXcmgPxFQ4EWVagDPQKNixrcBnh9tCvkuz2BEdSRxsUP1cAuBjRSNeGK5iivT+KkrZIILdAInxXdzTxw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=alZ/gXq5UFzojMHyvYcTFTm06U2HspNU3QrjMGhP61c=; b=pH9otzvR4DcWX8MRzWTMIrbREioVIecDI/JA4hMzM867M94B1AXkJ8lAYMYOAGbHDxww35O7yUHiD1ctO1qmVxDW5RRR+snHZsUmdxIHNzNDawMIbE4TTa7efOdFHqj7GGwYNvk/9K67e/OecttJD7hjl1y5X/6RXaoKj5DRNrE= Received: from DM5PR18CA0081.namprd18.prod.outlook.com (2603:10b6:3:3::19) by BN9PR12MB5383.namprd12.prod.outlook.com (2603:10b6:408:104::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 00:13:31 +0000 Received: from DM6NAM11FT060.eop-nam11.prod.protection.outlook.com (2603:10b6:3:3:cafe::f6) by DM5PR18CA0081.outlook.office365.com (2603:10b6:3:3::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.12 via Frontend Transport; Wed, 15 Dec 2021 00:13:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT060.mail.protection.outlook.com (10.13.173.63) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:13:31 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:13:30 -0600 From: Michael Roth To: CC: , Igor Mammedov , Ani Sinha , "Michael S . Tsirkin" Subject: [PATCH 35/47] pcie: rename 'native-hotplug' to 'x-native-hotplug' Date: Tue, 14 Dec 2021 18:01:13 -0600 Message-ID: <20211215000125.378126-36-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6eaade8b-fd7c-47a3-1956-08d9bf5fb9e5 X-MS-TrafficTypeDiagnostic: BN9PR12MB5383:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1148; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: o+PV+/gripWbAhRjJ/tR9LxYxJ3MEjOjKE8VtxvBOtt4c1kCRhMDBtLpDcQQZImw3sc/5GIAMA7AjErqUUddHOR59tLOHWYrBBM4uKRtuO2pR1m4wiwY6+kDOYgjV3jY/L/ERQKvaw/QD48FrDhv5M+woLc8hnb/rEKfkY1TPUB8EZnjMpdmXEhxoKt0dMbHEjDeJWPTVaPCzBcZLoegwpNAi2/W6gb9u/C2kMMisbWh4hi7/1d25OJb/ydShtJOU/bjMh0+Fqq+AP93O19uVRzhutNMHSFXCvk6dBfDzg00tsvL10OkKDiBZVRe7cPoAZqy1xkaWrvqeqZpYf7KwqRsq36eHKjcluLuK94jiR+5l2/oFykj/NFan8ONiVdoWrdmGgI6ccNMjoBXzpTSAz7bPqE6tOK715EzVZsyxfo/vHG7GDk2QbThV8qcJNNUnbuTgAe9+NafswIa5UMDnBzJx/huItDfUJqYkxv2fsh8rzdMt8xvzTOnJ4wu+Go2YxccalXEO+dT0IDEZlAbvKkZEfxQQr2u12cUshZkPcXF5ptw2L8flzsRXWLFTvYg2kgD5+m4E9ve6+hnBqtzAU2nQ0BwHFyt/XW6epcRbTR8EOKYxVe2D1fq0dtYXEy9hJbtiGwuw2DyGPxynqPja8vLCraSbbld/n5VfCSiSI2rDwdlkfHVMOyDy/32uW2UxyJReHCijWvN9kCAn9n89eOs24l5DUGCLwdtSpzCzMn2vRWt/WkoAjkTRlVoGXQsQBHa3yYnM734y9UOOWKnCT6QFLrHjXknP5i7iQn7FoQ= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(70206006)(356005)(40460700001)(36860700001)(81166007)(83380400001)(26005)(44832011)(70586007)(82310400004)(4326008)(86362001)(5660300002)(426003)(336012)(186003)(508600001)(2616005)(47076005)(6916009)(6666004)(2906002)(36756003)(1076003)(316002)(8676002)(8936002)(16526019)(54906003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:13:31.0295 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6eaade8b-fd7c-47a3-1956-08d9bf5fb9e5 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT060.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5383 Received-SPF: softfail client-ip=40.107.92.51; envelope-from=Michael.Roth@amd.com; helo=NAM10-BN7-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov Mark property as experimental/internal adding 'x-' prefix. Property was introduced in 6.1 and it should have provided ability to turn on native PCIE hotplug on port even when ACPI PCI hotplug is in use is user explicitly sets property on CLI. However that never worked since slot is wired to ACPI hotplug controller. Another non-intended usecase: disable native hotplug on slot when APCI based hotplug is disabled, which works but slot has 'hotplug' property for this taks. It should be relatively safe to rename it to experimental as no users should exist for it and given that the property is broken we don't really want to leave it around for much longer lest users start using it. Signed-off-by: Igor Mammedov Reviewed-by: Ani Sinha Message-Id: <20211112110857.3116853-2-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin (cherry picked from commit 2aa1842d6d79dcd1b84c58eeb44591a99a9e56df) Signed-off-by: Michael Roth --- hw/i386/pc_q35.c | 2 +- hw/pci/pcie_port.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 04b4a4788d..9070544a90 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -243,7 +243,7 @@ static void pc_q35_init(MachineState *machine) NULL); if (acpi_pcihp) { - object_register_sugar_prop(TYPE_PCIE_SLOT, "native-hotplug", + object_register_sugar_prop(TYPE_PCIE_SLOT, "x-native-hotplug", "false", true); } diff --git a/hw/pci/pcie_port.c b/hw/pci/pcie_port.c index da850e8dde..e95c1e5519 100644 --- a/hw/pci/pcie_port.c +++ b/hw/pci/pcie_port.c @@ -148,7 +148,7 @@ static Property pcie_slot_props[] = { DEFINE_PROP_UINT8("chassis", PCIESlot, chassis, 0), DEFINE_PROP_UINT16("slot", PCIESlot, slot, 0), DEFINE_PROP_BOOL("hotplug", PCIESlot, hotplug, true), - DEFINE_PROP_BOOL("native-hotplug", PCIESlot, native_hotplug, true), + DEFINE_PROP_BOOL("x-native-hotplug", PCIESlot, native_hotplug, true), DEFINE_PROP_END_OF_LIST() }; From patchwork Wed Dec 15 00:01:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676989 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4DC77C433F5 for ; Wed, 15 Dec 2021 00:25:04 +0000 (UTC) Received: from localhost ([::1]:51312 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxI6R-0003J0-CY for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:25:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHvj-0007Wq-A1; Tue, 14 Dec 2021 19:13:59 -0500 Received: from mail-bn7nam10on2040.outbound.protection.outlook.com ([40.107.92.40]:51041 helo=NAM10-BN7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHvg-0005rO-GP; Tue, 14 Dec 2021 19:13:58 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dniVPkVnBLI1jcqbjQGDMMB0ZDbJLooUuH58Xpwz01Q/IHSXLBuaJwJPkXO4eq7nTKIXqHkZg5J05kxg7kWj6ExV/mnbbGIOJQHbieLPezaHai/g4goMtrjhhFkTHK9iGE9EnertWeyBKjXoTJohki/ejZmrWmcqatoaMsO9dJeWmw1ih7dntYV0ukgZn/gkJrKyuARudNCpW/BebBhCSiyhU4aPAjHo2N2WpCKb9NDs/Vz1Qp+tBoEqrpWTU2BQUvuR7tmJlOY8JVzuFjGPt3W09HcrmY98qljy3JZF81oujRGTt4OU9M2eX3xnTHn2aItCmtsEVzKJQw51ZCWcqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MQpEolrYULUH43xYHLxpK97VIQpUgNqzM92nqdSg62E=; b=kmrLwRFXe4qgIxNdz3XwCUIwSexNN0MHnx2BPB1I0qFs/419GaZ4qWzKamjyhoC4b/gjPFQxG7kza9qxzanQSXOrI08jfalvW8FVk/idbEIkAO/eXDWhKSK55mFpJlhWN2Wq3weAi0lku4M6Bd/pSXBkoRmwrPqxqN2MAxR0lozgP9e0Pt8WRu9jtURk6ihJS82cwi1GHW/juiT8shcQkMAcD/rci+stjaVFrTGcFeTjnbm2JiVeL9p7uQClecGGIaTmWkSgJiAssjmuUHX2OnAQYkSMy7juYSDK3lppphwsiCBk0IGqezwx5VZ6MJAw177SPDZXg5VT5PhwMz+ccw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MQpEolrYULUH43xYHLxpK97VIQpUgNqzM92nqdSg62E=; b=pxsYLLX7/6wHdiR7hmxqqJBHkQo3/JwE4R87V9Vnyh8tmMBSmtZjWs25EKuTW8gOTSL4px38fAQ44DGJtVyoUMt4yQ2H8c3dEgYAZcM2AZ6lehlRf31RFINgTXKRb26SihEML73CGaIvex9+9NyTXVPwKGF50ad6NIdafNW/tAo= Received: from DM6PR03CA0016.namprd03.prod.outlook.com (2603:10b6:5:40::29) by MN2PR12MB3278.namprd12.prod.outlook.com (2603:10b6:208:ac::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.15; Wed, 15 Dec 2021 00:13:52 +0000 Received: from DM6NAM11FT022.eop-nam11.prod.protection.outlook.com (2603:10b6:5:40:cafe::fd) by DM6PR03CA0016.outlook.office365.com (2603:10b6:5:40::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:13:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT022.mail.protection.outlook.com (10.13.172.210) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:13:51 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:13:51 -0600 From: Michael Roth To: CC: , Jason Wang , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= , "Michael S . Tsirkin" Subject: [PATCH 36/47] virtio: use virtio accessor to access packed descriptor flags Date: Tue, 14 Dec 2021 18:01:14 -0600 Message-ID: <20211215000125.378126-37-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0a273df5-c03f-4063-8814-08d9bf5fc637 X-MS-TrafficTypeDiagnostic: MN2PR12MB3278:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:197; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lPXsLNEmxEEtwMGeAHVr3uZlUpmNq2uo5EamWYoaNtmdxKuhafTHA+Pcn5d+rvYFQvXrPgD0roz6EcmX33Cy/4Dq5IjFe7zLfCP3oQwK2EJZTLQIwUaQOWFgswLo9nNpsYDEwAdwdbnMklQGA5Jqt8nt0p518TuctoI45GOOPMplRD/aE/ayvvcmIpbeL6b3Ek9ye9EeexvlGvo05VEKEdoU4pGZ2Cxpk76nJ03I+AMBYbjRH2oh9GeiDrYMaKyUC/X97+xfB6eIIscHHCcworKoaZeeKaRon9C1CyEO3XgfkpPyjFRwlHOfHEwVEFL+CDVHekuoaUUp/09BIe32iQc9+ulpn8e/PnKPcoFnalWfpRO9pC/kHs4KIJco7DYRuXUBC+yOxDkFpkv5XQ1I6JfWnXKadZtambKlcT08YK8nxCn1wdxVmHRIirNgRVhbIjAdMf1VYXYjTOmaxOe9/J6Q7qNMPJK0c7jRImu6OeReBYFlXGIdUKwkZMlLrM2dmvij8xlNfqP9zMEjkbkKnYUqTyiXfRsmAmWF/5+9jDYGH4BNUzfZnZTnUOIxCOjUyjA0tdidhvYMYl4Ad93TVhwxa4kGcWVxi5j0VnCgFhkJGFFToaOCV2HZ8vVMOnUh2UgLoJceBLUxPoPbxFHeH7nIe/kdMzc4YiU83pDXxBA92D+vQ/eI8ktcJlLMxyVQ8iWv8VPwNKaSXqGUcV4D3saDcq1MlFoChnTOoiJWlmDGcee6jHcJXL7T/9U2usYKgYA8moiMzltBiOzTmCscrFbaM9zffPIGHqqDY2qCqZk= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(186003)(70586007)(2616005)(508600001)(4326008)(70206006)(5660300002)(2906002)(36860700001)(44832011)(40460700001)(8936002)(6916009)(16526019)(86362001)(1076003)(8676002)(81166007)(83380400001)(426003)(356005)(54906003)(47076005)(336012)(6666004)(26005)(36756003)(82310400004)(316002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:13:51.6909 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0a273df5-c03f-4063-8814-08d9bf5fc637 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT022.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3278 Received-SPF: softfail client-ip=40.107.92.40; envelope-from=Michael.Roth@amd.com; helo=NAM10-BN7-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jason Wang We used to access packed descriptor flags via address_space_{write|read}_cached(). When we hit the cache, memcpy() is used which is not an atomic operation which may lead a wrong value is read or wrote. So this patch switches to use virito_{stw|lduw}_phys_cached() to make sure the aceess is atomic. Fixes: 86044b24e865f ("virtio: basic packed virtqueue support") Cc: qemu-stable@nongnu.org Signed-off-by: Jason Wang Message-Id: <20211111063854.29060-1-jasowang@redhat.com> Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin (cherry picked from commit f463e761a41ee71e59892121e1c74d9c25c985d2) Signed-off-by: Michael Roth --- hw/virtio/virtio.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 874377f37a..2dbccb6b3f 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -509,11 +509,9 @@ static void vring_packed_desc_read_flags(VirtIODevice *vdev, MemoryRegionCache *cache, int i) { - address_space_read_cached(cache, - i * sizeof(VRingPackedDesc) + - offsetof(VRingPackedDesc, flags), - flags, sizeof(*flags)); - virtio_tswap16s(vdev, flags); + hwaddr off = i * sizeof(VRingPackedDesc) + offsetof(VRingPackedDesc, flags); + + *flags = virtio_lduw_phys_cached(vdev, cache, off); } static void vring_packed_desc_read(VirtIODevice *vdev, @@ -566,8 +564,7 @@ static void vring_packed_desc_write_flags(VirtIODevice *vdev, { hwaddr off = i * sizeof(VRingPackedDesc) + offsetof(VRingPackedDesc, flags); - virtio_tswap16s(vdev, &desc->flags); - address_space_write_cached(cache, off, &desc->flags, sizeof(desc->flags)); + virtio_stw_phys_cached(vdev, cache, off, desc->flags); address_space_cache_invalidate(cache, off, sizeof(desc->flags)); } From patchwork Wed Dec 15 00:01:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677067 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 54305C433EF for ; Wed, 15 Dec 2021 00:54:39 +0000 (UTC) Received: from localhost ([::1]:55098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxIZ4-0002RI-Au for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:54:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53134) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHw3-0007h6-R6; Tue, 14 Dec 2021 19:14:20 -0500 Received: from mail-mw2nam08on2054.outbound.protection.outlook.com ([40.107.101.54]:6273 helo=NAM04-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHw1-0005rx-O1; Tue, 14 Dec 2021 19:14:19 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dAZ47rCMqLdnHBL85mua3mZNAkKoZN3YIDHpsihJ7Zt/a233q+rw/VlLwydiO0xERG6TJAXeN1Hk/LcxNAh9alZGvg7a45qKjLWHEbcV4meR9Cr3mDoCFwTNx+wDDfDR9HX19Sxm6hG+X0JjI91Of8uiEvdOjkcFLJJH9gfpUz/9GucpqXlLeNYBWRuz3OoooPU1DpIT57VADvQDEimeizqHjt9cz3+Y/GQZRXIixYd5eZours1WQjAW3fzMBOJX7boP0OBxA0dxur0UcdzBreqG1GXKAKkbVBS6JWVZk4J9fiNlh8T+DpqemX3RMx/b3p9rTppfNW90vyio0KfWsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=g47yNiRP7LVDXalA1TxaJFioLHbglL02lUbHv7X02sg=; b=KfhjnRPTAfpKWKG/9Yx6gE8OHaG73u3nGfnRHDBU6QW9tgsSgNK3NzF5cRK6exSXdDeauj+vp76V38cFH0atQw+7foPdxbE4FMhzfZztUQ/t3aM4fwz1bexy9Av5ZqxIvRUSiPlvSmrAtxWs3F0xuf0HiMustHmReZlJS1ICSbKiX+4evr2u9FWNvSLFnC9mOdJZPJgIWgD6wqXOJ5y/yPsLQzKh+S6+GUXwGE3UkezFIQ8Q5ponrP1NXFJ15etuZUlxqWL86Bhcs03rdYgDpt0weZq6oYMmPwN2OK3E/YjCj2hO1vbAMBG/O69O/jKcL+nnhWK6nWD61XvjsBPc7g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=g47yNiRP7LVDXalA1TxaJFioLHbglL02lUbHv7X02sg=; b=F+5aAldpAsE4yUm//C0uiteB7by6PAmezNL5/jXGULfSzbGFRAaM+huJFqR0D2I/5B/CL4aKJvz9d3ckyoZKzkgPC0VINxlwzv6X+8z+BNl0JmbxggJHOBmV2n2Aq3p1lQ355c3mO5GOABwOaJbEzS6H2frdHeJl1AwxATqsQWw= Received: from DM6PR05CA0063.namprd05.prod.outlook.com (2603:10b6:5:335::32) by BY5PR12MB3714.namprd12.prod.outlook.com (2603:10b6:a03:1a9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.15; Wed, 15 Dec 2021 00:14:12 +0000 Received: from DM6NAM11FT039.eop-nam11.prod.protection.outlook.com (2603:10b6:5:335:cafe::fb) by DM6PR05CA0063.outlook.office365.com (2603:10b6:5:335::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14 via Frontend Transport; Wed, 15 Dec 2021 00:14:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT039.mail.protection.outlook.com (10.13.172.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:14:12 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:14:11 -0600 From: Michael Roth To: CC: , Jason Wang , =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= , "Michael S . Tsirkin" Subject: [PATCH 37/47] virtio: use virtio accessor to access packed event Date: Tue, 14 Dec 2021 18:01:15 -0600 Message-ID: <20211215000125.378126-38-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f73beb56-2490-49b8-71f8-08d9bf5fd259 X-MS-TrafficTypeDiagnostic: BY5PR12MB3714:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:913; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sAIxZv4NOavqx1tottXm26caNeMyrhMn02Eth2j0/KgwREzoCA0jhC4dRlMlqziGwrGro4NnQly3j6BNr1rjAGh0eH5VUgw7e+lUgyhIuzcL1uGB649+baOPBFKXSK9t5PbfifCUvwszL5R3+E2WV98NcKUHVG4B8tJ0IVv3Cd/sJij1az8O5czdqxHGYiAPjAAUBUybipUwANs+qCP53UzjcBjnieyEQCpdHn5+WXsabmMEN6cYwjELXt3n7V9dEPNkGw8UpoMItLQiWllNpa7Ly2hEI/Yyn+fyjMTiFZGOco8kmoEqNfG8dS/Y8kRc72/kmnNVRtAZjqtJYa5GXY6H0m7BWlgdjceuhKudUeWvPKIUydIGOnLljdgUIHcJFer5oS9mQVVFyXBg7muVzuMCb3Bm4g0Q+vQIuynoYLq5aSrHhs9Zd4PsWFDuGpHYcv7EXLSRw//PEpgUNgdrNUtBWsAvC7gqZFk4tDJANo/+Po7l3/sWxIlkpRiayAFykgxkRw5G0MSmCPB4xxan8z6/945MpKvZvTQOuPnZMJYo+MM3ZYrBZJjFhZO+qqj5nYvo8r0g4MdV4AzWbvUJ4lL6+3+yI0kk7G35zNQdgQdeg4eJa0qKAY6TdhOl6JHWNcHwYiXhwvFxazm48rOMNVUQrhB6EYIkkg3SoJCFqcloMnKV60oQt8ARwHgZO6x9GEdHFrgi4tkhp9rDsdry9c+RygSjqa4qTdV2t6lmB8PlcUgOiIHWX7AdmB/f196DRM2/X30eT0gU3ggbMWpOcB1h/rVQ5dHeIVx8NxrRrm8= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(44832011)(186003)(1076003)(426003)(26005)(6916009)(316002)(2906002)(5660300002)(36860700001)(83380400001)(40460700001)(54906003)(8936002)(86362001)(70206006)(16526019)(4326008)(82310400004)(70586007)(36756003)(2616005)(336012)(8676002)(47076005)(81166007)(508600001)(356005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:14:12.0573 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f73beb56-2490-49b8-71f8-08d9bf5fd259 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT039.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB3714 Received-SPF: softfail client-ip=40.107.101.54; envelope-from=Michael.Roth@amd.com; helo=NAM04-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jason Wang We used to access packed descriptor event and off_wrap via address_space_{write|read}_cached(). When we hit the cache, memcpy() is used which is not atomic which may lead a wrong value to be read or wrote. This patch fixes this by switching to use virito_{stw|lduw}_phys_cached() to make sure the access is atomic. Fixes: 683f7665679c1 ("virtio: event suppression support for packed ring") Cc: qemu-stable@nongnu.org Signed-off-by: Jason Wang Message-Id: <20211111063854.29060-2-jasowang@redhat.com> Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin (cherry picked from commit d152cdd6f6fad381e804c8185f0ba938030ccac9) Signed-off-by: Michael Roth --- hw/virtio/virtio.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 2dbccb6b3f..c9567f09ed 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -249,13 +249,10 @@ static void vring_packed_event_read(VirtIODevice *vdev, hwaddr off_off = offsetof(VRingPackedDescEvent, off_wrap); hwaddr off_flags = offsetof(VRingPackedDescEvent, flags); - address_space_read_cached(cache, off_flags, &e->flags, - sizeof(e->flags)); + e->flags = virtio_lduw_phys_cached(vdev, cache, off_flags); /* Make sure flags is seen before off_wrap */ smp_rmb(); - address_space_read_cached(cache, off_off, &e->off_wrap, - sizeof(e->off_wrap)); - virtio_tswap16s(vdev, &e->off_wrap); + e->off_wrap = virtio_lduw_phys_cached(vdev, cache, off_off); virtio_tswap16s(vdev, &e->flags); } @@ -265,8 +262,7 @@ static void vring_packed_off_wrap_write(VirtIODevice *vdev, { hwaddr off = offsetof(VRingPackedDescEvent, off_wrap); - virtio_tswap16s(vdev, &off_wrap); - address_space_write_cached(cache, off, &off_wrap, sizeof(off_wrap)); + virtio_stw_phys_cached(vdev, cache, off, off_wrap); address_space_cache_invalidate(cache, off, sizeof(off_wrap)); } @@ -275,8 +271,7 @@ static void vring_packed_flags_write(VirtIODevice *vdev, { hwaddr off = offsetof(VRingPackedDescEvent, flags); - virtio_tswap16s(vdev, &flags); - address_space_write_cached(cache, off, &flags, sizeof(flags)); + virtio_stw_phys_cached(vdev, cache, off, flags); address_space_cache_invalidate(cache, off, sizeof(flags)); } From patchwork Wed Dec 15 00:01:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12676997 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0060DC433EF for ; Wed, 15 Dec 2021 00:28:03 +0000 (UTC) Received: from localhost ([::1]:33244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxI9K-0001nX-TS for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:28:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53182) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHwP-0000RL-Kl; Tue, 14 Dec 2021 19:14:41 -0500 Received: from mail-mw2nam12on2049.outbound.protection.outlook.com ([40.107.244.49]:8545 helo=NAM12-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHwK-0005sy-E4; Tue, 14 Dec 2021 19:14:41 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RZ4T/uIqhRHTAptqp9g5diIPGoRhPbLr+KyU3GunRUcc8d2Awl8kL69Kozq5TFHoZhl3lNOjBJgDeptnCNm4T/iXG6whcSfPqpsxoRiiO+/w8wTW0bi7eFqUVMtgB6qw5NCOzBc+6bjTWiwiLOapeqfal8gUwTgIwz+fM2ioMjSzSy3ZMnnKUnhvuN5BOjXQ/OMZ3XBKcQcWlbCi0PS70H9DdblolqpGt64nkN2OxLqek+FStPkea9T8Pi3Sj5lbM0wk2RwRHjGb0vEfKIbm1AG3s2uOV6h80Dz4a6KaF2VLhOG9xPIRORxl07wvauEVBjMe/vN3RHFLcEQYjc7iHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6VkhSbSvcMv8eB1NQ7wwkGHdnQCcyW5AZDpcSjndIMU=; b=h2zLflsZvExl85oMNSSbfrGOVONsqge3nlOlZESaoR1bWskSrMD8eKb4L9lO6EwxjXxNy+qzgFqYggx46a+Hp3SDRXa6tzi+YFF+Iu4H4Y4ED4s7VACRl6Tl+tGlxV3AEpoVdtuYz6zlaj3sEH9ltsq7H+oD+uQ2L4t3fFZv4TmUEi3NXiIKnyCUbWe8yo7ubyRfGTAoemwSqli+gmnFhM4Frsm1HDPcgQpd72bTEizhtFQ+4dhAkAngQLKvO+VXS0Tm5GecIuNyqYBi/qbw0cHwhmcZlniLgUr13Lr3VCuiXvyskiYddbVo/SH4jvOqPH+36hjjMlI7CgFb/KsFjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6VkhSbSvcMv8eB1NQ7wwkGHdnQCcyW5AZDpcSjndIMU=; b=X8ZFk3IP/Ve2xF/d7Rd0FVAgU2A8iyghhsS1aPelnKRHqYDZxquLzZwbdNww/W75/Vf+5mhXAz9DxOP3Iq0Oxnzc1jvE9wsxO1RT+GVxNF/qRnLhhHFXm3+aZPqy+jViQw0fBCeZR9OJOj25IeTUpnFmIrtdRcgy8XQrerkayvw= Received: from DM3PR12CA0068.namprd12.prod.outlook.com (2603:10b6:0:57::12) by DM5PR12MB1644.namprd12.prod.outlook.com (2603:10b6:4:f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.12; Wed, 15 Dec 2021 00:14:33 +0000 Received: from DM6NAM11FT041.eop-nam11.prod.protection.outlook.com (2603:10b6:0:57:cafe::68) by DM3PR12CA0068.outlook.office365.com (2603:10b6:0:57::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:14:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT041.mail.protection.outlook.com (10.13.172.98) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:14:32 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:14:32 -0600 From: Michael Roth To: CC: , Peng Liang , Alex Williamson Subject: [PATCH 38/47] vfio: Fix memory leak of hostwin Date: Tue, 14 Dec 2021 18:01:16 -0600 Message-ID: <20211215000125.378126-39-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ee2fcaaa-04ba-4e18-c62d-08d9bf5fdebf X-MS-TrafficTypeDiagnostic: DM5PR12MB1644:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:459; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rL8WjSaC74DuoR2DGPiFCR00gy9UuWeJndWlTno8OUK8Qaos8VEDcukK2WP3PM7gManVW+8im9ieT9Kn7xiPwELLKQhVBqEFi5tmXqwYd/g4AE1ubQ3XDMrEUVsbNmSTFmyBrFGpZA/XZFFoB9P+lojGm4iOISLwDspIjasJpst8SUmLy61bLA8e8GhQ54TeOFOhBELSwlY+d8SOvE90c6ho2R9h7a3jyu+ZeXuzZ/tviUTFN3/mFt3IIcUtSIXYshGsSErVsdE8CkIax903JqAgr39NljgyRgQ1qwvdeTbW36WMJkNKKduwlW3lY4Ag3le5Wo7tc22xTiTYMTIooh6ttYg9mQzBi0JPw51n+rQC2dST+qhgQwEuDadjpv3uzH05mfhijj/VZ2H+qbAgeYMRTJXftNSdoAbFQS4kGD3Z5LtKhJ5bl6KW92CSaYslW0SVTWkjuNLU0Cn9r1pfhDdpOOBGAXi6/0mIESngp/Z+6b6IQW2GSX2+SHDynB4qxbCGj83M25AIshc+cgFo9JGKtw5z0o2cZqWqC/cpNpeZtccuD7S+LcLbSmHdc4m/cKjAYv5VMEj5lRqC0HWEJLx0ILIen28oBjoGvBKr6RwyTAdLjfA6IdFtH16rU4kHieYvzAV4AA7azqlNGyXQEM9XUr/fF0vH2qJxQ5tnzb4+VQrJe8N/Ccojo8C8mNpXgyJuCKJnISLbaX8prwVIeYfxDJImTBC9TjOR8bY9UaZD2gOezCh343b/Ng23JcYUkSW9UHnETLIkmojk4rKjI7A0Bzz0kbFpX1g/m/Qd9w77KwXMHTxa+YIWZ9Qyi+7urCCJVlRObvl3sqFrC77ZA2XPlmhN8WHDCtLYR1zTyM+p8VjBYCW2qYJ1YcYuxd16 X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700001)(36756003)(70586007)(8676002)(36860700001)(8936002)(508600001)(70206006)(81166007)(44832011)(5660300002)(966005)(1076003)(426003)(186003)(26005)(2906002)(47076005)(86362001)(356005)(6916009)(82310400004)(336012)(40460700001)(316002)(4326008)(16526019)(54906003)(2616005)(6666004)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:14:32.8919 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ee2fcaaa-04ba-4e18-c62d-08d9bf5fdebf X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT041.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1644 Received-SPF: softfail client-ip=40.107.244.49; envelope-from=Michael.Roth@amd.com; helo=NAM12-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Peng Liang hostwin is allocated and added to hostwin_list in vfio_host_win_add, but it is only deleted from hostwin_list in vfio_host_win_del, which causes a memory leak. Also, freeing all elements in hostwin_list is missing in vfio_disconnect_container. Fix: 2e4109de8e58 ("vfio/spapr: Create DMA window dynamically (SPAPR IOMMU v2)") CC: qemu-stable@nongnu.org Signed-off-by: Peng Liang Link: https://lore.kernel.org/r/20211117014739.1839263-1-liangpeng10@huawei.com Signed-off-by: Alex Williamson (cherry picked from commit f3bc3a73c908df15966e66f88d5a633bd42fd029) Signed-off-by: Michael Roth --- hw/vfio/common.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 8728d4d5c2..af37346aca 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -551,6 +551,7 @@ static int vfio_host_win_del(VFIOContainer *container, hwaddr min_iova, QLIST_FOREACH(hostwin, &container->hostwin_list, hostwin_next) { if (hostwin->min_iova == min_iova && hostwin->max_iova == max_iova) { QLIST_REMOVE(hostwin, hostwin_next); + g_free(hostwin); return 0; } } @@ -2230,6 +2231,7 @@ static void vfio_disconnect_container(VFIOGroup *group) if (QLIST_EMPTY(&container->group_list)) { VFIOAddressSpace *space = container->space; VFIOGuestIOMMU *giommu, *tmp; + VFIOHostDMAWindow *hostwin, *next; QLIST_REMOVE(container, next); @@ -2240,6 +2242,12 @@ static void vfio_disconnect_container(VFIOGroup *group) g_free(giommu); } + QLIST_FOREACH_SAFE(hostwin, &container->hostwin_list, hostwin_next, + next) { + QLIST_REMOVE(hostwin, hostwin_next); + g_free(hostwin); + } + trace_vfio_disconnect_container(container->fd); close(container->fd); g_free(container); From patchwork Wed Dec 15 00:01:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677017 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 98DBBC433EF for ; Wed, 15 Dec 2021 00:31:03 +0000 (UTC) Received: from localhost ([::1]:42068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxICE-0007mc-FY for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:31:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53262) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHwu-0001ND-Iq; Tue, 14 Dec 2021 19:15:19 -0500 Received: from mail-co1nam11on2043.outbound.protection.outlook.com ([40.107.220.43]:56161 helo=NAM11-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHwg-0005w5-Tm; Tue, 14 Dec 2021 19:15:06 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oVjyODyn5uTYQ/Nj1j/CyL6rzWUrtI82kgCRlz9MiSp7Xl/rNZcl1xNp1fiNplUM7UCyLG+4R8N459haA9ohAhUA6cA2Pn4WJOoHnJJTLoq1IuAejn6s0JsQ5R9fa35/qqourguy1tITpIBY7HAD1xTFL0wZk1K7POttKipo1p4iSB1MunaaA5O02KIPYB68kH4ZXG6EyJR39f16k5MEjlBORyk6xYVJwLOxl3yuGK7vjZYkC4agOopoBQ2yTpmV2DVTQE4yzxIzDhKpJjz52j5OPcB9qs9zi6EFlGt2O6jv5to6sysTqxWwzf9aVA4jByd1RG8g/AL2Ck3yGtWi4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PbU8CV4/082Z9DsQLKqW2IysZIhFFCFtDaffzKlrLCk=; b=WAVcC0SXH+u0kLJcLpG1EicGQ//oqPNhnW5QTbbjhxKAEoPAJzZMZEEpPhP+nxVlNsxWZ3tySYqV2aIGiHOlUhVvb/BxGPKSWY9xQ5POXWBG488w7cZfyOJ/plbmPYWpVKb5IbdJg7RJQV3OJ7nWzPxGnCqdJlmA0MkjGlb9oIgVxcKTDaD14YYSPhbDjo70PEH/xJgyyZoYwwOk+Wb15YR9OZoRGz5YSLQBVrj1cpB+zHsqGHMhxQcM3LDdSZkEXYnyjATEROo/Z6PZs7VId9kJuB8QnMwTnlI7galOwUasXAVNrisabofrSA32jJEn2wIY6EN0UyCVEI3xYmVk2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PbU8CV4/082Z9DsQLKqW2IysZIhFFCFtDaffzKlrLCk=; b=ge7qYmNyln3+tcKGJaTwERBafSwIbUV+UoOWVh2Oi56OHAxBmudbOClFbAr7E3YNuN/1s1kINrzUkDOIEt/9Hutaw0aI466DUcFEAQqVu+GofPlb2XxAmXdgoIuM6cM8bJhxZr8C6hcxRSrGgnnmuz7dJNdIRnMCnZkHGt7LXVk= Received: from DS7PR03CA0282.namprd03.prod.outlook.com (2603:10b6:5:3ad::17) by CY4PR12MB1750.namprd12.prod.outlook.com (2603:10b6:903:11c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Wed, 15 Dec 2021 00:14:54 +0000 Received: from DM6NAM11FT049.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3ad:cafe::24) by DS7PR03CA0282.outlook.office365.com (2603:10b6:5:3ad::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:14:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT049.mail.protection.outlook.com (10.13.172.188) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:14:53 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:14:53 -0600 From: Michael Roth To: CC: , Eric Blake , Vladimir Sementsov-Ogievskiy Subject: [PATCH 39/47] nbd/server: Don't complain on certain client disconnects Date: Tue, 14 Dec 2021 18:01:17 -0600 Message-ID: <20211215000125.378126-40-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: acb6d5e6-5098-4112-beb4-08d9bf5feb55 X-MS-TrafficTypeDiagnostic: CY4PR12MB1750:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1923; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7Ywbbjgswmxw7XpQNkJQCI9AbaNS3V3dosbyWwkW5sP9504cpN8EHvU3hQtPIAmnqZkZAQ0PcRTFGrR1lS+/yHsBM64fWPb8glChRh/eS3hrmEelyU1efgHUEca2hEue86Hz5ijSSQutpKLM95UEToxTmTyUmwlruRNlbYaYh7SpR8r7jOKYMRqbvq6awdHRKEX42Upc0JYqqvHLm3eu66+Z4hXgs1u6A6Dk0LQKZeoDl45GkFZjboINYx00H4yqYCqFdteNrYtQApn1Ur7jnsZb3cD4QbHUmwpZhTtFfI76c03MdGrECV7ifMsWMWG81UrGR0HOCadh9zVUaFNxfc2FiVUc4JR8HKS5oTPOcX/0vcSAwmWCoJW1ikiNhGXkbgjwgGpdaI5Wwl0MQ3odtGDHXl5pt8hvwJgV+BQcg19pkiSq2gwZOG63T9cYA9tqj49NfgLZ3opTeS0LM9zJMyQaaGtkou+AZ9HWeMuMtvn/g0T+ChfM9TohlHLVBcxKoacsQD3VeLKqCwr7AX4DhbsvKi8wGzQ9nwJNyX9gu+kLy7WjAxAnXyXUp8uyn+bzPdYntzGCUBA8Lo30BzmKz19KCE5KaO40xbGAt/XeEuc58EnzjpX1RbOJXx5xSVZDN/dj/U8bu3vanCgQg7xcUk2w8umkKs7OMn5o8wY5FbwqNnvH9ZJ4XMdsEIhEDIfdGdC82kFKe7wTfHVjIkg8k6LqGF3D3jug/07XghaJAeggKVKfS4tqkkwNDxkdcG79KuN52UzgJXWPBdVz72lv/m/1K1elvyyNo7zaZzTh8004Opp1odS33IsaAuYUA1zzzzsMk3dUt4FMw/YT8e6Sew== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(86362001)(2906002)(6666004)(5660300002)(6916009)(356005)(47076005)(70586007)(8676002)(1076003)(70206006)(508600001)(81166007)(8936002)(4326008)(26005)(54906003)(82310400004)(426003)(40460700001)(336012)(36860700001)(2616005)(186003)(316002)(16526019)(83380400001)(36756003)(44832011)(33290500001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:14:53.9761 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: acb6d5e6-5098-4112-beb4-08d9bf5feb55 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT049.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1750 Received-SPF: softfail client-ip=40.107.220.43; envelope-from=Michael.Roth@amd.com; helo=NAM11-CO1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Eric Blake When a client disconnects abruptly, but did not have any pending requests (for example, when using nbdsh without calling h.shutdown), we used to output the following message: $ qemu-nbd -f raw file $ nbdsh -u 'nbd://localhost:10809' -c 'h.trim(1,0)' qemu-nbd: Disconnect client, due to: Failed to read request: Unexpected end-of-file before all bytes were read Then in commit f148ae7, we refactored nbd_receive_request() to use nbd_read_eof(); when this returns 0, we regressed into tracing uninitialized memory (if tracing is enabled) and reporting a less-specific: qemu-nbd: Disconnect client, due to: Request handling failed in intermediate state Note that with Unix sockets, we have yet another error message, unchanged by the 6.0 regression: $ qemu-nbd -k /tmp/sock -f raw file $ nbdsh -u 'nbd+unix:///?socket=/tmp/sock' -c 'h.trim(1,0)' qemu-nbd: Disconnect client, due to: Failed to send reply: Unable to write to socket: Broken pipe But in all cases, the error message goes away if the client performs a soft shutdown by using NBD_CMD_DISC, rather than a hard shutdown by abrupt disconnect: $ nbdsh -u 'nbd://localhost:10809' -c 'h.trim(1,0)' -c 'h.shutdown()' This patch fixes things to avoid uninitialized memory, and in general avoids warning about a client that does a hard shutdown when not in the middle of a packet. A client that aborts mid-request, or which does not read the full server's reply, can still result in warnings, but those are indeed much more unusual situations. CC: qemu-stable@nongnu.org Fixes: f148ae7d36 ("nbd/server: Quiesce coroutines on context switch", v6.0.0) Signed-off-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy [eblake: defer unrelated typo fixes to later patch] Message-Id: <20211117170230.1128262-2-eblake@redhat.com> Signed-off-by: Eric Blake (cherry picked from commit 1644cccea5c71b02b9cf8f78b780e7069a29b189) Signed-off-by: Michael Roth --- nbd/server.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nbd/server.c b/nbd/server.c index 3927f7789d..83aeed51c7 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -1413,6 +1413,9 @@ static int nbd_receive_request(NBDClient *client, NBDRequest *request, if (ret < 0) { return ret; } + if (ret == 0) { + return -EIO; + } /* Request [ 0 .. 3] magic (NBD_REQUEST_MAGIC) From patchwork Wed Dec 15 00:01:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677059 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6F121C433F5 for ; Wed, 15 Dec 2021 00:49:54 +0000 (UTC) Received: from localhost ([::1]:42754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxIUS-0002TL-U7 for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:49:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHx8-0001Ux-TI; Tue, 14 Dec 2021 19:15:28 -0500 Received: from mail-mw2nam08on2070.outbound.protection.outlook.com ([40.107.101.70]:21089 helo=NAM04-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHx5-00060Q-L9; Tue, 14 Dec 2021 19:15:26 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k1yMKobz14Bs3lqULSX4+nUH/GwqXoKdJzsvQyAj1hUaIWhWWKEoqfZ1/mXPKBF1+SvaiV9/B4OfQhSDf7UMs61jCKXR9azJKhGAZRSP+ajwf+JzNzJ0r2Qet4UWcJ/kzJd1NfxJPT9mYBqY7G9oaoOnreJysPSKWjS2YP7ZWpyv27ENEGePzNOU/bs35VaLyimus0poU7noUHqg3boKXD2sPJ2E8OlzMejvOfF+sbU56rwkW5sDRBTlqNyXB0wRME58EYrJ4pLCPqdB8HEPUB5O3iBQIFGWj9yo04sKnaE1gKsgqTiZI1WYn9e2/r6B4Yt/r+aNchO7hzy4YXMYOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=k0dHR/QgpArLHk2TA7i0I2yumXF2pB/+3eP31oiWiPI=; b=Fd+mJ5S7ZtWoLJxUcFTVlQpaHgAD1gqZ2vRx640YBFGO24gwmJV9oOxrVCv9TVWWsYxdkdEXAPwdhEXLcuxTMLe+ltA+x2bkKxLMr776OP74lmcwVPSOamkeqEyQnA/tTAFx4ISuBlYhGBYqIr800oqxST410YHhI1e83k2JXhGM/qOLo+rNSH8oMupHUkYU3XVEu2jXuKg9mT0K3uQoWe/rhLmOQr5h7Ws6WiOa+qwRJszx4+EWJsiEyOT5wocaDy5+ZfFSuFJ/HcTkWh7nxd2u3pRHf0liDvfC4kLiWkPZ5tRjc7i/EvASmcu8TES6XA1bIrQmEE1d3+ELUoRhJw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k0dHR/QgpArLHk2TA7i0I2yumXF2pB/+3eP31oiWiPI=; b=1gfOWrww4LjT29Rp/NikpbnLtzZQ2xXPL1dU52RU3lu5PSOOgQHAoQgzckNMM0pFFbRK82O+qLHl/vZGlLGflk8ji2SJbBZTmPDcekL3YcF/RN6TptIuN0vQIEiGpXIOlJ+mDGiyB/8Z21FI5DT9BmBoFjTjhSsUib7R/YEhPeo= Received: from DM6PR05CA0063.namprd05.prod.outlook.com (2603:10b6:5:335::32) by BY5PR12MB3714.namprd12.prod.outlook.com (2603:10b6:a03:1a9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.15; Wed, 15 Dec 2021 00:15:15 +0000 Received: from DM6NAM11FT039.eop-nam11.prod.protection.outlook.com (2603:10b6:5:335:cafe::7b) by DM6PR05CA0063.outlook.office365.com (2603:10b6:5:335::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14 via Frontend Transport; Wed, 15 Dec 2021 00:15:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT039.mail.protection.outlook.com (10.13.172.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:15:14 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:15:14 -0600 From: Michael Roth To: CC: , Klaus Jensen , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Qiuhao Li Subject: [PATCH 40/47] hw/nvme: fix buffer overrun in nvme_changed_nslist (CVE-2021-3947) Date: Tue, 14 Dec 2021 18:01:18 -0600 Message-ID: <20211215000125.378126-41-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 63cf7ae2-8ecc-4b38-8ea8-08d9bf5ff7cb X-MS-TrafficTypeDiagnostic: BY5PR12MB3714:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:64; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I2Sdg/xKVCxTsjIfGLLDRahpIu0yIN/rvaGIEXQboZ62BCW1SRMvIadwhdCZgbUpkB3U3pUi4bd18ApCCOjN9d7ekGtcwJGhw342BsyMJDik7jRn4vNa6v0fJdtpWPxWV+Z4Xt0Ay3q1byWdoitGph6zpzX1cB9XkZDxALYtS4MC84vys0CwjszSNXeHYxL2D5U1G7MtctRKiBpKzhuGV/HjeZ/CXEitDLQeSwq+9FUq9wTwJiC0qzYlqgo1IahSlMqhRGyg7JtmIZ3O3MOXoFf/M+ktnnJnyRRUeuHqWlbDXX7piIZWP3bLH+FVx4tMB8m0fCuvZg87eE2RGxb5dWDZf6A8XEzy/Ik4nUd1+L8gggWckl00jm19ucwXaieEiUU8iBCvmCtiV3LZu0Ya8s8no23P04Xojkh9M7TVRXCVSJm4v1JMKDBB2Sw3FbpZjcYQtvU7EoFC+RySKmQvM5Kt+RaZyHQYZk+J4iSlJJ8iaTQ3d0DgoRhA5cRfCPK8g9R0v3+0SFg6RsHGa8ymOPa9iET65dT9I2Os1tdVQupw0TrSSSecPqumSSnDekBXyi4FR4/yBzI+bX2DAFnnppZZ9dPzLvXxb18u6vtCeDCiEHUlVpM+qM3nXcHkxWmJGr4AerLUYxNzo+4UiJpqqDnxnd3yja29AxIw3FsYApBfi5XlFQ/nzf6kiTQsfzYaUlCLiQw0VYNdi/MsvI/hIhj5xR1AtrwtPJ2tPM34wVvpjys2iNHtXyvGa735GBMdHXxNkf4oyY62TdCsgMyBMXqPEsAiF1BuxxMM5Z470DQ= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(40470700001)(44832011)(186003)(1076003)(426003)(26005)(6916009)(316002)(2906002)(5660300002)(32650700002)(36860700001)(83380400001)(40460700001)(54906003)(8936002)(86362001)(70206006)(16526019)(4326008)(82310400004)(70586007)(36756003)(2616005)(336012)(8676002)(81166007)(508600001)(356005)(45080400002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:15:14.8809 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 63cf7ae2-8ecc-4b38-8ea8-08d9bf5ff7cb X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT039.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB3714 Received-SPF: softfail client-ip=40.107.101.70; envelope-from=Michael.Roth@amd.com; helo=NAM04-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Klaus Jensen Fix missing offset verification. Cc: qemu-stable@nongnu.org Cc: Philippe Mathieu-Daudé Reported-by: Qiuhao Li Fixes: f432fdfa121 ("support changed namespace asynchronous event") Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Klaus Jensen (cherry picked from commit e2c57529c9306e4c9aac75d9879f6e7699584a22) Signed-off-by: Michael Roth --- hw/nvme/ctrl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 6baf9e0420..27dddb87bd 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -4164,6 +4164,11 @@ static uint16_t nvme_changed_nslist(NvmeCtrl *n, uint8_t rae, uint32_t buf_len, int i = 0; uint32_t nsid; + if (off >= sizeof(nslist)) { + trace_pci_nvme_err_invalid_log_page_offset(off, sizeof(nslist)); + return NVME_INVALID_FIELD | NVME_DNR; + } + memset(nslist, 0x0, sizeof(nslist)); trans_len = MIN(sizeof(nslist) - off, buf_len); From patchwork Wed Dec 15 00:01:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677021 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9E596C433F5 for ; Wed, 15 Dec 2021 00:32:32 +0000 (UTC) Received: from localhost ([::1]:45022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxIDf-0001Pa-KG for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:32:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53574) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHxz-000220-BF; Tue, 14 Dec 2021 19:16:19 -0500 Received: from mail-co1nam11on2074.outbound.protection.outlook.com ([40.107.220.74]:17856 helo=NAM11-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHxk-0006B6-CP; Tue, 14 Dec 2021 19:16:18 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f24KC1p+KQBIo8yZtR5BPP//UUe6gYtPWv5gMf60y3PryhGr77UOZkMFS+CjrMCSDrHsA2oBThEt3u9Pm9svHO8kzqSfvD/8R1MNv3uf+VEFaWgQZqXH79g8i14yp9UNZhFKGJ78aiJauz66kc8i7ChNu5lVfrhKY8dNyArFTJVpPbl6rS9i2594QhzwpP/G/FGeVxlo1O6eI/gH3RU9ouByG5u3bv5raCJ90Ufh8V3ocv9/CqTNE33LkstychEUmdFgqMlYRgzjuH8eI/gen0gPmeuH/3c2EDyhDup7/sFQKhTo3xSzzE5PtJKx3FGjS016BjAIe4YVpn3Ru/cPlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MjF8VJuERWgAxWJzCvPcTNpSt0AhBvmKppGdnY8PBxc=; b=GbBaZOKM/h9/1I9Oz3knhMgqxXcAma+dtY/r2XJLPLxNTYRfqn8hVmtGIEgk+h+T2xXWOjMfwCwFvWItpFUfDC82pJ92DYS9j2rh5wjTX/k24BmoG0hh8rusP7G/Q4XMZ043F7zEOTppXqNzIricsF5T4Cn9faxI52thqC9m4p/WtbLhBfi/GFY+VDfFwx8n3ZUvX7NT/f8dwMsSkTCuifLeHWgfyYQi1IUWASeYFtox59cGgoDKImR6SgHsYLdQa039OOG8JkrI+W2dC+i/jGHLBhQ+FxrIk3f3vT+ZmeQkMM8+zGkcaMCi8C0i6IxsE+7Qq0nTHy41phUnQ5+2/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MjF8VJuERWgAxWJzCvPcTNpSt0AhBvmKppGdnY8PBxc=; b=W7L9zgXpY/YG9ZrPlCRm3TFUqmQSeSKRWLi+jJIk+KOsh+NXBIgAnqPnkfUpdVl1tzFxKqBdtSrPdqLlj6Gbpl/CUB2jV2S37cn9MBtWpGOPfw1yEVCrg7oIhf6A6DbcM3Mg9rOiwU3YFaC/XGJRZQbwq5y1vdR+yuHPy/h/8nY= Received: from DM5PR18CA0073.namprd18.prod.outlook.com (2603:10b6:3:3::11) by MN2PR12MB2877.namprd12.prod.outlook.com (2603:10b6:208:ae::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16; Wed, 15 Dec 2021 00:15:56 +0000 Received: from DM6NAM11FT048.eop-nam11.prod.protection.outlook.com (2603:10b6:3:3:cafe::57) by DM5PR18CA0073.outlook.office365.com (2603:10b6:3:3::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.15 via Frontend Transport; Wed, 15 Dec 2021 00:15:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT048.mail.protection.outlook.com (10.13.173.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:15:56 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:15:56 -0600 From: Michael Roth To: CC: , Daniil Tatianin , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini Subject: [PATCH 41/47] chardev/wctable: don't free the instance in wctablet_chr_finalize Date: Tue, 14 Dec 2021 18:01:19 -0600 Message-ID: <20211215000125.378126-42-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 05e2921a-252f-4448-b2a1-08d9bf6010a2 X-MS-TrafficTypeDiagnostic: MN2PR12MB2877:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JwnhxOvC5AyJymTElKO8cx32o2oik8dKP8pcOCRucT7u0vTTSPpCci8kaDOkhVDt6Nwc1wQBzH+LyxdHF1TcEZpFGUy6eu0XYqDH7jsvI4MNuAa0J4IblV4AeMKdf1qcFhE9AP54MvdkFabUpcVUQz6H6Sk9waMwptbQPrE8SjzkA+tHnIdreGAKiEFw3Y+JSYvPsfoBYWUuXneymugy91+qO89CPyz6y+6klqQSaUFHh+849W5GlIdB81N7ATu1P0O/os7NrdRnWCio7K9KRgT3oq822uVRpy9lj5romA8b8kRikzXn9Mf8lPJcC8mcPNPB77DaqtLf0I0h9vZXBmfBh4F/Q8vOODZdvsUOwTL7VZ4Tt5agKfR053DC9oCEQNNikPv2JEv2bNscxrmRI31bmvJrnCvYJflGFgXFe8Y9HqxO9JyG8BiSm2B1/+lexidb7TcpRDfQG/nhYStxyGfIbiuQa97zl/xkB4CsyYObrJ/Hc4QRtnFgvUXmbRCnAY2GxhsdR6MTUZM0CZqJe61FPX2zcINfOp8aXIWH7VKhRLU+QUxwIk0lXB4FqCIvF2aSccPghYkN1HIhK/XwTkGGfC3pQJQiBtBrecc7xZ7A3mHn9yo5PjNkIIiG1I7vRVw5IxvoKdcnMTwzkh3tJYfJCEw0T40/tIyO6LAB4MUMnHABzGN9vv1cf7PdQkk2xtCQ4VLgr9xub4u/lP4ppNTibTxQblXxmsizSFx2qsSTqjOeJogqxKE6P3S8u7vgUUN1obgBVsVxTaI8bpo+1iASC48EpQTCwz4Rt9zeVSQ= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700001)(70206006)(54906003)(81166007)(356005)(336012)(1076003)(2906002)(36860700001)(6666004)(47076005)(44832011)(40460700001)(36756003)(316002)(82310400004)(26005)(70586007)(6916009)(426003)(8676002)(16526019)(4326008)(83380400001)(2616005)(508600001)(186003)(8936002)(86362001)(5660300002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:15:56.5651 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 05e2921a-252f-4448-b2a1-08d9bf6010a2 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT048.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB2877 Received-SPF: softfail client-ip=40.107.220.74; envelope-from=Michael.Roth@amd.com; helo=NAM11-CO1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Daniil Tatianin Object is supposed to be freed by invoking obj->free, and not obj->instance_finalize. This would lead to use-after-free followed by double free in object_unref/object_finalize. Signed-off-by: Daniil Tatianin Reviewed-by: Marc-André Lureau Message-Id: <20211117142349.836279-1-d-tatianin@yandex-team.ru> Signed-off-by: Paolo Bonzini (cherry picked from commit fdc6e168181d06391711171b7c409b34f2981ced) Signed-off-by: Michael Roth --- chardev/wctablet.c | 1 - 1 file changed, 1 deletion(-) diff --git a/chardev/wctablet.c b/chardev/wctablet.c index 95e005f5a5..e8b292c43c 100644 --- a/chardev/wctablet.c +++ b/chardev/wctablet.c @@ -320,7 +320,6 @@ static void wctablet_chr_finalize(Object *obj) TabletChardev *tablet = WCTABLET_CHARDEV(obj); qemu_input_handler_unregister(tablet->hs); - g_free(tablet); } static void wctablet_chr_open(Chardev *chr, From patchwork Wed Dec 15 00:01:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677031 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 44A2FC433F5 for ; Wed, 15 Dec 2021 00:35:40 +0000 (UTC) Received: from localhost ([::1]:53660 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxIGh-0007CX-4S for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:35:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHyG-0002O7-SA; Tue, 14 Dec 2021 19:16:37 -0500 Received: from mail-mw2nam12on2040.outbound.protection.outlook.com ([40.107.244.40]:63650 helo=NAM12-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHy2-0006CD-NH; Tue, 14 Dec 2021 19:16:36 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K8GCFljrz/SedVW3wiwDxGxVTqbHUsz6FbgIQRZMtD5MS0lPz998QUrGzY2bgFI9BhNLFwMXK0l2tCmedWFIOiS68miGc460AdXkJfA/r6iegod76jaYp14TM+CIDxmhsJyW0P7yffup8jgtS0h8A+yFgXsfBdWOyeDdGJilDe1FtpxT3d8mUS94TlRC16SHwGm72Ko0RMkdCcqL7neZFdHgcu3HBotA1SuQ6wSK/G17u1afr7/LrVyTLZovGZrEax0HcW/OZpKI9OSh3BRTGFrAmX5Jm+BK7NYknkcKnSz2kpFfeCYuYTcgNZMGZH7pRnp1zXDk6q3oRg7UXNTxRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DpwAJdo2vxOEqoBNuLEfjPFYSYDQn0GL4Rqx17GxZM8=; b=PMzkXcpGUpYYOVKm7Y21ON8Uxe8zc9+XDiEznnZIiE3hSHyoOgXZrSgV2mwB/lGFU7V0xzhkk1As2AZ0T1oWs0/fUvWONsmDVIOqI6vvckr8fDBlkBsv5pYQ2E39Q6oGSTgQfMkJFSsEWi2xvn64L+WcpUzGkMEDg2NVv8Kaml2X4S2YM0ujAM8Qwu+r6ko3cVJ0lfVNHKST5VUpXpQveUjGCP/1haIpRWJgYO5/LMJ84VaLx+nKaHwNHy+YR1KODtIJvB1QJYcvCtJCMcB1WorOz2AlEbXDIxhZwvb5lyIN8HjgIoi+FB8XaUAEGdIuTGhzWxoHN8M3K2KnOYQfzQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DpwAJdo2vxOEqoBNuLEfjPFYSYDQn0GL4Rqx17GxZM8=; b=cnzj9sxUQdZOuKtW3M87XOhZZ20aa5Oigs5ay5IoJbva+8vlvLCPnP+E4GvNBJw4Im15ehugu/wsktLb3rIpXPlL7VqgAZhet0wJWvGjipJisBbtbABZXsIHvaw6AEiKUVPae4uq07ElVu5G9gLxc5iBbzc6y/Jv3LXLkj5KHmo= Received: from BN9PR03CA0810.namprd03.prod.outlook.com (2603:10b6:408:13f::35) by BN6PR1201MB0049.namprd12.prod.outlook.com (2603:10b6:405:57::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.12; Wed, 15 Dec 2021 00:16:17 +0000 Received: from BN8NAM11FT029.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13f:cafe::7e) by BN9PR03CA0810.outlook.office365.com (2603:10b6:408:13f::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:16:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT029.mail.protection.outlook.com (10.13.177.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:16:17 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:16:16 -0600 From: Michael Roth To: CC: , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Hanna Reitz , John Snow Subject: [PATCH 42/47] hw/block/fdc: Extract blk_create_empty_drive() Date: Tue, 14 Dec 2021 18:01:20 -0600 Message-ID: <20211215000125.378126-43-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e83e11dd-a62b-4d86-5393-08d9bf601cef X-MS-TrafficTypeDiagnostic: BN6PR1201MB0049:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:277; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EsL7lyB7TJ6OtP+LE7lYy7p+PTv50jtJELBDztmOlb0LBKRkkZ2kOC95Us53gugCYgaEPeuLffrjUdLxCzTgHe3HkvL7J1mZl+f7lEx1Yc77s7N35Iciufevn3xIRkV1LGRLzLlfInXF6Gxtrk1B0DszId6XC4Py2+POe6/cBLmdFle5rc1xK2fq7M1mj97Qwori2R+LObjew9uI4rs3ubt3x7zqfYZRVNo7d3EJDPNhw/Rwn08sLt3/vykfqzaLeMuQkr34bieljWFAdtIXKgO8D4EshOwsR8B0qcpBhi3XITSnuF0bWw4yqguam4bDTXWIe+lwmM+TGnWBXuYPcFCibqyFX9aOC/nqT1QWkVQA8nCGYX1Xy6JLrwMIgv/4YaukUFH/xkxmWzwBB12DEDimItewwddvRYQhzs3vFvkuzlvnUhjuit7X94FIzcjonx9vYLGiMyNQNKmDmDRlCnkVX8jFaBnSpVLXpyvl8gPD/iFR0OssKUMsC3imtpHPW9C0m3IGHTqbz18ANnxKXNvQa9bvNopmUoVSqtq8IFWIsMTnuTAr0m59PRpxXQNINMnr2Hyg1JKoGukWuPGZ1+Qgz1LCfHyzvyuQGs5Cn3EOsX3DXbopZaC3YP/ubvgve/YZ3JpYXAP1EoRbrU2TRG6wLLh+eBil3NzwR1AU4ug8eNBDrpZi66twCURq52uvWUBJcfsG35+JupiuisTTOX2+ed+a70ao7CTiKQ7IC/XkHL18JjKy0wGsc4XBVvLAN/QVf/IaxOXPp3FbpTSc42L8aWPanA3w2mwqrEXXSgM= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(81166007)(36756003)(8676002)(70206006)(8936002)(36860700001)(508600001)(70586007)(1076003)(5660300002)(44832011)(426003)(86362001)(2906002)(26005)(186003)(82310400004)(356005)(336012)(2616005)(6916009)(316002)(16526019)(83380400001)(54906003)(40460700001)(4326008)(6666004)(47076005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:16:17.2379 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e83e11dd-a62b-4d86-5393-08d9bf601cef X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT029.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1201MB0049 Received-SPF: softfail client-ip=40.107.244.40; envelope-from=Michael.Roth@amd.com; helo=NAM12-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé We are going to re-use this code in the next commit, so extract it as a new blk_create_empty_drive() function. Inspired-by: Hanna Reitz Signed-off-by: Philippe Mathieu-Daudé Message-id: 20211124161536.631563-2-philmd@redhat.com Signed-off-by: John Snow (cherry picked from commit b154791e7b6d4ca5cdcd54443484d97360bd7ad2) Signed-off-by: Michael Roth --- hw/block/fdc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/block/fdc.c b/hw/block/fdc.c index 9014cd30b3..c3e09973ca 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -61,6 +61,12 @@ } while (0) +/* Anonymous BlockBackend for empty drive */ +static BlockBackend *blk_create_empty_drive(void) +{ + return blk_new(qemu_get_aio_context(), 0, BLK_PERM_ALL); +} + /********************************************************/ /* qdev floppy bus */ @@ -486,8 +492,7 @@ static void floppy_drive_realize(DeviceState *qdev, Error **errp) } if (!dev->conf.blk) { - /* Anonymous BlockBackend for an empty drive */ - dev->conf.blk = blk_new(qemu_get_aio_context(), 0, BLK_PERM_ALL); + dev->conf.blk = blk_create_empty_drive(); ret = blk_attach_dev(dev->conf.blk, qdev); assert(ret == 0); From patchwork Wed Dec 15 00:01:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677033 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C0965C433F5 for ; Wed, 15 Dec 2021 00:37:32 +0000 (UTC) Received: from localhost ([::1]:59426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxIIU-0002g2-PE for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:37:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHyS-0002fm-Hn; Tue, 14 Dec 2021 19:16:48 -0500 Received: from mail-dm3nam07on2071.outbound.protection.outlook.com ([40.107.95.71]:60449 helo=NAM02-DM3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHyP-0006Il-5M; Tue, 14 Dec 2021 19:16:48 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EU8mdaiu78yNDTa5/o0r4lMPGwkEo6TYmCHvB3XSKq8u5Hf+aatIg6Qfbf1Fn/judVn6KEPKR1NFcvv8hublbV3NnzBkX8Zn4apjF/vd7IIugjFe1xo1/BlEfRByfZRq8+REEOCuTgdizZdB83QkelFZK6l7gBg9MuoDNnHdQ+FkNb5Tg33D0Qrm9yzfl07LPlHM5HFR2eEHTbhM5rp3/RRwAxFVkNnK9p++ffEeHHyc5EJWT1fR5JnevIyvfOlbSST7VhJDyVniIeIS1HEKcwdlhf3R8804wSV9/4p7uZLmNT+BRiAhEQwkQnXsamwGFeoAkRyMCk5tN+AfSWt41Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mtvA+uV3GXSLKg4KZLljaWhwZf0XoThAmHZ0A1E5uC4=; b=b2DRF3W7R5gNBLwA9w4psholcZqBZSEU25Ghv/M+LGQyaWl18pfjWioz33KIG5lyeTKhVEqNTrBCqODjBwB7pWox096w8EMXlnpLeRHTJVF6RLp2Nt+HIELgXiZagCbOt3smkTuuapt7iHkdJbvVjLB9q1x+ZOS7INkuFTxOCs4Lf378ysghFF4tGujW3StDVNp6Vzyj+F3iFfyo/2aI21NXkiB88Ce8nW35IylmlMvrQ7ZEF3hMb1GPklboLQXr05errLoiRRYc5wS4ks1NO60/EpO+H6eEBgBy+KLT0u2CrdBq4wvTRs+7Pu6HVhz5ClrPomi9PGtx0GPArbGacQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mtvA+uV3GXSLKg4KZLljaWhwZf0XoThAmHZ0A1E5uC4=; b=5oBJ3GoAwDZF219OwlEwKVyQLViFKD8uDVwOgo4yM7J9fEhPnZg+YYzqa4ffzSAABLOYf0cuBsFbz6C+X4+fIc7C4uwAi54WoZCHYZgAymQnSIU4Aw8PFqKuEv22n7KCKfes9ARu9+v4g5D/NxH/6KcatmdVgQitw5IRCd9n7C4= Received: from BN6PR1201CA0005.namprd12.prod.outlook.com (2603:10b6:405:4c::15) by BL0PR12MB2515.namprd12.prod.outlook.com (2603:10b6:207:40::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.15; Wed, 15 Dec 2021 00:16:38 +0000 Received: from BN8NAM11FT053.eop-nam11.prod.protection.outlook.com (2603:10b6:405:4c:cafe::52) by BN6PR1201CA0005.outlook.office365.com (2603:10b6:405:4c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:16:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT053.mail.protection.outlook.com (10.13.177.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:16:38 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:16:37 -0600 From: Michael Roth To: CC: , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Gaoning Pan , Darren Kenny , Hanna Reitz , John Snow Subject: [PATCH 43/47] hw/block/fdc: Kludge missing floppy drive to fix CVE-2021-20196 Date: Tue, 14 Dec 2021 18:01:21 -0600 Message-ID: <20211215000125.378126-44-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d4f264de-e1d7-4d5f-a384-08d9bf60295a X-MS-TrafficTypeDiagnostic: BL0PR12MB2515:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:356; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: re+94pMDh0CeINvACaAySUxXNLECakqgL7JTujKyxTEiafPH01ZoSEhGHaaiSWprl9n7BfxYFwClUjtiGz3rjAMpTCPfr8H+ZTMj8qOlIF7BggqGkVQ7Y82RjSbuB07P92m8LfSQ62saaQuhWnT75/H7loogm+cwq4t6p5BEqRG2znjdOnF7JJxTAd+q3ZfrpCjYmhFDWx/br5PlnTXmhlS4GapN1irndBaAPoumF5jc5e3PaTfRi7Cyom3o7JpUEBaNU+ABJ+Qx8cc7i0v/61GWyWFujTccK3o+IDFUl95vIEnCQeI20F2gOxpF1A3NuNnwZ95j2XEITZ/Ujkl0sW9BQteREsq4w047xhHBLC8c7Th3OajXpyVP9CCNhDfnkN6pV+W9KutnsZMc/MCKfKD/4YzDdRuAl+LjF3ka1+vLivE5dJwnaohs2eJ8112tPTBH+649vQHWAOwnRWq34bMfcKV6tbeIZJwrYIDGBfw6WR5e9XFe7ulG4KkkWg+ZCc0zAW7QZTCR80Aj5UmQChwLWV99vnUB394LPazcKzPF80EFWatJoMCm1Q7zarYrVMdu015faILKkU8gr/UzYoHs3oaCBumk7MIaF2ZaVjzJgG6cFPUieiYgTuUNwOU/gXZ9WD0TL157inZweHOC8O1O2C5nHMY6wAvJsiUELfcvF73e85UqX7MtrKLBndfFRGhBIkcyDj/JSCYHIcQPqSQ1O5ejr6P6fMbbAsk5UTcCN/sZl4JhkgL1qf15yRQeWPEC09PRYL5JeRQoiHw+2t3hKxSgggT+WcmNe10zbJPRnTcTdi4mpqx7HLdWL/L/6w2rJxeeEwTENWFw5Vf+5i2Tths34iK8AnJXcMvvX77ZPmzCwpaYF4Sq4WZWhV/WBlOTn/BK2PMfP3UnzNWqYA6wPWbwcepxLjyizqxDJFU= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(36756003)(2906002)(4326008)(81166007)(82310400004)(8676002)(356005)(6916009)(36860700001)(8936002)(316002)(40460700001)(44832011)(5660300002)(70586007)(16526019)(26005)(86362001)(6666004)(508600001)(54906003)(426003)(336012)(47076005)(70206006)(966005)(83380400001)(2616005)(186003)(1076003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:16:38.0894 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d4f264de-e1d7-4d5f-a384-08d9bf60295a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT053.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB2515 Received-SPF: softfail client-ip=40.107.95.71; envelope-from=Michael.Roth@amd.com; helo=NAM02-DM3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Guest might select another drive on the bus by setting the DRIVE_SEL bit of the DIGITAL OUTPUT REGISTER (DOR). The current controller model doesn't expect a BlockBackend to be NULL. A simple way to fix CVE-2021-20196 is to create an empty BlockBackend when it is missing. All further accesses will be safely handled, and the controller state machines keep behaving correctly. Cc: qemu-stable@nongnu.org Fixes: CVE-2021-20196 Reported-by: Gaoning Pan (Ant Security Light-Year Lab) Reviewed-by: Darren Kenny Reviewed-by: Hanna Reitz Signed-off-by: Philippe Mathieu-Daudé Message-id: 20211124161536.631563-3-philmd@redhat.com BugLink: https://bugs.launchpad.net/qemu/+bug/1912780 Resolves: https://gitlab.com/qemu-project/qemu/-/issues/338 Reviewed-by: Darren Kenny Reviewed-by: Hanna Reitz Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: John Snow (cherry picked from commit 1ab95af033a419e7a64e2d58e67dd96b20af5233) Signed-off-by: Michael Roth --- hw/block/fdc.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/hw/block/fdc.c b/hw/block/fdc.c index c3e09973ca..af398c1116 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -1166,7 +1166,19 @@ static FDrive *get_drv(FDCtrl *fdctrl, int unit) static FDrive *get_cur_drv(FDCtrl *fdctrl) { - return get_drv(fdctrl, fdctrl->cur_drv); + FDrive *cur_drv = get_drv(fdctrl, fdctrl->cur_drv); + + if (!cur_drv->blk) { + /* + * Kludge: empty drive line selected. Create an anonymous + * BlockBackend to avoid NULL deref with various BlockBackend + * API calls within this model (CVE-2021-20196). + * Due to the controller QOM model limitations, we don't + * attach the created to the controller device. + */ + cur_drv->blk = blk_create_empty_drive(); + } + return cur_drv; } /* Status A register : 0x00 (read-only) */ From patchwork Wed Dec 15 00:01:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677039 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 649FFC433F5 for ; Wed, 15 Dec 2021 00:41:40 +0000 (UTC) Received: from localhost ([::1]:35244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxIMV-0005Y1-88 for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:41:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53762) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHym-0003ji-2V; Tue, 14 Dec 2021 19:17:10 -0500 Received: from mail-bn1nam07on2047.outbound.protection.outlook.com ([40.107.212.47]:55782 helo=NAM02-BN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHyi-0006Lk-JE; Tue, 14 Dec 2021 19:17:07 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O1VFn24WkN5KYPZMB112Ilgzpf4f/aKiC5rAS+2HWr0rTclCET5Dl4mBL6c0cn1npEPCnjNIh84qVqZXKm/xIt+z6eyvD+3MmPBwamH5seCzpoHCGhBJO0SY86cQjOLEgemYkJYvxMt2KzCa2WEFFUq0LaVku7xpEhBxySLbMqAQY4rU9nclvtmGMtPnEQC+vqUaf8tAIE/SsqIb/syl2DjAXrXWROtZjQAkMAmZ+9O6SSa/O7hrtW3fxoiRcHe5W7RnvhNCfU0Lm89w33IlpBNeFBBJhshIplX5xXmeK/OqRp2td9Z1HVpn1rprYYRZQorK0H6hHGKPCUCWu+J2XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1VeDxXEwpH5Csi8NGSGEuKTInv+T7BdeiF4bF6Z+4qk=; b=RVD9XrDERPNp8ZPhJ14sljVsTcSbKrJVOVrqCRbUVwXE+DqizAj4hoRQ1wSW58FAGQ0MO8hfUZPQwmp8umRktmkfbpQNq7aP7Qj79d8wicgJeElzb4qxq4FBTbdltyYAY7ic6A8DssaBrywTQHEjxHKBlALvjYfAYFnFdQDr4lgWvjUC1ZnmpIAKPI84OTIULhY5iPUSTSSq+T/t8kFgsj3UgQFsKZAUhPrW4UY+6qSe3YkT4mxw7g1OhtyiUmYZx2pp81TB0/UdtAltti/JAnruPHgPPMBihtYyhDnl7i+uY6YgtsfVGCaKNefYLQsRKCs+aAmRD26KYekzt1iOPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1VeDxXEwpH5Csi8NGSGEuKTInv+T7BdeiF4bF6Z+4qk=; b=Hs1xE0XFTmIv77FX8OolqB7e/dag9ejE/0z4RctRnNQg5HyOTqyN53tVU4vsRocAs7ljN69Z/D50iKvUfAZs5JnHrm8u7+GRxO0kDP8vYaVdMe6Zn5IN3eOuTVsZRL0/xfpsXxVdVDg88glD05MXbfhZc2x4iWKD+/m/0/Feqkc= Received: from BN6PR16CA0018.namprd16.prod.outlook.com (2603:10b6:404:f5::28) by MW3PR12MB4361.namprd12.prod.outlook.com (2603:10b6:303:5a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 00:16:59 +0000 Received: from BN8NAM11FT036.eop-nam11.prod.protection.outlook.com (2603:10b6:404:f5:cafe::fa) by BN6PR16CA0018.outlook.office365.com (2603:10b6:404:f5::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14 via Frontend Transport; Wed, 15 Dec 2021 00:16:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT036.mail.protection.outlook.com (10.13.177.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:16:58 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:16:58 -0600 From: Michael Roth To: CC: , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alexander Bulekov , Darren Kenny , John Snow Subject: [PATCH 44/47] tests/qtest/fdc-test: Add a regression test for CVE-2021-20196 Date: Tue, 14 Dec 2021 18:01:22 -0600 Message-ID: <20211215000125.378126-45-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bc5b569f-d1ec-4898-6432-08d9bf6035ca X-MS-TrafficTypeDiagnostic: MW3PR12MB4361:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:125; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: h46L0Qft6ziD5Uycf1+q+quTZw5d2GCIEhTT6fm6E0yHBA7O1a6WG6Fp7E/TP4SwJV/XYeOLLJSvH/1S26w/W4PZmgk3n1cAoNRdeqsoiasx91SzNescQELz76JX48+LESIEWPbP4ujlqMzU4a1tAcILzJc8wM3nPsQ3mAGh/Jt8gHgH0vSrPRXrcQ7ZFG22fPF4hvaaDj6eS/AiaIbSmFaHz3IfaDSOtdbFo/0JpZzTTd/eGdB2/KG8xCCmKIBc8vpBVv0ZVhYtgkjRueSfJpRATkEFJCWHg4HOLFi+FfKYU2h0lrOaWHRKv9ErIyFulbygiMok4ODBr+0Hk+Q984Z6Mb7xtKPfAoUewe99r/tCtVA9FjXzZPg+5ynAGQfBdxURUjk4sbHkhOeOwFWiKPh0kC7m5a43b/nYfNQsu/HtnVeDCYcFd85aTVtd6JSEstHZKr+EPd3bGpzAU6CPynWfx2DId0YkBd13jEayI1iLOx4xnT7O/fRzRnOL7Zmk6lJoK4K3ZUZydyH9FYb8OVUi6yxpOleBcZ+svePhw9AyPIH4g0p9sQEn7livV+0do5Gaa3f/9PX6pjrt5JzqG89F5mxHEnciZAuxGq+rEfnPw6Su3Dax+0LH7NE4jC4yVzv0NSSBtpCjN3GajvTbl2sjVleRtU5JsvgF4Xha+v0tQMWdJiimaOdRZMibiN9t5PtmUqi3K/DUM8GYINDJWukd7hWkRgBkrxtqfp4fJ8bmKbJp/RFzrcxbrbZ1QhJ7xkJWN1s143JLxqgF+XYaX+iqBrm0G6znUHeiGvvfio0= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(16526019)(40460700001)(1076003)(6916009)(81166007)(44832011)(47076005)(186003)(336012)(316002)(508600001)(426003)(83380400001)(4326008)(26005)(356005)(54906003)(8936002)(8676002)(2906002)(82310400004)(70206006)(36756003)(86362001)(6666004)(70586007)(2616005)(36860700001)(5660300002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:16:58.9389 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bc5b569f-d1ec-4898-6432-08d9bf6035ca X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT036.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4361 Received-SPF: softfail client-ip=40.107.212.47; envelope-from=Michael.Roth@amd.com; helo=NAM02-BN1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Without the previous commit, when running 'make check-qtest-i386' with QEMU configured with '--enable-sanitizers' we get: AddressSanitizer:DEADLYSIGNAL ================================================================= ==287878==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000344 ==287878==The signal is caused by a WRITE memory access. ==287878==Hint: address points to the zero page. #0 0x564b2e5bac27 in blk_inc_in_flight block/block-backend.c:1346:5 #1 0x564b2e5bb228 in blk_pwritev_part block/block-backend.c:1317:5 #2 0x564b2e5bcd57 in blk_pwrite block/block-backend.c:1498:11 #3 0x564b2ca1cdd3 in fdctrl_write_data hw/block/fdc.c:2221:17 #4 0x564b2ca1b2f7 in fdctrl_write hw/block/fdc.c:829:9 #5 0x564b2dc49503 in portio_write softmmu/ioport.c:201:9 Add the reproducer for CVE-2021-20196. Suggested-by: Alexander Bulekov Reviewed-by: Darren Kenny Signed-off-by: Philippe Mathieu-Daudé Message-id: 20211124161536.631563-4-philmd@redhat.com Signed-off-by: John Snow (cherry picked from commit cc20926e9b8077bff6813efc8dcdeae90d1a3b10) Signed-off-by: Michael Roth --- tests/qtest/fdc-test.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/qtest/fdc-test.c b/tests/qtest/fdc-test.c index 26b69f7c5c..8f6eee84a4 100644 --- a/tests/qtest/fdc-test.c +++ b/tests/qtest/fdc-test.c @@ -32,6 +32,9 @@ /* TODO actually test the results and get rid of this */ #define qmp_discard_response(...) qobject_unref(qmp(__VA_ARGS__)) +#define DRIVE_FLOPPY_BLANK \ + "-drive if=floppy,file=null-co://,file.read-zeroes=on,format=raw,size=1440k" + #define TEST_IMAGE_SIZE 1440 * 1024 #define FLOPPY_BASE 0x3f0 @@ -546,6 +549,40 @@ static void fuzz_registers(void) } } +static bool qtest_check_clang_sanitizer(void) +{ +#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer) + return true; +#else + g_test_skip("QEMU not configured using --enable-sanitizers"); + return false; +#endif +} +static void test_cve_2021_20196(void) +{ + QTestState *s; + + if (!qtest_check_clang_sanitizer()) { + return; + } + + s = qtest_initf("-nographic -m 32M -nodefaults " DRIVE_FLOPPY_BLANK); + + qtest_outw(s, 0x3f4, 0x0500); + qtest_outb(s, 0x3f5, 0x00); + qtest_outb(s, 0x3f5, 0x00); + qtest_outw(s, 0x3f4, 0x0000); + qtest_outb(s, 0x3f5, 0x00); + qtest_outw(s, 0x3f1, 0x0400); + qtest_outw(s, 0x3f4, 0x0000); + qtest_outw(s, 0x3f4, 0x0000); + qtest_outb(s, 0x3f5, 0x00); + qtest_outb(s, 0x3f5, 0x01); + qtest_outw(s, 0x3f1, 0x0500); + qtest_outb(s, 0x3f5, 0x00); + qtest_quit(s); +} + int main(int argc, char **argv) { int fd; @@ -576,6 +613,7 @@ int main(int argc, char **argv) qtest_add_func("/fdc/read_no_dma_18", test_read_no_dma_18); qtest_add_func("/fdc/read_no_dma_19", test_read_no_dma_19); qtest_add_func("/fdc/fuzz-registers", fuzz_registers); + qtest_add_func("/fdc/fuzz/cve_2021_20196", test_cve_2021_20196); ret = g_test_run(); From patchwork Wed Dec 15 00:01:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677057 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 08B1FC433EF for ; Wed, 15 Dec 2021 00:46:25 +0000 (UTC) Received: from localhost ([::1]:39818 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxIR5-0000KI-Nm for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:46:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHz3-00041r-KA; Tue, 14 Dec 2021 19:17:25 -0500 Received: from mail-dm6nam11on2088.outbound.protection.outlook.com ([40.107.223.88]:7200 helo=NAM11-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHz1-0006Mn-2g; Tue, 14 Dec 2021 19:17:25 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QDMJgsq0r0JGx2tk2z/eCRPCuaKC+kH1I44BLGwwyZkY4ibNLE7Yc/TQxHtzwLLz72bGkRykUZOd7h7UM94r455k//kDQeco3FR1BkgQv95vpVFJMbmJJCdrE7hrUeh6wClvnTlvQAcsv8KEaYGFAuBERGbjFxt7ly2SUEdDVLDyFZdVtbT+s7cnrInTmEGVv2BIilP6j4WRHTjMZJXIJU2ujTRifiu6fG4bEEFQVK7s1jp/jwV6YhvkAj3RH/UAxzr5cVNFQXk2ygcJ28a2a3sbi5dhABSiWGlS0bnC3a4kGn7diUm3z/kkyAKV+3a2jfeQ/V+M7wj+aZgpOlPeSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=s+67iRhqQDcEsbyb6W2vQy+Zy9nh1gVs5WkgPxLFzWU=; b=arQEN/6HNkmJ4iQ74mq+bxUpzoG3LLoEMSatJ+BQwLBEIb9m/4NRgpbGgOy7AoQz+lTGYUJLhLlpXSqAoBrefO6VRdoM3Cv4N4U30pq3DnlIHdv+JlvVY8qEd2eYTLNcrVXnPsZvoTJKfDcwRoJ+UB4s1JknIvxx0otm4yK8nyFAuEMBv6qKTBtDj9h9lFaz27x71urNmWo+aSRqKz149bqG4dsJOgFQieki/+YygaHDeBOCOOulHZypAipn9VfPY0L3eFechc4HXiAdBLY9NxvcDCA9oxsYO/sCAiUw3Fm2Xv+NWfUIZEew9uP4OSZY/XKJSb4lLgUyHy78iyTYYA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=s+67iRhqQDcEsbyb6W2vQy+Zy9nh1gVs5WkgPxLFzWU=; b=xWBsdlzqTEn/tvuww1UzoTqY2MCV1lKcCwLHlSna5Nt+Qq7dO0TbJ9F7G+NvHB3XmG8B2ax1Y802ZTtnhj1CeYVN1hCC62YlNXoWeEdIl9SVWmG7Ag99b8A2fRhjtOTs9wTjkMtim+a+125RktsBhh+cXCiNrhtydFzALCcFuTI= Received: from BN6PR19CA0107.namprd19.prod.outlook.com (2603:10b6:404:a0::21) by BN8PR12MB2994.namprd12.prod.outlook.com (2603:10b6:408:42::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 00:17:20 +0000 Received: from BN8NAM11FT006.eop-nam11.prod.protection.outlook.com (2603:10b6:404:a0:cafe::66) by BN6PR19CA0107.outlook.office365.com (2603:10b6:404:a0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16 via Frontend Transport; Wed, 15 Dec 2021 00:17:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT006.mail.protection.outlook.com (10.13.177.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:17:20 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:17:19 -0600 From: Michael Roth To: CC: , Mark Mielke , Stefan Hajnoczi Subject: [PATCH 45/47] virtio-blk: Fix clean up of host notifiers for single MR transaction. Date: Tue, 14 Dec 2021 18:01:23 -0600 Message-ID: <20211215000125.378126-46-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ca042a0f-4a34-4d13-b7a4-08d9bf604293 X-MS-TrafficTypeDiagnostic: BN8PR12MB2994:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:110; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r7JnZaYDm/ePwHtqhR6AC2wRP0mLQBSIDmC7uPed1gcV5WaiMTp4D8/XLjxBba2jomrPZNRVl4AA00uwTgGIfOIW6Z3RCeaBJqwKbxdxoyyY1otCPrR6v6nvpt6z6J3wRoo6DOWbSX8tZPfpfDv1Nqe3qmTNMROk0JVybKWfB6pHQ4HOLtUAvSCLt7E2u8QdAZk1cxcXydlo8J0IQKwMj7X37zBDUNJo1aedXhsQ8nF7NOJ5UwT6PTT/HrNDq40tUaen+r3kVyqzESrIZd8yVldNRQw/LlxI56LfRvzCTb/V9Bd+JdyDpMcPPOKBkDdRfLJ7GIZD6ksrdizNkjRlzUylRZPx85BcsncHrcViWwGtGICl7w5GPp2KtNRKeLZtsCDB1bp8zmdmXP5JKCKfmPQjfEkX0iGkbeFKrsZ7p4Yv7j4OioFhkA10CbaKoPd1Tu2dNHcZ9F/JgverworsGdXu5TWE6xARKEpy08h0YZSh1vUuGuBPlRjWfBlMNDigzxhDPJaJqJhwSoKUerq0tE7MesOjO9l/M6OBO7INnt8k02HAtrJJmOjKy0D9jynhxuJ3DuHZidn/82l+vJCYF6FBl2X02SQ2V7tYZrRsMd8gQN7DUbVPgXkVMffqkjhkDelfOWFbOUW7egE3P8nMIATUyIjppjdFM/DO9JTvEnTkrn6jYPx/4hBnIMrimSQWnudZJUPwyAT+yY0P3fDD8kYdpC/qqgcnzJfOpe2YwD8908L29cayuEPOx5UUSwUa4dIn6Mbpd58b4sm8xstdKHOxPVzB78YHNrM+K9Eefds= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700001)(336012)(44832011)(6916009)(40460700001)(5660300002)(8936002)(6666004)(36860700001)(47076005)(70586007)(2616005)(82310400004)(86362001)(70206006)(83380400001)(4326008)(1076003)(16526019)(36756003)(186003)(81166007)(2906002)(26005)(426003)(508600001)(316002)(356005)(8676002)(54906003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:17:20.3909 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ca042a0f-4a34-4d13-b7a4-08d9bf604293 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT006.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB2994 Received-SPF: softfail client-ip=40.107.223.88; envelope-from=Michael.Roth@amd.com; helo=NAM11-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Mark Mielke The code that introduced "virtio-blk: Configure all host notifiers in a single MR transaction" introduced a second loop variable to perform cleanup in second loop, but mistakenly still refers to the first loop variable within the second loop body. Fixes: d0267da61489 ("virtio-blk: Configure all host notifiers in a single MR transaction") Signed-off-by: Mark Mielke Message-id: CALm7yL08qarOu0dnQkTN+pa=BSRC92g31YpQQNDeAiT4yLZWQQ@mail.gmail.com Signed-off-by: Stefan Hajnoczi (cherry picked from commit 5b807181c27a940a3a7ad1f221a2e76a132cbdc0) Signed-off-by: Michael Roth --- hw/block/dataplane/virtio-blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index 252c3a7a23..ee5a5352dc 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -222,7 +222,7 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev) memory_region_transaction_commit(); while (j--) { - virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i); + virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), j); } goto fail_host_notifiers; } From patchwork Wed Dec 15 00:01:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677061 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4C98DC433F5 for ; Wed, 15 Dec 2021 00:50:32 +0000 (UTC) Received: from localhost ([::1]:43992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxIV4-0003LI-VY for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:50:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53842) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHzQ-0004bA-52; Tue, 14 Dec 2021 19:17:48 -0500 Received: from mail-mw2nam12on2081.outbound.protection.outlook.com ([40.107.244.81]:1664 helo=NAM12-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHzM-0006PF-PQ; Tue, 14 Dec 2021 19:17:47 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b6woojJ1agVhPgMueX5mCOXBulImuTblSinlPbS6FHQo7e6DtzxqoYuKJ8zrbkH5dCtZcmVl4j2Uk37yB8CZ+TkHfLgntXbUnXb9Oqn7DU2FyFAXOwP8WvlhfqY1Zk/XQARClOZmcbylCVL4Lj1CNGNMfprMPsmjasqmavqrtMFcqfRs++r8zspG7kcRc60eZN6nGr0F/8g1SzXBvLb6u29USQLlTxgE1wtG4Uzdi6WfUDL8bRWI7RmtvPWQRfDkV1DnKc2eKy5J509hAL310f4Y211r/vpr5/LbtXV+I/kQ6qxvkTJ+kMBIQyyW377iwcHnfwqBbrRZXl3Tvbk1bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6TpXAUynaovkP+NJSm7ozVjStq7YZWLkqwCPppTC45Q=; b=Bn6gNXsWmlvofIDFutdji/LWHAUVtcg/Qr9FtYL/sFSNRWvbnHB9UjrQ9t5UvFQLIzyh9ZZBUNVmRYLFmX0OrSpDBd9VfMJCr01x/rpMVixxiz0z3FEDqF5PLaEVUJ/wTDdfZM7VS8mfiP3Uqu6NSDKlODrqoM4M6Q9t7b7v/2eGB3HKbGwUzCZvfHyXybDn3pbN+e1Vrt+dHY944ofw+CgikmCXLLFEOaz5xtT1OPWg7PbnTcLCr2Hx+gRzzXUX8I/ikBGozhXJ2FZu/eXSIK3q1yD2MrR78N6iu4Jhge2MzBIdSCiFuMpM/2RU4m8ieuvNnT0sy44udkcfyJK3Sg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6TpXAUynaovkP+NJSm7ozVjStq7YZWLkqwCPppTC45Q=; b=obAV8VJ2dNfVS42gGH9ZkbgyERWATjA88WGuQ87Zs4KKQ6aaViA8z3iRaOhD26KiIGEwxG+TAbuds/BWfEzjcKApfJhiLuL531eE1RA1M2uhkzwPShsa24c2vc4++oF+2gj9HEndbI5R54GINpoanTa988DOVcSfwQ0sEUZgwUk= Received: from BN9PR03CA0600.namprd03.prod.outlook.com (2603:10b6:408:10d::35) by DM5PR1201MB2523.namprd12.prod.outlook.com (2603:10b6:3:e8::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 00:17:41 +0000 Received: from BN8NAM11FT014.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10d:cafe::ec) by BN9PR03CA0600.outlook.office365.com (2603:10b6:408:10d::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.12 via Frontend Transport; Wed, 15 Dec 2021 00:17:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT014.mail.protection.outlook.com (10.13.177.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:17:40 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:17:40 -0600 From: Michael Roth To: CC: , Prasad J Pandit , Gaoning Pan , Jason Wang Subject: [PATCH 46/47] net: vmxnet3: validate configuration values during activate (CVE-2021-20203) Date: Tue, 14 Dec 2021 18:01:24 -0600 Message-ID: <20211215000125.378126-47-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 095e0d21-36aa-426a-ba26-08d9bf604ea3 X-MS-TrafficTypeDiagnostic: DM5PR1201MB2523:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:16; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zPILc7xuTcRFkFjcjyCqMsmhplywS4tlXrx8NXZHWArvRBNWLC8gAPI6hJJ6iFISBnQo+MCWYyo+/knOeQNQLGGJSY7GmWrtHS42PNSB8b6ZG4/qb3YiYL85GyfbThJ/2T7o4h8OoQqUa44LwB6gxOUwInwGK5XHhs472fxn/khVvwUmj7hp2CvrOBU94tGJgj5Mi47PRub+B2u4zLX+v7qUiueE5rAwjcvJ1r7+1+Ln6U5ZCmPdpQSYOqIukKDUqJpSCzazFwfD20FNb4OK/ZfeG/W8Uvy2b0M63J3FdAS7gfOfYsAIssuegISL7DnFpPlGed0X7Y5gZRvOTUUcjJiJkH7mRbl+HYWG9rQSzho1YNQVqBOGuXkEt1tJ0iZq+Mf+wkaVdRwv/lCE+ChB5HWZsqajvlHHwsURv895q9dO3JkQ+vSpCPKdgnwMYn95rmYdUFVC76KP75J1MvIDFbukWoK1VJFOyVHLAXf9ZzBu0kI+azdsuhq1tCewXnT5YEnibewWBx3PpTgsNgE7mUWwyj4jTuq7bNoPfsY4M3rEubHCiFZ6VY00hl5ct30WmsivAjdr/RFg00WuHtLZOUN0eNVDoyHEEZqvA//y+ho3llv0H4FxAIXYNvwDEJlnI9AoE76pz4svIrLnaH9LHR7Z+lyyEa9GaFuRVFr5FmT+YKW6blD1f0QoYvo3H635hjLkqjeTQ0urgcgYRLE6uYEqLplkNBV1LgMzwIE4kXWS/Ge0LNrhXUCN11ZzCvBFSDRxQAu+eOQM5aTem/MgbpXrVyC+TVbSxyEDbn6rm+dxfJkKJAp6rI1PWD3Bwl9Tl91zKkEXd0bOPngBn8FKAYxjwlJFif4bPgOPHlLP7RLx2CK2kuj/Sjjh9gjN3sge X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(6916009)(16526019)(36756003)(4326008)(86362001)(70206006)(2616005)(508600001)(186003)(70586007)(40460700001)(54906003)(1076003)(47076005)(316002)(5660300002)(8936002)(82310400004)(26005)(81166007)(44832011)(6666004)(356005)(336012)(36860700001)(2906002)(966005)(8676002)(83380400001)(426003)(15650500001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:17:40.6325 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 095e0d21-36aa-426a-ba26-08d9bf604ea3 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT014.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB2523 Received-SPF: softfail client-ip=40.107.244.81; envelope-from=Michael.Roth@amd.com; helo=NAM12-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Prasad J Pandit While activating device in vmxnet3_acticate_device(), it does not validate guest supplied configuration values against predefined minimum - maximum limits. This may lead to integer overflow or OOB access issues. Add checks to avoid it. Fixes: CVE-2021-20203 Buglink: https://bugs.launchpad.net/qemu/+bug/1913873 Reported-by: Gaoning Pan Signed-off-by: Prasad J Pandit Signed-off-by: Jason Wang (cherry picked from commit d05dcd94aee88728facafb993c7280547eb4d645) Signed-off-by: Michael Roth --- hw/net/vmxnet3.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index 41f796a247..f65af4e9ef 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -1441,6 +1441,7 @@ static void vmxnet3_activate_device(VMXNET3State *s) vmxnet3_setup_rx_filtering(s); /* Cache fields from shared memory */ s->mtu = VMXNET3_READ_DRV_SHARED32(d, s->drv_shmem, devRead.misc.mtu); + assert(VMXNET3_MIN_MTU <= s->mtu && s->mtu < VMXNET3_MAX_MTU); VMW_CFPRN("MTU is %u", s->mtu); s->max_rx_frags = @@ -1486,6 +1487,9 @@ static void vmxnet3_activate_device(VMXNET3State *s) /* Read rings memory locations for TX queues */ pa = VMXNET3_READ_TX_QUEUE_DESCR64(d, qdescr_pa, conf.txRingBasePA); size = VMXNET3_READ_TX_QUEUE_DESCR32(d, qdescr_pa, conf.txRingSize); + if (size > VMXNET3_TX_RING_MAX_SIZE) { + size = VMXNET3_TX_RING_MAX_SIZE; + } vmxnet3_ring_init(d, &s->txq_descr[i].tx_ring, pa, size, sizeof(struct Vmxnet3_TxDesc), false); @@ -1496,6 +1500,9 @@ static void vmxnet3_activate_device(VMXNET3State *s) /* TXC ring */ pa = VMXNET3_READ_TX_QUEUE_DESCR64(d, qdescr_pa, conf.compRingBasePA); size = VMXNET3_READ_TX_QUEUE_DESCR32(d, qdescr_pa, conf.compRingSize); + if (size > VMXNET3_TC_RING_MAX_SIZE) { + size = VMXNET3_TC_RING_MAX_SIZE; + } vmxnet3_ring_init(d, &s->txq_descr[i].comp_ring, pa, size, sizeof(struct Vmxnet3_TxCompDesc), true); VMXNET3_RING_DUMP(VMW_CFPRN, "TXC", i, &s->txq_descr[i].comp_ring); @@ -1537,6 +1544,9 @@ static void vmxnet3_activate_device(VMXNET3State *s) /* RX rings */ pa = VMXNET3_READ_RX_QUEUE_DESCR64(d, qd_pa, conf.rxRingBasePA[j]); size = VMXNET3_READ_RX_QUEUE_DESCR32(d, qd_pa, conf.rxRingSize[j]); + if (size > VMXNET3_RX_RING_MAX_SIZE) { + size = VMXNET3_RX_RING_MAX_SIZE; + } vmxnet3_ring_init(d, &s->rxq_descr[i].rx_ring[j], pa, size, sizeof(struct Vmxnet3_RxDesc), false); VMW_CFPRN("RX queue %d:%d: Base: %" PRIx64 ", Size: %d", @@ -1546,6 +1556,9 @@ static void vmxnet3_activate_device(VMXNET3State *s) /* RXC ring */ pa = VMXNET3_READ_RX_QUEUE_DESCR64(d, qd_pa, conf.compRingBasePA); size = VMXNET3_READ_RX_QUEUE_DESCR32(d, qd_pa, conf.compRingSize); + if (size > VMXNET3_RC_RING_MAX_SIZE) { + size = VMXNET3_RC_RING_MAX_SIZE; + } vmxnet3_ring_init(d, &s->rxq_descr[i].comp_ring, pa, size, sizeof(struct Vmxnet3_RxCompDesc), true); VMW_CFPRN("RXC queue %d: Base: %" PRIx64 ", Size: %d", i, pa, size); From patchwork Wed Dec 15 00:01:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12677105 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8BE79C433EF for ; Wed, 15 Dec 2021 00:58:54 +0000 (UTC) Received: from localhost ([::1]:39404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxIdB-0002hX-J9 for qemu-devel@archiver.kernel.org; Tue, 14 Dec 2021 19:58:53 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53968) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHzx-0006Ix-ON; Tue, 14 Dec 2021 19:18:21 -0500 Received: from mail-dm6nam10on2083.outbound.protection.outlook.com ([40.107.93.83]:9920 helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxHzv-0006VW-Kr; Tue, 14 Dec 2021 19:18:21 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ohc4uEspkM2YumEa6nvZHafyIHQD6aRabU881gAkcMKb60GawXdsmHZlegZ2w6mMfUMIjfYGHL6MBJfijk2jN2TEGGS+uIUqOSEfvza+bWb6xsxyp8PPkul5/hfKGz9/SwNZpgoaz6hzt8CqvPEUvsQiHSGARh3chQO7Rkzf62Gj0fK/j4u5HeFbA8rf3brfVcObC6/WcXdoUtfJyh+0RRR8p8IGbzRIjjKPaYHXUAsRBjkKojXn5t1ug28Kcx17zMBa3ar2GrY292scr8v1bVfCx7YQ+n9AXj8EnCxH2SdxM3CW+Resu07xyc1wKITFWPsSQsNn7rE3hCpHNI0Gig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2THFWeCphuhca0DVKHmnf1l00C5TfItgv6l7x7WYNXg=; b=cZzLjXFx1wTjaghn1RXLXY6FOAQi01mQwIcJcNDOEBfKqixPUORqslEbqDGC8MorNCnjGTclDEK2ACiiwfdTAjqVYkm2BkCMbepwtaA8SEbyC1mFYgoRzB9dyEVlC9jHhbnJ31Oks83/NiXA25dzdy6nKXkFLHkQ2qT0ARRNRGiCQDNr/izerrie9WV4Z3bNmVG2FgwH2Mpzak3/DSCTdjCb/PqrYwv0lXi3BKeqG+6SC2Z/Q+SZEmB4isM9p/obLRW9FNv0ziHo625eb5Tf6W+Uj1zZkC5XV9buCMEvfsGDlsDpstPk1Cu2T3OB95ZZnVSr8ZO9MG1Y5IuKQTrDXQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2THFWeCphuhca0DVKHmnf1l00C5TfItgv6l7x7WYNXg=; b=RqFF99X9t2s5eDyQQBD23SFBvTEYLOAtFb0KVyypMeK1y7ynFs7eKRWevnV5ziEdT7La0vovyomhB/qQWgXsyh/MgIFDRvt3yYzQsywRKbgSvdxU5jZ+jKT5ysACnOFFQhZqZDTfi1NvhHITEpztofbwivPgr5WqdLA91XHoiFE= Received: from BN6PR16CA0033.namprd16.prod.outlook.com (2603:10b6:405:14::19) by BY5PR12MB4950.namprd12.prod.outlook.com (2603:10b6:a03:1d9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16; Wed, 15 Dec 2021 00:18:15 +0000 Received: from BN8NAM11FT037.eop-nam11.prod.protection.outlook.com (2603:10b6:405:14:cafe::fe) by BN6PR16CA0033.outlook.office365.com (2603:10b6:405:14::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16 via Frontend Transport; Wed, 15 Dec 2021 00:18:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT037.mail.protection.outlook.com (10.13.177.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Wed, 15 Dec 2021 00:18:14 +0000 Received: from localhost (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 14 Dec 2021 18:18:01 -0600 From: Michael Roth To: CC: , Jon Maloy , Jason Wang Subject: [PATCH 47/47] e1000: fix tx re-entrancy problem Date: Tue, 14 Dec 2021 18:01:25 -0600 Message-ID: <20211215000125.378126-48-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215000125.378126-1-michael.roth@amd.com> References: <20211215000125.378126-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cb8b5097-18cf-41ad-f357-08d9bf606294 X-MS-TrafficTypeDiagnostic: BY5PR12MB4950:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:178; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z/Mfc5CJUzAfLfQZ1EumgTVGR7Gvx3WAK1cE56tj4wZVyCGpiGztwnOKMV/hwjxfIN1ImwOiR7VSEBk+wFncYQSF/8pd3d0oKSOgjHggoNOBtZKOWasfHLFfcWCG2OMmzEEAOXxyzu4IGH+O5SBa80Va2qk9M6WrH7kvmILOjJ7rvLGAbkhCmqeaIF0MvujXYpALsqnvgAJqz7yqgMsxMUUrM2o2rcCVMwrtCINXz7ZAeYQQYsk9UVFEOdQL3nERNWbr6Bc8FrIN9H5Qy2+LXZKzCG5GXhOvo4aGccNw/rope8p75/gNo+yzsfSHqBzemlQzC4+4VgvPvCUf0a21MgMuc3kCnV45FyLtYdw/aMrnt2/yk9hlHp48G0SAadEVmOsumr1PiOKn1P5BSEgxx9tew6MqKFnFf6VsxmVl9l5xm0g+GwfJH99fWMhUZLN+/NSWpzmjW+/6amDACtmKW4yUPaAT4utex9ZGCnreH+enCsx90YS6zsTsDwGx4eLD+etVgkr3zORJB476NK/sO/i5VnHeFCDXSoW2SpdvBbM1uCatsch5aU6p1vtLb97HDPxaM/FRpz6s/IvoH2G/3K2bRhCFACSBLLpuYzA9QuPmVRxfHzT+fdMjnsey+05AEWA7sb961pDkuulSsAHpckbLh88KcyVpazZ1bYQwMTGnTupPW3Zw9CocTo/jBGLaD0Hoxt6xWjGOA7xE3n4t/3r+nttvS2ovDhEmsRBmn2ZCxpbywO87mmHA2910fVDF2hRiPr5Psxue7upVw0zsSPSaVm6qQ+GIs9AmQZCSTwg= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(44832011)(4326008)(54906003)(1076003)(82310400004)(5660300002)(6916009)(36756003)(70206006)(86362001)(6666004)(316002)(47076005)(8676002)(336012)(70586007)(8936002)(426003)(16526019)(83380400001)(26005)(508600001)(186003)(81166007)(2616005)(2906002)(356005)(40460700001)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 00:18:14.0861 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cb8b5097-18cf-41ad-f357-08d9bf606294 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT037.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4950 Received-SPF: softfail client-ip=40.107.93.83; envelope-from=Michael.Roth@amd.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jon Maloy The fact that the MMIO handler is not re-entrant causes an infinite loop under certain conditions: Guest write to TDT -> Loopback -> RX (DMA to TDT) -> TX We now eliminate the effect of this problem locally in e1000, by adding a boolean in struct E1000State indicating when the TX side is busy. This will cause any entering new call to return early instead of interfering with the ongoing work, and eliminates any risk of looping. This is intended to address CVE-2021-20257. Signed-off-by: Jon Maloy Signed-off-by: Jason Wang (cherry picked from commit 25ddb946e6301f42cff3094ea1c25fb78813e7e9) Signed-off-by: Michael Roth --- hw/net/e1000.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/net/e1000.c b/hw/net/e1000.c index a30546c5d5..f5bc81296d 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -107,6 +107,7 @@ struct E1000State_st { e1000x_txd_props props; e1000x_txd_props tso_props; uint16_t tso_frames; + bool busy; } tx; struct { @@ -763,6 +764,11 @@ start_xmit(E1000State *s) return; } + if (s->tx.busy) { + return; + } + s->tx.busy = true; + while (s->mac_reg[TDH] != s->mac_reg[TDT]) { base = tx_desc_base(s) + sizeof(struct e1000_tx_desc) * s->mac_reg[TDH]; @@ -789,6 +795,7 @@ start_xmit(E1000State *s) break; } } + s->tx.busy = false; set_ics(s, 0, cause); }