From patchwork Fri May 14 16:04:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1478574 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VtBgTeGv; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FhYSC0czTz9sWQ for ; Sat, 15 May 2021 02:11:39 +1000 (AEST) Received: from localhost ([::1]:56406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhaPZ-0003gw-1j for incoming@patchwork.ozlabs.org; Fri, 14 May 2021 12:11:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47388) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaIU-0005oP-37 for qemu-devel@nongnu.org; Fri, 14 May 2021 12:04:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:24403) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaIS-0005DB-DM for qemu-devel@nongnu.org; Fri, 14 May 2021 12:04:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621008255; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=919k9q2m+2zrPKFQ+Ec/Cc8wRWCIr42fDB+fDVUPS1k=; b=VtBgTeGv7lo+F32NE2Ogdyy63ucalOzuJMyZopLK/SrMvZtMK+yiU9bG/FYz2Q6cG0jgEP VA3cU0r9lP07ce+lfcUa0nDEwbFU9dvpcCxL87BEHRoAaNO/3rhPglobYaEQktMMdLb3zy x0L1SAoL0DL8hXox8r3j+/rsIgkpvTA= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-330-zB5tScV8MfCiDMnIH_RAcw-1; Fri, 14 May 2021 12:04:12 -0400 X-MC-Unique: zB5tScV8MfCiDMnIH_RAcw-1 Received: by mail-wm1-f71.google.com with SMTP id n127-20020a1c27850000b02901717a27c785so1234367wmn.9 for ; Fri, 14 May 2021 09:04:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=919k9q2m+2zrPKFQ+Ec/Cc8wRWCIr42fDB+fDVUPS1k=; b=N50sS5kdTYF0m5zuJMNMyySGTCy6BK6bWAj9vglfikf3bn5hN59cFeIhHPcSddZcos tlcWTx1qAIWI0sm+pnu5g+4UVHLo4yA17J/mXxy6ymTzrjfThL985BK19Y0g10jmBDmC NKxy8nMlAqNhWs+XZG5OkAH6bToZf23GHPVMKbbmHES+MEuFZXkDm561Pqak9GDEwyr5 oquOMTTq2NRXy1/A5hai1iql1N2g0KE9TQihmIwkeHSzzjADzEYM+hxtMGhoW0x3LVnk 1/PYfc4alhjgz6ch2o29hEoGeAKAViQtpVTJX44YEqVUyqDLRWeJB4gUcVzMYfSTT4fY WLjg== X-Gm-Message-State: AOAM530po1Q4/pxT0Ogzsg5zhF4o2RwZuanp7UrntXld+cPPLOi19eQ0 yCsm8OfnFqwmDxdTTGFpvP880lD5OLsveOO4xGLpX5FW6toUpPK9v5Amuxtu6NMT4g/liHgmbB6 fCpXzufi8WKTc6S7CmohwZhl15QkOw9sEKepOi3RHkzNsO0vXjqnQmX5CGBLx X-Received: by 2002:a05:600c:3643:: with SMTP id y3mr10103892wmq.159.1621008251249; Fri, 14 May 2021 09:04:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwp1nMkXzlps2N7kGzxypWM+YS4VQnS/Djn4sCsK/c5b39OLggeOjKBYGqB9iRUWgaJ/2Qc1g== X-Received: by 2002:a05:600c:3643:: with SMTP id y3mr10103860wmq.159.1621008251002; Fri, 14 May 2021 09:04:11 -0700 (PDT) Received: from redhat.com ([2a10:800c:1fa6:0:3809:fe0c:bb87:250e]) by smtp.gmail.com with ESMTPSA id m22sm12206172wml.40.2021.05.14.09.04.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 09:04:10 -0700 (PDT) Date: Fri, 14 May 2021 12:04:08 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 01/16] amd_iommu: Fix pte_override_page_mask() Message-ID: <20210514160245.91918-2-mst@redhat.com> References: <20210514160245.91918-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210514160245.91918-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , Jean-Philippe Brucker , Richard Henderson , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Jean-Philippe Brucker AMD IOMMU PTEs have a special mode allowing to specify an arbitrary page size. Quoting the AMD IOMMU specification: "When the Next Level bits [of a pte] are 7h, the size of the page is determined by the first zero bit in the page address, starting from bit 12." So if the lowest bits of the page address is 0, the page is 8kB. If the lowest bits are 011, the page is 32kB. Currently pte_override_page_mask() doesn't compute the right value for this page size and amdvi_translate() can return the wrong guest-physical address. With a Linux guest, DMA from SATA devices accesses the wrong memory and causes probe failure: qemu-system-x86_64 ... -device amd-iommu -drive id=hd1,file=foo.bin,if=none \ -device ahci,id=ahci -device ide-hd,drive=hd1,bus=ahci.0 [ 6.613093] ata1.00: qc timeout (cmd 0xec) [ 6.615062] ata1.00: failed to IDENTIFY (I/O error, err_mask=0x4) Fix the page mask. Signed-off-by: Jean-Philippe Brucker Message-Id: <20210421084007.1190546-1-jean-philippe@linaro.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/amd_iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index 74a93a5d93..43b6e9bf51 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -860,8 +860,8 @@ static inline uint8_t get_pte_translation_mode(uint64_t pte) static inline uint64_t pte_override_page_mask(uint64_t pte) { - uint8_t page_mask = 12; - uint64_t addr = (pte & AMDVI_DEV_PT_ROOT_MASK) ^ AMDVI_DEV_PT_ROOT_MASK; + uint8_t page_mask = 13; + uint64_t addr = (pte & AMDVI_DEV_PT_ROOT_MASK) >> 12; /* find the first zero bit */ while (addr & 1) { page_mask++; From patchwork Fri May 14 16:04:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1478597 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=R73fdu31; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FhZ4t5lpkz9sVb for ; Sat, 15 May 2021 02:39:58 +1000 (AEST) Received: from localhost ([::1]:41030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhaqy-0003Ev-Pe for incoming@patchwork.ozlabs.org; Fri, 14 May 2021 12:39:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48558) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaLS-0003Zt-C8 for qemu-devel@nongnu.org; Fri, 14 May 2021 12:07:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:55712) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaLO-0007PL-Eg for qemu-devel@nongnu.org; Fri, 14 May 2021 12:07:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621008437; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=rAhi6mSwd1RX4WD+1Zv1SP4t5UQUzTU38vJXZ1UaeGQ=; b=R73fdu31k8QEKyJ3MArTjy5+THaHPprLy4tVwTXSjhX88cQfWpIqJs3rFe9OBB3GBBifkw 3tMSkrrOjgnZWClU/u2KKwLWAkp3Vl/8ctT8D6SvVuyWIpcL1Pkmc2Z7eT4WNA/CyG7k/m 3M7yonhZ8r5NM6mHeSnddgqCKEp2YD0= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-228-nWPEpX2ANymz4gZN0wDuJA-1; Fri, 14 May 2021 12:04:15 -0400 X-MC-Unique: nWPEpX2ANymz4gZN0wDuJA-1 Received: by mail-wr1-f71.google.com with SMTP id v5-20020adf9e450000b029010e708f05b3so8599567wre.6 for ; Fri, 14 May 2021 09:04:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=rAhi6mSwd1RX4WD+1Zv1SP4t5UQUzTU38vJXZ1UaeGQ=; b=E0jmORNlesEW6pkStllZOy462b4gVYc/W67GzUv0PvdxRWUr2R8D63tNFKO1dFdXpM eGOBGHLy2Mj6fOGBqhQrTv+qf2CszJ99pAcUP1OoIoQKptukKcMZee4ud8VqoBxmx+tK OWFKa/zB74LpAFdrOq3ufheK1ilH3JkZrlroFmfJTDRTqLZtvAuQLcWXP6lKzRkS2DHH seQFSGUFEg1idCn8f73yik34ADdOobrrvS20O4CyttWfe1DDRcC11kb7uh3T7MKrtQkw seVHesN3Blg8M10Dpisbv/CQD7rJj6YgS+SCfNE7sykayZkNN7Sqb51gC7uetnCdwwga 7KgQ== X-Gm-Message-State: AOAM531uJb7fmX7CwqDq/CN19y3y/iLBRMXYoezAhTSp9nDbqdb0o5mh uAUUZ9Smf7RXx61Jil5MAun30rPA9Wy/bCc/Vc+8pGa5AyXc+zUNmD0H6BXCfpb02FD1yBHbiyN V7UPMT99Bq5uEJfnLiXCtyC6qbHm2akxfXwsTC2cDnofYn/sJqsQeTg/KLKkP X-Received: by 2002:adf:a212:: with SMTP id p18mr59844559wra.353.1621008253921; Fri, 14 May 2021 09:04:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAQonu0gl3F5sCwMsVuOcoxWuVE5mtYBNyV4kgPqMAI25ur19qWzJ8bJztNY4xlE+R6yevtA== X-Received: by 2002:adf:a212:: with SMTP id p18mr59844516wra.353.1621008253627; Fri, 14 May 2021 09:04:13 -0700 (PDT) Received: from redhat.com ([2a10:800c:1fa6:0:3809:fe0c:bb87:250e]) by smtp.gmail.com with ESMTPSA id f13sm3319918wrt.86.2021.05.14.09.04.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 09:04:13 -0700 (PDT) Date: Fri, 14 May 2021 12:04:11 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 02/16] x86: acpi: use offset instead of pointer when using build_header() Message-ID: <20210514160245.91918-3-mst@redhat.com> References: <20210514160245.91918-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210514160245.91918-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , mst@redhat.com, Richard Henderson , Igor Mammedov , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov Do the same as in commit (4d027afeb3a97 Virt: ACPI: fix qemu assert due to re-assigned table data address) for remaining tables that happen to use saved at the beginning pointer to build header to avoid assert when table_data is relocated due to implicit re-size. In this case user is trying to start Windows 10 and getting assert at hw/acpi/bios-linker-loader.c:239: bios_linker_loader_add_checksum: Assertion `start_offset < file->blob->len' failed. Fixes: https://bugs.launchpad.net/bugs/1923497 Signed-off-by: Igor Mammedov Message-Id: <20210414084356.3792113-1-imammedo@redhat.com> Cc: mst@redhat.com, qemu-stable@nongnu.org Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/aml-build.c | 15 +++++++++------ hw/i386/acpi-build.c | 8 ++++++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index d33ce8954a..f0035d2b4a 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1830,6 +1830,7 @@ build_rsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets, int i; unsigned rsdt_entries_offset; AcpiRsdtDescriptorRev1 *rsdt; + int rsdt_start = table_data->len; const unsigned table_data_len = (sizeof(uint32_t) * table_offsets->len); const unsigned rsdt_entry_size = sizeof(rsdt->table_offset_entry[0]); const size_t rsdt_len = sizeof(*rsdt) + table_data_len; @@ -1846,7 +1847,8 @@ build_rsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets, ACPI_BUILD_TABLE_FILE, ref_tbl_offset); } build_header(linker, table_data, - (void *)rsdt, "RSDT", rsdt_len, 1, oem_id, oem_table_id); + (void *)(table_data->data + rsdt_start), + "RSDT", rsdt_len, 1, oem_id, oem_table_id); } /* Build xsdt table */ @@ -1857,6 +1859,7 @@ build_xsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets, int i; unsigned xsdt_entries_offset; AcpiXsdtDescriptorRev2 *xsdt; + int xsdt_start = table_data->len; const unsigned table_data_len = (sizeof(uint64_t) * table_offsets->len); const unsigned xsdt_entry_size = sizeof(xsdt->table_offset_entry[0]); const size_t xsdt_len = sizeof(*xsdt) + table_data_len; @@ -1873,7 +1876,8 @@ build_xsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets, ACPI_BUILD_TABLE_FILE, ref_tbl_offset); } build_header(linker, table_data, - (void *)xsdt, "XSDT", xsdt_len, 1, oem_id, oem_table_id); + (void *)(table_data->data + xsdt_start), + "XSDT", xsdt_len, 1, oem_id, oem_table_id); } void build_srat_memory(AcpiSratMemoryAffinity *numamem, uint64_t base, @@ -2053,10 +2057,9 @@ void build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog, uint64_t control_area_start_address; TPMIf *tpmif = tpm_find(); uint32_t start_method; - void *tpm2_ptr; tpm2_start = table_data->len; - tpm2_ptr = acpi_data_push(table_data, sizeof(AcpiTableHeader)); + acpi_data_push(table_data, sizeof(AcpiTableHeader)); /* Platform Class */ build_append_int_noprefix(table_data, TPM2_ACPI_CLASS_CLIENT, 2); @@ -2095,8 +2098,8 @@ void build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog, log_addr_offset, 8, ACPI_BUILD_TPMLOG_FILE, 0); build_header(linker, table_data, - tpm2_ptr, "TPM2", table_data->len - tpm2_start, 4, oem_id, - oem_table_id); + (void *)(table_data->data + tpm2_start), + "TPM2", table_data->len - tpm2_start, 4, oem_id, oem_table_id); } Aml *build_crs(PCIHostState *host, CrsRangeSet *range_set, uint32_t io_offset, diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index de98750aef..daaf8f473e 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1816,6 +1816,7 @@ build_hpet(GArray *table_data, BIOSLinker *linker, const char *oem_id, const char *oem_table_id) { Acpi20Hpet *hpet; + int hpet_start = table_data->len; hpet = acpi_data_push(table_data, sizeof(*hpet)); /* Note timer_block_id value must be kept in sync with value advertised by @@ -1824,13 +1825,15 @@ build_hpet(GArray *table_data, BIOSLinker *linker, const char *oem_id, hpet->timer_block_id = cpu_to_le32(0x8086a201); hpet->addr.address = cpu_to_le64(HPET_BASE); build_header(linker, table_data, - (void *)hpet, "HPET", sizeof(*hpet), 1, oem_id, oem_table_id); + (void *)(table_data->data + hpet_start), + "HPET", sizeof(*hpet), 1, oem_id, oem_table_id); } static void build_tpm_tcpa(GArray *table_data, BIOSLinker *linker, GArray *tcpalog, const char *oem_id, const char *oem_table_id) { + int tcpa_start = table_data->len; Acpi20Tcpa *tcpa = acpi_data_push(table_data, sizeof *tcpa); unsigned log_addr_size = sizeof(tcpa->log_area_start_address); unsigned log_addr_offset = @@ -1849,7 +1852,8 @@ build_tpm_tcpa(GArray *table_data, BIOSLinker *linker, GArray *tcpalog, ACPI_BUILD_TPMLOG_FILE, 0); build_header(linker, table_data, - (void *)tcpa, "TCPA", sizeof(*tcpa), 2, oem_id, oem_table_id); + (void *)(table_data->data + tcpa_start), + "TCPA", sizeof(*tcpa), 2, oem_id, oem_table_id); } #define HOLE_640K_START (640 * KiB) From patchwork Fri May 14 16:04:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1478588 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=a74PPExg; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FhYpB5n1nz9sCD for ; Sat, 15 May 2021 02:27:14 +1000 (AEST) Received: from localhost ([::1]:42754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhaee-0001MX-QQ for incoming@patchwork.ozlabs.org; Fri, 14 May 2021 12:27:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47432) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaIX-00061G-DV for qemu-devel@nongnu.org; Fri, 14 May 2021 12:04:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:22408) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaIV-0005GT-Sc for qemu-devel@nongnu.org; Fri, 14 May 2021 12:04:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621008259; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=muRWUMoRmGNLLUr4R0cDQy4brPQQprA4VAlV1bSDdDE=; b=a74PPExgDSdV0qHA6OvHDMb8Sg0q73rl+mnVC7MI6+mAuqBfioiI8V+OF72xmSdKRr+Hrt YX6QmGWzP/XS92ZYOtNve95ej189kU12doEYcM5UhEzeIjsPrzmuLN81TttJk+nhi9VpIh FTaFT1YdBl7LO+XmKer14G3F4eIN0oI= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-405--RoVs2S3PdSKtDE4LfX-TQ-1; Fri, 14 May 2021 12:04:17 -0400 X-MC-Unique: -RoVs2S3PdSKtDE4LfX-TQ-1 Received: by mail-wm1-f70.google.com with SMTP id r15-20020a05600c35cfb029017373d9f318so17014wmq.4 for ; Fri, 14 May 2021 09:04:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=muRWUMoRmGNLLUr4R0cDQy4brPQQprA4VAlV1bSDdDE=; b=tMQLsBcUA2pOTr1iKlCQZOGj8Ek++tFbGelu/z5ADYXMGD9ILLekXZJZYG7hX/5CK6 SLrYZBL7ZdrunehK7Lgngf0HGO79Kdcq1HRbIcZTn79pBH7qSd6ZtjzXC0mA3oDLk1wU sc4EN2jacl8TbUjhUNyQb07KqGBv34HhQAgS65rkOT128H1s5UcZxDudn/vk9d6q28qn itKVNEmihdF5ako9TReS312eVB1q7mxCytV/GlwI8JQu4/pnBA6/4BYB4xESCR8f6s9E 9BVyPSj3Zo0p+MEOvQigcM8g3zsu7Rylh7QG7r9faluIKZcZ1YYQH1g0HsYEdZ4cLCxw UhBg== X-Gm-Message-State: AOAM530B1km9o3l0rhbcgQW6uspwaQlYLRa+dNRk8CbJrC2+hN39+DLB qXPQPsXPx42SwPSXmiMxNVRMXL1JhnxeMBNbtFtqkZu6WfaC93pAuTqZkyOBnFNXCuMrX0VK536 hiP43Fbuy9XqzZg0ltpIidGb2lR3UERyu+BRbzrTBHPf8Zdtvh8RwqOIWo+vZ X-Received: by 2002:a5d:4a87:: with SMTP id o7mr59854571wrq.102.1621008255872; Fri, 14 May 2021 09:04:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnZtZrcuiZQkXccRIifTHrmgoovMzdJPrMk6lpTRoxCPguhJFRFQ6vDKoBLEuv3zZLImcy5w== X-Received: by 2002:a5d:4a87:: with SMTP id o7mr59854548wrq.102.1621008255662; Fri, 14 May 2021 09:04:15 -0700 (PDT) Received: from redhat.com ([2a10:800c:1fa6:0:3809:fe0c:bb87:250e]) by smtp.gmail.com with ESMTPSA id b17sm6983138wrt.71.2021.05.14.09.04.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 09:04:15 -0700 (PDT) Date: Fri, 14 May 2021 12:04:13 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 03/16] hw/virtio: Pass virtio_feature_get_config_size() a const argument Message-ID: <20210514160245.91918-4-mst@redhat.com> References: <20210514160245.91918-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210514160245.91918-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Philippe =?utf-8?q?Mathieu-Dau?= =?utf-8?q?d=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé The VirtIOFeature structure isn't modified, mark it const. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210511104157.2880306-2-philmd@redhat.com> --- include/hw/virtio/virtio.h | 2 +- hw/virtio/virtio.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index b7ece7a6a8..8bab9cfb75 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -43,7 +43,7 @@ typedef struct VirtIOFeature { size_t end; } VirtIOFeature; -size_t virtio_feature_get_config_size(VirtIOFeature *features, +size_t virtio_feature_get_config_size(const VirtIOFeature *features, uint64_t host_features); typedef struct VirtQueue VirtQueue; diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 07f4e60b30..564ca63246 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2982,7 +2982,7 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val) return ret; } -size_t virtio_feature_get_config_size(VirtIOFeature *feature_sizes, +size_t virtio_feature_get_config_size(const VirtIOFeature *feature_sizes, uint64_t host_features) { size_t config_size = 0; From patchwork Fri May 14 16:04:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1478582 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ivlNqsII; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FhYdJ2ZhDz9sVt for ; Sat, 15 May 2021 02:19:32 +1000 (AEST) Received: from localhost ([::1]:56034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhaXC-0007I0-B2 for incoming@patchwork.ozlabs.org; Fri, 14 May 2021 12:19:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaIc-0006H6-8b for qemu-devel@nongnu.org; Fri, 14 May 2021 12:04:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:60628) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaIZ-0005JZ-L9 for qemu-devel@nongnu.org; Fri, 14 May 2021 12:04:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621008263; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uXByC9bAMbx8cyt6YCu0wJ8hR9id0KLULy1jcFDQm94=; b=ivlNqsIIfkxuaoBJm9HtMTD7M6lRvk1IPTN11n8UfB6lJaq81SweoEHJXznVYrJIllL+md p7uSNhSlIjqwhM/AMs+fNJrdoE5EhwsT/7YPn9sq+bm06JgjMkeEdmBd9YwITq01vohj65 jau2vvsWSnRV6FwwWj5cHHrAD7YA7sU= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-500-RmIFU5BoMq6w9MTvLqAGYw-1; Fri, 14 May 2021 12:04:20 -0400 X-MC-Unique: RmIFU5BoMq6w9MTvLqAGYw-1 Received: by mail-wm1-f71.google.com with SMTP id j128-20020a1c55860000b02901384b712094so1251204wmb.2 for ; Fri, 14 May 2021 09:04:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=uXByC9bAMbx8cyt6YCu0wJ8hR9id0KLULy1jcFDQm94=; b=NJ3X48FIDPJBookQnUxsl0Q7isxIg2hM/j3usroc6I8IIa60F1zRNWeC+oX9VGD4CX 44zJml6+SzqapVPZuGGh443u1fm0LjT81jv+uBdhiLYs+JKOD+4GBmwQhwpfbW7IH3Qe I5KYCP7bhjYDYsZ9MxTboiGkiMr4DyOjpJPOdPM9VcJpKpmD9eE37TUH0NSvNM8TIDmJ VlygdwYZBENDpKJsfCi0XFJ94+zM0fTREHOOzFyjSd7jk2YKlFoagLudzoUlvkXbeQQn F+9h0oREcwDDefpmHayB3Gm7B87/6yauCgVUEb5wN98waB/JEAxRNO/KasZ1dmouGexY yaeg== X-Gm-Message-State: AOAM532N8DL94ynnroqBT6xUkDQwSzE9QuQg1xklJrXyAJTwkqAAx0MO +nrcCJkC+VHcOYcR3y082y262QsOg36bi6xfioMNFYYEo613VxBDb4gcCoyLwW7K87cMAUWWZDf RLgq7yr4W6KYBJco39R9AMdkkbtxVLY8nMfGFlfGl7FdF/94cnT6YEHY9rvmk X-Received: by 2002:a7b:c444:: with SMTP id l4mr50620948wmi.36.1621008258518; Fri, 14 May 2021 09:04:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzawTqC5I8sP/nIeAkkgxWZ+RSQYDS3d0ZHYnFVYoYOf9DlEGW8tPTUD/Doy6KYXc55SB1jQ== X-Received: by 2002:a7b:c444:: with SMTP id l4mr50620925wmi.36.1621008258289; Fri, 14 May 2021 09:04:18 -0700 (PDT) Received: from redhat.com ([2a10:800c:1fa6:0:3809:fe0c:bb87:250e]) by smtp.gmail.com with ESMTPSA id x65sm14274008wmg.36.2021.05.14.09.04.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 09:04:17 -0700 (PDT) Date: Fri, 14 May 2021 12:04:16 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 04/16] virtio-blk: Constify VirtIOFeature feature_sizes[] Message-ID: <20210514160245.91918-5-mst@redhat.com> References: <20210514160245.91918-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210514160245.91918-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-block@nongnu.org, Max Reitz , Stefan Hajnoczi , Philippe =?utf-8?q?Mathieu-Daud?= =?utf-8?q?=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210511104157.2880306-3-philmd@redhat.com> --- hw/block/virtio-blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index d28979efb8..f139cd7cc9 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -40,7 +40,7 @@ * Starting from the discard feature, we can use this array to properly * set the config size depending on the features enabled. */ -static VirtIOFeature feature_sizes[] = { +static const VirtIOFeature feature_sizes[] = { {.flags = 1ULL << VIRTIO_BLK_F_DISCARD, .end = endof(struct virtio_blk_config, discard_sector_alignment)}, {.flags = 1ULL << VIRTIO_BLK_F_WRITE_ZEROES, From patchwork Fri May 14 16:04:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1478590 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=On0uLWvE; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FhYwQ6fJ5z9sVb for ; Sat, 15 May 2021 02:32:38 +1000 (AEST) Received: from localhost ([::1]:51030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhajs-0007Q5-MR for incoming@patchwork.ozlabs.org; Fri, 14 May 2021 12:32:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47480) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaIf-0006PL-IP for qemu-devel@nongnu.org; Fri, 14 May 2021 12:04:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:56674) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaIc-0005LS-QO for qemu-devel@nongnu.org; Fri, 14 May 2021 12:04:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621008265; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wdi/bwVCvQI3Cf1f57BFvqMqN5Pw6K1/gcXgkNZP0zc=; b=On0uLWvEn3lu7T0T25nojhtZocVklwXtheUY1w7tuipi5SVjAspA6ws7xYSRIyR/UbVZ7M 2/GSZAUjvOEmE4/uGA87sJGYUcdyG5cq0Buj+HlhwQdB9fMgjLqLCWPlKAeGueeP/7hMWB TxfpoIsvmSjd/iaJzbm0cvtd1/y4V8w= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-284-SOtroGqVNpqV8OhZao2lrA-1; Fri, 14 May 2021 12:04:23 -0400 X-MC-Unique: SOtroGqVNpqV8OhZao2lrA-1 Received: by mail-wr1-f70.google.com with SMTP id 1-20020adf93810000b029010fd5ac4ed7so3332641wrp.15 for ; Fri, 14 May 2021 09:04:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=wdi/bwVCvQI3Cf1f57BFvqMqN5Pw6K1/gcXgkNZP0zc=; b=LmXzeJjAILk6H4MOkXTNta5G6J+99tgx89f37IOiFkOKn+HmLyPZI3+8beA6i1A1rd 0oa2Nj6GFNDdSmNBnnDTtkrs/aAHDc/Ku9OT38EWdD5GdDDMPS2523D5ccCZaH0dz9oi 3LITISM79GBDYH0HC4Cxkou40/X4bOclQkcJPXWwmPKj6f/ztE/VstEG6y6nSwJrEayG BeekzZHFuc8u+1jVpEgXNoUm7lfl2czo6YWVf0cVkz8YeVmvU2TYm3MVLUE9RUJIoW6f bE2r7gCH/owkkAKXpNeX8bbLK0RPKGChbTt1sbJQNmxq1/UAtsVSMiNIQ+2EW98ATVvw 7a5w== X-Gm-Message-State: AOAM532m6PkErXl4bYi3q013YGUKsfRDtXh6H98/bwdNgGVEfPZZ35cA K+ImqImRELoHflIhgcNXXqRroIo8NWJPHU8mCEs37xh2wVPUbri+yGrhX8CFfOS9M+aBTo0K05S JgF6ytCM3nl1t4GHzIM+D0PpPX+DWlRHwiG2uCSPFzyH06qFb9uRoV9juP9uU X-Received: by 2002:a05:6000:52:: with SMTP id k18mr1408173wrx.419.1621008261070; Fri, 14 May 2021 09:04:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyy2Vnbg6I+jzwru4GV8tCyp64+qzXfdLUC4LYY1To81Jzz/B75yLouf6nUp/aMf4+ch94Z1w== X-Received: by 2002:a05:6000:52:: with SMTP id k18mr1408147wrx.419.1621008260904; Fri, 14 May 2021 09:04:20 -0700 (PDT) Received: from redhat.com ([2a10:800c:1fa6:0:3809:fe0c:bb87:250e]) by smtp.gmail.com with ESMTPSA id c206sm809986wmf.12.2021.05.14.09.04.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 09:04:20 -0700 (PDT) Date: Fri, 14 May 2021 12:04:18 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 05/16] virtio-net: Constify VirtIOFeature feature_sizes[] Message-ID: <20210514160245.91918-6-mst@redhat.com> References: <20210514160245.91918-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210514160245.91918-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jason Wang , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210511104157.2880306-4-philmd@redhat.com> --- hw/net/virtio-net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 66b9ff4511..6b7e8dd04e 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -89,7 +89,7 @@ VIRTIO_NET_RSS_HASH_TYPE_TCP_EX | \ VIRTIO_NET_RSS_HASH_TYPE_UDP_EX) -static VirtIOFeature feature_sizes[] = { +static const VirtIOFeature feature_sizes[] = { {.flags = 1ULL << VIRTIO_NET_F_MAC, .end = endof(struct virtio_net_config, mac)}, {.flags = 1ULL << VIRTIO_NET_F_STATUS, From patchwork Fri May 14 16:04:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1478583 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Zrdnsg7S; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FhYhz0MpZz9sVt for ; Sat, 15 May 2021 02:22:43 +1000 (AEST) Received: from localhost ([::1]:34610 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhaaG-00040P-Tu for incoming@patchwork.ozlabs.org; Fri, 14 May 2021 12:22:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaJl-0008SN-FX for qemu-devel@nongnu.org; Fri, 14 May 2021 12:05:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:47911) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaJg-000690-AX for qemu-devel@nongnu.org; Fri, 14 May 2021 12:05:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621008330; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QE3OXd/163Md4cs5sroBFpscN+9OwcbZr5PSUP17kkg=; b=Zrdnsg7SYIpg8SZ/1dOQDV2f/3uTyM8wvzYbbFfAe9voBpzDEsX0XT3WmyuEuGkrlfZ8R5 dZWPwDxucJBBtnwQ/dx+5QCHFEtwjlLiolMAxl+oHIdOO2KU7tlYqL3sE+tc1bfUpv9um2 XHM6mxT113Xg+u8Q6JM6b5qcggI1wXQ= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-411-uJBA44CGMwSe3q2Nhb00Vw-1; Fri, 14 May 2021 12:04:26 -0400 X-MC-Unique: uJBA44CGMwSe3q2Nhb00Vw-1 Received: by mail-wr1-f72.google.com with SMTP id 1-20020adf93810000b029010fd5ac4ed7so3332696wrp.15 for ; Fri, 14 May 2021 09:04:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=QE3OXd/163Md4cs5sroBFpscN+9OwcbZr5PSUP17kkg=; b=OcRpofPdT77rqrUiOHENZGnMFISAK/bC138hfR5qztZvYT1lnnSB8o3Yz3i+fTjmhb IH29K/CsigYf6yPzRmVhJZePz/Dw4+lYAOz/q7zHoSzyyosaVXYSj+Ur/1LU6j7cQPTJ dlQ11GHgRGkzYNzpGWFa9dP6jvHVIK+G9bJmM4IEo3bdBHxldg659WwnNWk7qREhjxPJ wLCjZsGfiyp42N702bIJDyd13/eydPsz6ZZfPY9x0vOlNmqtVp9/cKUcWAjtMOSULP6s WqaoSByPvQ4Jg+dq+LcP+kD/gJ73e5pJ6y2TAFeG/aOnUzKvbpE0c1Lhf9mcDUhauy87 1L5g== X-Gm-Message-State: AOAM531ZNg1iX/5lHH5EZTthB0X8UUg6QVhHxGVaUP3tco2ZfXVvDmkH +3cp9Lxc/TJwIeqvHL2CTBs2I+blF9u3PtvNbJ3/u4W8Do9qr/lVN2Qh4G6+1K/CXleJp4bIuI/ cOC7XBrYEDZvVd9XhLcU8V5jSNfAcjPpci5nG5/NxmGFGjrFGYjtcJqlbD6Nm X-Received: by 2002:a1c:7711:: with SMTP id t17mr51255378wmi.6.1621008264142; Fri, 14 May 2021 09:04:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwtHuh8GUoUeGwBOPkBl6rKzl9Sl+jsNzANAjbLePxHyYuPj//nm0xsan4WsubkNnNf4Bbzw== X-Received: by 2002:a1c:7711:: with SMTP id t17mr51255344wmi.6.1621008263870; Fri, 14 May 2021 09:04:23 -0700 (PDT) Received: from redhat.com ([2a10:800c:1fa6:0:3809:fe0c:bb87:250e]) by smtp.gmail.com with ESMTPSA id c15sm6567357wrr.3.2021.05.14.09.04.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 09:04:23 -0700 (PDT) Date: Fri, 14 May 2021 12:04:21 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 06/16] amd_iommu: fix wrong MMIO operations Message-ID: <20210514160245.91918-7-mst@redhat.com> References: <20210514160245.91918-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210514160245.91918-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , Roman Kapl , Richard Henderson , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Roman Kapl Address was swapped with value when writing MMIO registers, so the user saw garbage in lot of cases. The interrupt status was not correctly set. Signed-off-by: Roman Kapl Message-Id: <20210427110504.10878-1-rka@sysgo.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/amd_iommu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index 43b6e9bf51..2801dff97c 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -99,7 +99,7 @@ static uint64_t amdvi_readq(AMDVIState *s, hwaddr addr) } /* internal write */ -static void amdvi_writeq_raw(AMDVIState *s, uint64_t val, hwaddr addr) +static void amdvi_writeq_raw(AMDVIState *s, hwaddr addr, uint64_t val) { stq_le_p(&s->mmior[addr], val); } @@ -382,7 +382,7 @@ static void amdvi_completion_wait(AMDVIState *s, uint64_t *cmd) } /* set completion interrupt */ if (extract64(cmd[0], 1, 1)) { - amdvi_test_mask(s, AMDVI_MMIO_STATUS, AMDVI_MMIO_STATUS_COMP_INT); + amdvi_assign_orq(s, AMDVI_MMIO_STATUS, AMDVI_MMIO_STATUS_COMP_INT); /* generate interrupt */ amdvi_generate_msi_interrupt(s); } @@ -553,7 +553,7 @@ static void amdvi_cmdbuf_run(AMDVIState *s) trace_amdvi_command_exec(s->cmdbuf_head, s->cmdbuf_tail, s->cmdbuf); amdvi_cmdbuf_exec(s); s->cmdbuf_head += AMDVI_COMMAND_SIZE; - amdvi_writeq_raw(s, s->cmdbuf_head, AMDVI_MMIO_COMMAND_HEAD); + amdvi_writeq_raw(s, AMDVI_MMIO_COMMAND_HEAD, s->cmdbuf_head); /* wrap head pointer */ if (s->cmdbuf_head >= s->cmdbuf_len * AMDVI_COMMAND_SIZE) { From patchwork Fri May 14 16:04:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1478584 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HNH0n/vQ; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FhYjf2jBHz9sVt for ; Sat, 15 May 2021 02:23:18 +1000 (AEST) Received: from localhost ([::1]:35810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhaaq-0004rm-CO for incoming@patchwork.ozlabs.org; Fri, 14 May 2021 12:23:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47534) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaIm-0006lB-96 for qemu-devel@nongnu.org; Fri, 14 May 2021 12:04:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52184) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaIj-0005Qd-TL for qemu-devel@nongnu.org; Fri, 14 May 2021 12:04:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621008273; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=upZeNF4eA0t53yo34zKkvSJygTJZcKC6c3bGqY8MELc=; b=HNH0n/vQ4PDExjcUhtSHwDSp7kYtasNxzLIHXScv/FEshEhWsSzfVQfizGULKZ0vjFtRfq 5niZywR1FNr9ZiwneDSHjsp9VlKL9sNnnsNcryHo9F886kJYFLgwVlMSJIyXkvrLjJMAxv LcI+Nn2X7gsh3LKc24UAlGCxSGT39SE= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-520-nAFIMs7HMWWfUfL-FS43KQ-1; Fri, 14 May 2021 12:04:28 -0400 X-MC-Unique: nAFIMs7HMWWfUfL-FS43KQ-1 Received: by mail-wm1-f70.google.com with SMTP id g206-20020a1c39d70000b029016ac627fbe9so6836wma.9 for ; Fri, 14 May 2021 09:04:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=upZeNF4eA0t53yo34zKkvSJygTJZcKC6c3bGqY8MELc=; b=Bwg+eb+ulwfv7BNQqNJi/MC3Ltld/i4nODyp6hlZXd2RxjYb0tPt0aXFb6bNoQzz9b afYo1D1GdDiS9QEYI8ZHrm2EAXClACtpyGVh4BNqtp+V6XoYnq6vwNyWc3y4k/tpzDwm yUpqTavu99pJEgMQumJDtp8lfmaMjygz4sOrNcesOWL5aP33uS+olAAEajxykDzI45Y4 L5LKXhfhQGB8eweDzwcslt9H1rrwqyoVJJ+P5QAteDE0t0/CmTDq5VVqPz76FT1HvbM5 q0wq5zOgE++DSxXPDzBnl4/y0NGHcjRYTj/gJ0PlZy28DmPWENecRQ1ehr47YmxwH76w x/ww== X-Gm-Message-State: AOAM531ypNfVbsxV8+s5c7UCYpjTza/oNEyFtUwcTDfdAFuePifi8NLd n+PG1akceSwG98I9nKYpGfZF1bqyQpPL0YKw4fQzqaB2k3Kp65DNOGDHqB1LORaFI51VtOngos6 oooUpzHSgYo/dOGE2iFIEF22eID6eBbJmwRFF24B/GzJKx6ujEE84W69DmLS0 X-Received: by 2002:adf:bc46:: with SMTP id a6mr21656637wrh.232.1621008266673; Fri, 14 May 2021 09:04:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0Ftkp4ILuDFhDMzHUHnw0pIlvv26FuDtrrUezXJtHL7kZeS7jRZHGuz7Y1J54CD9mFK34/w== X-Received: by 2002:adf:bc46:: with SMTP id a6mr21656597wrh.232.1621008266364; Fri, 14 May 2021 09:04:26 -0700 (PDT) Received: from redhat.com ([2a10:800c:1fa6:0:3809:fe0c:bb87:250e]) by smtp.gmail.com with ESMTPSA id a1sm2782230wmm.7.2021.05.14.09.04.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 09:04:25 -0700 (PDT) Date: Fri, 14 May 2021 12:04:24 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 07/16] pc-dimm: remove unnecessary get_vmstate_memory_region() method Message-ID: <20210514160245.91918-8-mst@redhat.com> References: <20210514160245.91918-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210514160245.91918-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , "Maciej S. Szmigiero" , Igor Mammedov Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: "Maciej S. Szmigiero" The get_vmstate_memory_region() method from PCDIMMDeviceClass is only ever called from this class and is never overridden, so it can be converted into an ordinary function. This saves us from having to do an indirect call in order to reach it. Signed-off-by: Maciej S. Szmigiero Message-Id: Reviewed-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/mem/pc-dimm.h | 5 ----- hw/mem/pc-dimm.c | 33 ++++++++++++++------------------- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/include/hw/mem/pc-dimm.h b/include/hw/mem/pc-dimm.h index 3d3db82641..1473e6db62 100644 --- a/include/hw/mem/pc-dimm.h +++ b/include/hw/mem/pc-dimm.h @@ -56,9 +56,6 @@ struct PCDIMMDevice { * PCDIMMDeviceClass: * @realize: called after common dimm is realized so that the dimm based * devices get the chance to do specified operations. - * @get_vmstate_memory_region: returns #MemoryRegion which indicates the - * memory of @dimm should be kept during live migration. Will not fail - * after the device was realized. */ struct PCDIMMDeviceClass { /* private */ @@ -66,8 +63,6 @@ struct PCDIMMDeviceClass { /* public */ void (*realize)(PCDIMMDevice *dimm, Error **errp); - MemoryRegion *(*get_vmstate_memory_region)(PCDIMMDevice *dimm, - Error **errp); }; void pc_dimm_pre_plug(PCDIMMDevice *dimm, MachineState *machine, diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c index 12b655eda8..a3a2560301 100644 --- a/hw/mem/pc-dimm.c +++ b/hw/mem/pc-dimm.c @@ -34,6 +34,16 @@ static int pc_dimm_get_free_slot(const int *hint, int max_slots, Error **errp); +static MemoryRegion *pc_dimm_get_memory_region(PCDIMMDevice *dimm, Error **errp) +{ + if (!dimm->hostmem) { + error_setg(errp, "'" PC_DIMM_MEMDEV_PROP "' property must be set"); + return NULL; + } + + return host_memory_backend_get_memory(dimm->hostmem); +} + void pc_dimm_pre_plug(PCDIMMDevice *dimm, MachineState *machine, const uint64_t *legacy_align, Error **errp) { @@ -66,9 +76,8 @@ void pc_dimm_pre_plug(PCDIMMDevice *dimm, MachineState *machine, void pc_dimm_plug(PCDIMMDevice *dimm, MachineState *machine) { - PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm); - MemoryRegion *vmstate_mr = ddc->get_vmstate_memory_region(dimm, - &error_abort); + MemoryRegion *vmstate_mr = pc_dimm_get_memory_region(dimm, + &error_abort); memory_device_plug(MEMORY_DEVICE(dimm), machine); vmstate_register_ram(vmstate_mr, DEVICE(dimm)); @@ -76,9 +85,8 @@ void pc_dimm_plug(PCDIMMDevice *dimm, MachineState *machine) void pc_dimm_unplug(PCDIMMDevice *dimm, MachineState *machine) { - PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm); - MemoryRegion *vmstate_mr = ddc->get_vmstate_memory_region(dimm, - &error_abort); + MemoryRegion *vmstate_mr = pc_dimm_get_memory_region(dimm, + &error_abort); memory_device_unplug(MEMORY_DEVICE(dimm), machine); vmstate_unregister_ram(vmstate_mr, DEVICE(dimm)); @@ -205,16 +213,6 @@ static void pc_dimm_unrealize(DeviceState *dev) host_memory_backend_set_mapped(dimm->hostmem, false); } -static MemoryRegion *pc_dimm_get_memory_region(PCDIMMDevice *dimm, Error **errp) -{ - if (!dimm->hostmem) { - error_setg(errp, "'" PC_DIMM_MEMDEV_PROP "' property must be set"); - return NULL; - } - - return host_memory_backend_get_memory(dimm->hostmem); -} - static uint64_t pc_dimm_md_get_addr(const MemoryDeviceState *md) { return object_property_get_uint(OBJECT(md), PC_DIMM_ADDR_PROP, @@ -266,7 +264,6 @@ static void pc_dimm_md_fill_device_info(const MemoryDeviceState *md, static void pc_dimm_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); - PCDIMMDeviceClass *ddc = PC_DIMM_CLASS(oc); MemoryDeviceClass *mdc = MEMORY_DEVICE_CLASS(oc); dc->realize = pc_dimm_realize; @@ -274,8 +271,6 @@ static void pc_dimm_class_init(ObjectClass *oc, void *data) device_class_set_props(dc, pc_dimm_properties); dc->desc = "DIMM memory module"; - ddc->get_vmstate_memory_region = pc_dimm_get_memory_region; - mdc->get_addr = pc_dimm_md_get_addr; mdc->set_addr = pc_dimm_md_set_addr; /* for a dimm plugged_size == region_size */ From patchwork Fri May 14 16:04:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1478572 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VGHbOGkU; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FhYQX31Gdz9sWQ for ; Sat, 15 May 2021 02:10:12 +1000 (AEST) Received: from localhost ([::1]:52206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhaOA-0000XN-9s for incoming@patchwork.ozlabs.org; Fri, 14 May 2021 12:10:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47538) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaIm-0006mU-S5 for qemu-devel@nongnu.org; Fri, 14 May 2021 12:04:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40833) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaIj-0005QS-9g for qemu-devel@nongnu.org; Fri, 14 May 2021 12:04:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621008272; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gAqW+8N7iMGcapAeP6vWVExIRFMEhdprQula/BM34oc=; b=VGHbOGkUOqq2JbaV6J86PdqQqUlNYGdZK1syxeO5Vgu6Hp5ivC1wGlLdjpaKlPaJRosjil Y7yYTcBX+YPe4Hg0mag0c7wpfqZQJPWZtbauJHN2q5tQesVg4S17bFMTu22pnTNWzkyibP 8ns9BYV0DZeFLvkdHj7i6GiTU4G8RX0= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-315-FQaXXPXMM76wzkNzZwHsuw-1; Fri, 14 May 2021 12:04:30 -0400 X-MC-Unique: FQaXXPXMM76wzkNzZwHsuw-1 Received: by mail-wm1-f72.google.com with SMTP id r15-20020a05600c35cfb029017373d9f318so17189wmq.4 for ; Fri, 14 May 2021 09:04:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=gAqW+8N7iMGcapAeP6vWVExIRFMEhdprQula/BM34oc=; b=S5JJT2gkZFzdLgr5tC13aWvFS7JIWOGR/fSZeEylhMOMg3M2OFu4oZg72noAQXPnD/ gs3x+brduRUOSJXFQJeFnV2zZIZoKBMsphRoywHY1UuAnJVQ/N4fMSdmiZxZHdCUwL7I SUzFfRfKgtDIfrc4j686WKeSUSrEbYiPhG5LQ78GdrucMlviZr9b8ZTx1rJml5p2OLgL aI3Z/o/4PpWd95XmigG9eBWv39aHMNMkY0RIghZLL32oDDJs+3AnI88+TSy2L1TxxnY4 qxdLQxRdRAuoYRlU/Fo6GzVbc4w6Sp5LgMZl2o92H9P77iMNu7tGEtq+fX5UiJ7PwtCl FwYA== X-Gm-Message-State: AOAM530C4MXNRzi0y3Jp0ZM0KT5XYj27hfUDEQbA8VllP5LR3IrVeiLt Ey/66HBkO4oqcod6HeUrfCb+fQwAb6yev0OzdXw1Stm69jPIMlUJf7DbmvrH1+2mr/XhN1olyFy J7RH0h+vYXmAHp8I26ZUHQhKCtt79jeXcsm5mYRc5OlWliohaeUnDQV3oekW0 X-Received: by 2002:adf:e404:: with SMTP id g4mr59506636wrm.240.1621008269112; Fri, 14 May 2021 09:04:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJye61BVi5AvNpBWDIHG6OW6asDk1aqGNtwbMRa2xBHhgAoWM6QibSnvqz/4J6cyrtTZ0p3w+w== X-Received: by 2002:adf:e404:: with SMTP id g4mr59506613wrm.240.1621008268930; Fri, 14 May 2021 09:04:28 -0700 (PDT) Received: from redhat.com ([2a10:800c:1fa6:0:3809:fe0c:bb87:250e]) by smtp.gmail.com with ESMTPSA id y5sm6931593wrp.5.2021.05.14.09.04.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 09:04:28 -0700 (PDT) Date: Fri, 14 May 2021 12:04:26 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 08/16] virtio-blk: Fix rollback path in virtio_blk_data_plane_start() Message-ID: <20210514160245.91918-9-mst@redhat.com> References: <20210514160245.91918-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210514160245.91918-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Peter Maydell , qemu-block@nongnu.org, Greg Kurz , Max Reitz , stefanha@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Greg Kurz When dataplane multiqueue support was added in QEMU 2.7, the path that would rollback guest notifiers assignment in case of error simply got dropped. Later on, when Error was added to blk_set_aio_context() in QEMU 4.1, another error path was introduced, but it ommits to rollback both host and guest notifiers. It seems cleaner to fix the rollback path in one go. The patch is simple enough that it can be adjusted if backported to a pre-4.1 QEMU. Fixes: 51b04ac5c6a6 ("virtio-blk: dataplane multiqueue support") Cc: stefanha@redhat.com Fixes: 97896a4887a0 ("block: Add Error to blk_set_aio_context()") Cc: kwolf@redhat.com Signed-off-by: Greg Kurz Reviewed-by: Stefan Hajnoczi Message-Id: <20210407143501.244343-2-groug@kaod.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/block/dataplane/virtio-blk.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index e9050c8987..d7b5c95d26 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -207,7 +207,7 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev) virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false); virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i); } - goto fail_guest_notifiers; + goto fail_host_notifiers; } } @@ -221,7 +221,7 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev) aio_context_release(old_context); if (r < 0) { error_report_err(local_err); - goto fail_guest_notifiers; + goto fail_aio_context; } /* Process queued requests before the ones in vring */ @@ -245,6 +245,13 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev) aio_context_release(s->ctx); return 0; + fail_aio_context: + for (i = 0; i < nvqs; i++) { + virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false); + virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i); + } + fail_host_notifiers: + k->set_guest_notifiers(qbus->parent, nvqs, false); fail_guest_notifiers: /* * If we failed to set up the guest notifiers queued requests will be From patchwork Fri May 14 16:04:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1478580 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=P7kv539F; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FhYYC5VHhz9sWk for ; Sat, 15 May 2021 02:15:59 +1000 (AEST) Received: from localhost ([::1]:45216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhaTl-0007nO-LB for incoming@patchwork.ozlabs.org; Fri, 14 May 2021 12:15:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47604) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaIz-0006w3-CE for qemu-devel@nongnu.org; Fri, 14 May 2021 12:04:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24415) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaIv-0005VD-Cf for qemu-devel@nongnu.org; Fri, 14 May 2021 12:04:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621008284; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6a624dvQ4jSjgj/LCoviPdhNQTyYuKtZt78aKXVRxq8=; b=P7kv539FCTRCvv0e0E2tpvr27p4PdcahrbJ8B5Kddh/5UkFvzlhqI5t3xWguBKAjywFhF8 +ID0+JZrX1cqa/52k6JyVKlZ6y6RRC1vbPSWh2zmgqZX5g5e2LMdPw9dHz9EBExanJIKMP cMbvqQBH2YpldSRiZPeWPx6S5wuijYE= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-503-vHfI90gIMuChdFY4LHzlsw-1; Fri, 14 May 2021 12:04:32 -0400 X-MC-Unique: vHfI90gIMuChdFY4LHzlsw-1 Received: by mail-wm1-f71.google.com with SMTP id r10-20020a05600c2c4ab029014b601975e1so1964447wmg.0 for ; Fri, 14 May 2021 09:04:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=6a624dvQ4jSjgj/LCoviPdhNQTyYuKtZt78aKXVRxq8=; b=SUce+s/KHWOR21v74NcFzJuW1uYaSiDNO7uJme8HSyGRNNpAEYUwZTlAFXupEYK6XM XHyfRqTga5PabHWcWn/SUaxYQD7Red59AKCuDoPFkWzroQxRLEHzNM1lXNG0fUtBj7Jb HWuxsLfdF2x+yBxYs2/WvOqjfiYK7wN7oGNzKiHcHDW2i/xIHkHyCPDkCyaClRiwxnz8 4+WHD8X6ZTDA8FKIsJ/3h2dSdfUCu3K8DzPtLhD0Il/wUJkRr1YLvICrDtykitYBVSQi m8YcUBTBtrDkbhDDLvnhUKoIBom01KB7xhH0NnSlRjKZn3Q2Kqee0KWtSCwEqCtuGPhF vxSg== X-Gm-Message-State: AOAM530vVDgfpgi+dbcDJeRsCLtBptZrEsCH6FHgu17MkgbLbuW+SdfW T9frB4JiD2PraLqgpVO8XDElCFpcINRVgmMcYR7u+CJsrnHnZzbAmpHYhWUoa3dQtffOOFzC/QQ NdvF37DOBtCpgCJ/ocby36749aCQnI2wQ5PaZWdaoFctWssLxwSGJI87NxACf X-Received: by 2002:adf:dcc5:: with SMTP id x5mr60791382wrm.1.1621008271454; Fri, 14 May 2021 09:04:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqfqmXSohevGZj3qm6urWV8AT9gZZUbYMHJmEegpW/VFW8Tf2H4GGkeUTpubhwUQn6BY45Tw== X-Received: by 2002:adf:dcc5:: with SMTP id x5mr60791350wrm.1.1621008271230; Fri, 14 May 2021 09:04:31 -0700 (PDT) Received: from redhat.com ([2a10:800c:1fa6:0:3809:fe0c:bb87:250e]) by smtp.gmail.com with ESMTPSA id d9sm6971971wrp.47.2021.05.14.09.04.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 09:04:30 -0700 (PDT) Date: Fri, 14 May 2021 12:04:29 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 09/16] virtio-blk: Configure all host notifiers in a single MR transaction Message-ID: <20210514160245.91918-10-mst@redhat.com> References: <20210514160245.91918-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210514160245.91918-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-block@nongnu.org, Greg Kurz , Max Reitz , Stefan Hajnoczi Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Greg Kurz This allows the virtio-blk-pci device to batch the setup of all its host notifiers. This significantly improves boot time of VMs with a high number of vCPUs, e.g. from 3m26.186s down to 0m58.023s for a pseries machine with 384 vCPUs. Note that memory_region_transaction_commit() must be called before virtio_bus_cleanup_host_notifier() because the latter might close ioeventfds that the transaction still assumes to be around when it commits. Signed-off-by: Greg Kurz Message-Id: <20210407143501.244343-3-groug@kaod.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/block/dataplane/virtio-blk.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index d7b5c95d26..cd81893d1d 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -198,19 +198,30 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev) goto fail_guest_notifiers; } + memory_region_transaction_begin(); + /* Set up virtqueue notify */ for (i = 0; i < nvqs; i++) { r = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, true); if (r != 0) { + int j = i; + fprintf(stderr, "virtio-blk failed to set host notifier (%d)\n", r); while (i--) { virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false); + } + + memory_region_transaction_commit(); + + while (j--) { virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i); } goto fail_host_notifiers; } } + memory_region_transaction_commit(); + s->starting = false; vblk->dataplane_started = true; trace_virtio_blk_data_plane_start(s); @@ -246,8 +257,15 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev) return 0; fail_aio_context: + memory_region_transaction_begin(); + for (i = 0; i < nvqs; i++) { virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false); + } + + memory_region_transaction_commit(); + + for (i = 0; i < nvqs; i++) { virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i); } fail_host_notifiers: @@ -312,8 +330,15 @@ void virtio_blk_data_plane_stop(VirtIODevice *vdev) aio_context_release(s->ctx); + memory_region_transaction_begin(); + for (i = 0; i < nvqs; i++) { virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false); + } + + memory_region_transaction_commit(); + + for (i = 0; i < nvqs; i++) { virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i); } From patchwork Fri May 14 16:04:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1478577 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hspEqsx9; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FhYVp1ZTcz9sWQ for ; Sat, 15 May 2021 02:13:52 +1000 (AEST) Received: from localhost ([::1]:36842 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhaRi-0001Y9-6i for incoming@patchwork.ozlabs.org; Fri, 14 May 2021 12:13:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaIy-0006uh-L7 for qemu-devel@nongnu.org; Fri, 14 May 2021 12:04:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:24975) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaIp-0005Sw-5p for qemu-devel@nongnu.org; Fri, 14 May 2021 12:04:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621008278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=cQaYFC3t+TSH7RoQdf99af99OWcYDg63VhEarxK2SMM=; b=hspEqsx9VB5p0hBHLshbHyeWRUuPd0OP/OVMtvcbr81sB/BpjCKyfCTX6Q28lpHVepI+Dw vHo+EThS7aZJWnk5Hl6n2y9iK/wMzgZkn5UTG5PaCdMA2X+DmgnNChA/zErWbz4b7wKZLV klMAm0mdDnn3PT/83HPKnbJW47aFSM0= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-360-UoCK7IPTPWaZrd3e4qddoA-1; Fri, 14 May 2021 12:04:35 -0400 X-MC-Unique: UoCK7IPTPWaZrd3e4qddoA-1 Received: by mail-wr1-f71.google.com with SMTP id l2-20020adf9f020000b029010d6bb7f1cbso12862121wrf.7 for ; Fri, 14 May 2021 09:04:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=cQaYFC3t+TSH7RoQdf99af99OWcYDg63VhEarxK2SMM=; b=RoBnz+/fqtFWrrV2SznRagTX1aj9sYTJTswXaIx6ZlXJ1zR96NoZeuxAV/Bpq0nLlS NedW9vUwIbWecJiATz628FcO6YPZlyyGCzsoKT+wsAlZv5P/5UU5+V26GhjFn2qX8t3d QlzwaSuRMPF+AOHyvwnpZ5Lpb39PdGZt7CT+DJWoUbddnAb1FA60ZWFiz5eMto+P03Rx KBkmg9ckBW929V6vGmzh+e9lUlvMvsybxwp4YPg3XhRX0PIhdS439NTO1xfYOFvVSBIy xfATp7xmPyzSfjxtMOSeIIPFjYnPJ31aE1pcg1HGSf49LAFpZQvpmpMcr3iokIAGXONP yMvg== X-Gm-Message-State: AOAM531l7CyNo6HZV2+sVsRBT/4E4zmHY1pELmXr+h+wNCp1vQcZ7fM3 VRE/a5yasoqEgHXbU4nbRhnfGyts4dHyyGsYr5efaXnzg4h4Uy1iK29RCXQhrSRMdv2WkHmKzlq mSb+DRrfEhqRlvrLfDt6xwKN27TeIQ+2cI/A4QDNt3UC8WqHaFbzC55/iucss X-Received: by 2002:a7b:c3d6:: with SMTP id t22mr2033533wmj.160.1621008273595; Fri, 14 May 2021 09:04:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyy2LTW0gbcQxexWx0R3Y7q+uPsAM374WCoI3/QEQFE4L8jq4gYmZDD73nARFIbMNJCoBwZMQ== X-Received: by 2002:a7b:c3d6:: with SMTP id t22mr2033507wmj.160.1621008273423; Fri, 14 May 2021 09:04:33 -0700 (PDT) Received: from redhat.com ([2a10:800c:1fa6:0:3809:fe0c:bb87:250e]) by smtp.gmail.com with ESMTPSA id v10sm8142240wrq.0.2021.05.14.09.04.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 09:04:32 -0700 (PDT) Date: Fri, 14 May 2021 12:04:31 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 10/16] virtio-scsi: Set host notifiers and callbacks separately Message-ID: <20210514160245.91918-11-mst@redhat.com> References: <20210514160245.91918-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210514160245.91918-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , Greg Kurz , Stefan Hajnoczi , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Greg Kurz Host notifiers are guaranteed to be idle until the callbacks are hooked up with virtio_queue_aio_set_host_notifier_handler(). They thus don't need to be set or unset with the AioContext lock held. Do this outside the critical section, like virtio-blk already does : basically downgrading virtio_scsi_vring_init() to only setup the host notifier and set the callback in the caller. This will allow to batch addition/deletion of ioeventds in a single memory transaction, which is expected to greatly improve initialization time. Signed-off-by: Greg Kurz Message-Id: <20210407143501.244343-4-groug@kaod.org> Reviewed-by: Stefan Hajnoczi Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/scsi/virtio-scsi-dataplane.c | 40 ++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplane.c index 4ad8793406..b2cb3d9dcc 100644 --- a/hw/scsi/virtio-scsi-dataplane.c +++ b/hw/scsi/virtio-scsi-dataplane.c @@ -94,8 +94,7 @@ static bool virtio_scsi_data_plane_handle_event(VirtIODevice *vdev, return progress; } -static int virtio_scsi_vring_init(VirtIOSCSI *s, VirtQueue *vq, int n, - VirtIOHandleAIOOutput fn) +static int virtio_scsi_set_host_notifier(VirtIOSCSI *s, VirtQueue *vq, int n) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s))); int rc; @@ -109,7 +108,6 @@ static int virtio_scsi_vring_init(VirtIOSCSI *s, VirtQueue *vq, int n, return rc; } - virtio_queue_aio_set_host_notifier_handler(vq, s->ctx, fn); return 0; } @@ -154,38 +152,44 @@ int virtio_scsi_dataplane_start(VirtIODevice *vdev) goto fail_guest_notifiers; } - aio_context_acquire(s->ctx); - rc = virtio_scsi_vring_init(s, vs->ctrl_vq, 0, - virtio_scsi_data_plane_handle_ctrl); - if (rc) { - goto fail_vrings; + rc = virtio_scsi_set_host_notifier(s, vs->ctrl_vq, 0); + if (rc != 0) { + goto fail_host_notifiers; } vq_init_count++; - rc = virtio_scsi_vring_init(s, vs->event_vq, 1, - virtio_scsi_data_plane_handle_event); - if (rc) { - goto fail_vrings; + rc = virtio_scsi_set_host_notifier(s, vs->event_vq, 1); + if (rc != 0) { + goto fail_host_notifiers; } vq_init_count++; + for (i = 0; i < vs->conf.num_queues; i++) { - rc = virtio_scsi_vring_init(s, vs->cmd_vqs[i], i + 2, - virtio_scsi_data_plane_handle_cmd); + rc = virtio_scsi_set_host_notifier(s, vs->cmd_vqs[i], i + 2); if (rc) { - goto fail_vrings; + goto fail_host_notifiers; } vq_init_count++; } + aio_context_acquire(s->ctx); + virtio_queue_aio_set_host_notifier_handler(vs->ctrl_vq, s->ctx, + virtio_scsi_data_plane_handle_ctrl); + virtio_queue_aio_set_host_notifier_handler(vs->event_vq, s->ctx, + virtio_scsi_data_plane_handle_event); + + for (i = 0; i < vs->conf.num_queues; i++) { + virtio_queue_aio_set_host_notifier_handler(vs->cmd_vqs[i], s->ctx, + virtio_scsi_data_plane_handle_cmd); + } + s->dataplane_starting = false; s->dataplane_started = true; aio_context_release(s->ctx); return 0; -fail_vrings: - aio_wait_bh_oneshot(s->ctx, virtio_scsi_dataplane_stop_bh, s); - aio_context_release(s->ctx); +fail_host_notifiers: for (i = 0; i < vq_init_count; i++) { virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false); virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i); From patchwork Fri May 14 16:04:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1478589 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=DPdPj3c0; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FhYps5fYpz9sWW for ; Sat, 15 May 2021 02:27:49 +1000 (AEST) Received: from localhost ([::1]:43640 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhafD-00022C-Qh for incoming@patchwork.ozlabs.org; Fri, 14 May 2021 12:27:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47656) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaJ3-00071V-Iq for qemu-devel@nongnu.org; Fri, 14 May 2021 12:04:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:20951) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaJ1-0005Y3-Jm for qemu-devel@nongnu.org; Fri, 14 May 2021 12:04:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621008290; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/VCUv0qZKb+E+ta3d7/YT9xaI00WSPedF5tOxAexego=; b=DPdPj3c0sLPI3IBTMCx3Mq9BWKLu3oYaibez/2zMV7NxVC6/7FX2GMX+obiWpx8C9zxtQA aezc3Wp3ZEfrM5ecknEuaEk/DmxXtymF1+gbtmYi8QV5Hhe4tBtuqGyEMC/zHMQstnOZ29 PUeHz/5RTYWO7wB9KDFsstg5MC0lU5U= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-8-KwcMEaXLO12fPn2T46FvCg-1; Fri, 14 May 2021 12:04:48 -0400 X-MC-Unique: KwcMEaXLO12fPn2T46FvCg-1 Received: by mail-wm1-f71.google.com with SMTP id n127-20020a1c27850000b02901717a27c785so1234898wmn.9 for ; Fri, 14 May 2021 09:04:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/VCUv0qZKb+E+ta3d7/YT9xaI00WSPedF5tOxAexego=; b=JOksOpTInlcOksvV9lDUOdTQPWaprQXIHj22YQtUmuDiQinaYnHQfzW1PrMdVTXv7Y sSWmURTvMr/3GOJS/CmNJV/hFyUf83iXC8d0mnomsZ2CoSm10UUtxl3UbhgfdcYFiKKT OUc6yU+GoJ6N+9lWmPK/5HC984ri8MKd0UxXMDWGnyE0mbym1ot76Y+4JwiaY/M23DUJ q1pYE45k4B5grjGzRmphUJiuTz7XCrX7QmOb4g9ZwCRMg0gecEz9ji1OjH5UkTYEYmRr DnWFiKajzgJvGVQGYKbkVLe4PdJeIWSRlrPbMPeA+lCAgumzX3TyC+963cgpWTbPYo5s S0gw== X-Gm-Message-State: AOAM531TUlffytVbYcdpOM4T5zVa9NbL07t9Qsjx7l+ON7/Uf3ubQeWs Vyq4wCLBpJwoxlSilNU785AMbdZIXmf+Lzy0FG96GISrq7zgyt2UgLWQt7/Th/sGgphAUYkxPTy kJFZEkxEI6+M2hWZWG6v9eXBkdRo4GEF9ISFAxrh8hTWYdClifnUMkd5F9uw9 X-Received: by 2002:a5d:59a9:: with SMTP id p9mr58319712wrr.289.1621008285854; Fri, 14 May 2021 09:04:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFe5fv45I1cuQo2HnWAXoAQDhZ2FzCFR+N4ARju4DU5JCMojFNnDKE6v4rB5qWvGvj/pVsEw== X-Received: by 2002:a5d:59a9:: with SMTP id p9mr58318971wrr.289.1621008275852; Fri, 14 May 2021 09:04:35 -0700 (PDT) Received: from redhat.com ([2a10:800c:1fa6:0:3809:fe0c:bb87:250e]) by smtp.gmail.com with ESMTPSA id i14sm11822512wmb.33.2021.05.14.09.04.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 09:04:35 -0700 (PDT) Date: Fri, 14 May 2021 12:04:33 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 11/16] virtio-scsi: Configure all host notifiers in a single MR transaction Message-ID: <20210514160245.91918-12-mst@redhat.com> References: <20210514160245.91918-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210514160245.91918-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , Greg Kurz , Stefan Hajnoczi , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Greg Kurz This allows the virtio-scsi-pci device to batch the setup of all its host notifiers. This significantly improves boot time of VMs with a high number of vCPUs, e.g. from 6m5.563s down to 1m2.884s for a pseries machine with 384 vCPUs. Note that memory_region_transaction_commit() must be called before virtio_bus_cleanup_host_notifier() because the latter might close ioeventfds that the transaction still assumes to be around when it commits. Signed-off-by: Greg Kurz Message-Id: <20210407143501.244343-5-groug@kaod.org> Reviewed-by: Stefan Hajnoczi Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/scsi/virtio-scsi-dataplane.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplane.c index b2cb3d9dcc..28e003250a 100644 --- a/hw/scsi/virtio-scsi-dataplane.c +++ b/hw/scsi/virtio-scsi-dataplane.c @@ -152,6 +152,8 @@ int virtio_scsi_dataplane_start(VirtIODevice *vdev) goto fail_guest_notifiers; } + memory_region_transaction_begin(); + rc = virtio_scsi_set_host_notifier(s, vs->ctrl_vq, 0); if (rc != 0) { goto fail_host_notifiers; @@ -173,6 +175,8 @@ int virtio_scsi_dataplane_start(VirtIODevice *vdev) vq_init_count++; } + memory_region_transaction_commit(); + aio_context_acquire(s->ctx); virtio_queue_aio_set_host_notifier_handler(vs->ctrl_vq, s->ctx, virtio_scsi_data_plane_handle_ctrl); @@ -192,6 +196,11 @@ int virtio_scsi_dataplane_start(VirtIODevice *vdev) fail_host_notifiers: for (i = 0; i < vq_init_count; i++) { virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false); + } + + memory_region_transaction_commit(); + + for (i = 0; i < vq_init_count; i++) { virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i); } k->set_guest_notifiers(qbus->parent, vs->conf.num_queues + 2, false); @@ -229,8 +238,15 @@ void virtio_scsi_dataplane_stop(VirtIODevice *vdev) blk_drain_all(); /* ensure there are no in-flight requests */ + memory_region_transaction_begin(); + for (i = 0; i < vs->conf.num_queues + 2; i++) { virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false); + } + + memory_region_transaction_commit(); + + for (i = 0; i < vs->conf.num_queues + 2; i++) { virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i); } From patchwork Fri May 14 16:04:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1478594 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=C/RB3HUR; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FhZ1l5S6Sz9sVb for ; Sat, 15 May 2021 02:37:15 +1000 (AEST) Received: from localhost ([::1]:60716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhaoL-0005wk-Op for incoming@patchwork.ozlabs.org; Fri, 14 May 2021 12:37:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47666) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaJ4-00074v-Rc for qemu-devel@nongnu.org; Fri, 14 May 2021 12:04:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24200) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaJ1-0005Yl-Ox for qemu-devel@nongnu.org; Fri, 14 May 2021 12:04:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621008291; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Mp2jdsNr0uNdTfjJQPypPSs+10AiUaIqMyo8WCovm0s=; b=C/RB3HUR0B1077iYq/rzQJLZr52aPufwckCIUS2xnyXMwkNuYGhfNFVApKHjrk9Cg+WT20 FmlkQP6GBz0DpGq7BgFcCuJ3Yern24pEmFqm8LJW/kstKw+3ngzlKRg1s+9gpRnwpePb5r x+DB7ADWhw/RBtZhINUwNzaMAaNJ8/I= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-311-xvQLSNa-M3-jFeq7qw2YwA-1; Fri, 14 May 2021 12:04:49 -0400 X-MC-Unique: xvQLSNa-M3-jFeq7qw2YwA-1 Received: by mail-wr1-f71.google.com with SMTP id 2-20020adf94020000b0290110481f75ddso1632645wrq.21 for ; Fri, 14 May 2021 09:04:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=Mp2jdsNr0uNdTfjJQPypPSs+10AiUaIqMyo8WCovm0s=; b=W+lqpp5ltkrSdPZIXT6NTujSJ7PbGvRcRD8M+f4sC/O+lRZU2l+gak/sUPQn+RRqEV /gWJ+simwlhgzJVCL9FXNC6kMfKkwUNTm/F0ESF2IkenZ+KNMITXI0Q3uT5ciO8hhuF2 98Ut1wFnr8ayCfMgN0vrAfWq4pw+6vW0RFX138l3KARTaH/AcVzSi15Rwx3a4regR/zN PiSbPl1zc4nySYD4b6e9q7/SONfSxbleLPF40XaEA+/3mMCUTeO+y50o/sPReJJ/ICGT OvQeBXT0O9MrtlsqpgoMYo0Z9OBUCVd3erlhm7exXcj5wXhYVulw6CCH/PvhhItQSQry 0jnA== X-Gm-Message-State: AOAM532OF0ShqYX+8/wOJLZblF3kgiYZaGZ8qeUG+oEr62AtNeqRcYsu ARUfaQe14YvKxHVLBR6sNBP80g1IXT5wLurWS0GeOEZEhkeUtL4/UofboyM5nl66sAdO5FoVxd2 hLz9r4z4G8iNAfP10WqlFsED00eU0AzZV7VB4ZB0cHFXKBIm37QNqkOYC29DF X-Received: by 2002:a05:600c:3510:: with SMTP id h16mr40769800wmq.38.1621008287299; Fri, 14 May 2021 09:04:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkJvoSWPCrpbbkvXZj6Fv0tcBNFGdkbatEfN782X0HEUNi/8kqHa51D97Me+gSa59vk7MLng== X-Received: by 2002:a05:600c:3510:: with SMTP id h16mr40769779wmq.38.1621008287067; Fri, 14 May 2021 09:04:47 -0700 (PDT) Received: from redhat.com ([2a10:800c:1fa6:0:3809:fe0c:bb87:250e]) by smtp.gmail.com with ESMTPSA id r5sm724945wrw.96.2021.05.14.09.04.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 09:04:45 -0700 (PDT) Date: Fri, 14 May 2021 12:04:44 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 12/16] checkpatch: Fix use of uninitialized value Message-ID: <20210514160245.91918-13-mst@redhat.com> References: <20210514160245.91918-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210514160245.91918-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: isaku.yamahata@intel.com, Peter Maydell , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Greg Kurz , Paolo Bonzini , Alex =?utf-8?q?Benn=C3=A9e?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Greg Kurz checkfilename() doesn't always set $acpi_testexpected. Fix the following warning: Use of uninitialized value $acpi_testexpected in string eq at ./scripts/checkpatch.pl line 1529. Fixes: d2f1af0e4120 ("checkpatch: don't emit warning on newly created acpi data files") Cc: isaku.yamahata@intel.com Signed-off-by: Greg Kurz Message-Id: <161786467973.295167.5612704777283969903.stgit@bahia.lan> Reviewed-by: Alex Bennée Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- scripts/checkpatch.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 8f7053ec9b..3d185cceac 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1532,6 +1532,7 @@ sub process { ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ && (defined($1) || defined($2)))) && !(($realfile ne '') && + defined($acpi_testexpected) && ($realfile eq $acpi_testexpected))) { $reported_maintainer_file = 1; WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr); From patchwork Fri May 14 16:04:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1478599 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=EH9uvRse; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FhZ9j2tMkz9sWW for ; Sat, 15 May 2021 02:44:09 +1000 (AEST) Received: from localhost ([::1]:49524 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhav1-0000j3-Cn for incoming@patchwork.ozlabs.org; Fri, 14 May 2021 12:44:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48816) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaM9-0005Qf-Qx for qemu-devel@nongnu.org; Fri, 14 May 2021 12:08:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:56221) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaM7-0007nW-NN for qemu-devel@nongnu.org; Fri, 14 May 2021 12:08:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621008483; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Ujx8Lv1e2caBXYJlzaGddrRWqvv6Yzw+r3izfZzvwQ4=; b=EH9uvRse7D4CxcWzDFl9h7eKKOfIpTeTrt3Mk9i/ebcAZKad6PfvLap7fKPkFccj1SfPJd YigUkplP/gqDAWwShboPwk95QAKdJcrxcC8WDLflE8AkQBpzSDX/sGUkaSEF0yFukTImzi bGfqZP218BaM7AkQrxhgQ1li694e0Ow= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-514-sCedDJuWPbGbvl8Pug13Ow-1; Fri, 14 May 2021 12:04:51 -0400 X-MC-Unique: sCedDJuWPbGbvl8Pug13Ow-1 Received: by mail-wr1-f69.google.com with SMTP id 22-20020adf82960000b02901115ae2f734so25633wrc.5 for ; Fri, 14 May 2021 09:04:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Ujx8Lv1e2caBXYJlzaGddrRWqvv6Yzw+r3izfZzvwQ4=; b=A4w0vcKr6eXF38ZnKWMxri9RR4SW/Ih1PFX0hy2OkzuSC38TJZau8NbNYZ9qLutnZv SYzrtqPhVFzwQmzALJ+9FmiOUAp5MMP/5amKXDksz1XKqTfD18K9aia148WL21mP29up zlg4pH9L6Q/UlB1k4hhxXoS6vFuF91l8Fn3NupJ1xRnSs2QQUVLJ6A6OHgxR4kYds76Y wRjoogjTZRiPoh5nsc0OWbRARCSTcCqB0eUXaVs6iWmKr1hlMR188UHoxlmHowgtarrn w+IPXcnGDfMswCe5v0Pgw9/QBvXtckxa4h4bV1Q3tcmhW2Q7NwwSaYZnp0uop4TQCfOE fPdQ== X-Gm-Message-State: AOAM532ZGvaE5QBKhrTKbnNQlFoz62E3cpcBWCsY8VXEGADXY05FJ+JM z2sjviCulj1P2RXwCOkDGkYOa9ueF5LCFSY7wfhCLhC8GY1akhKYQseqh1L2wKA/uFCyjZyOLYF i8gcU/AGNUNbXx3ZFWgetkcXwp/cjUGqpjnCcfd7ybNM7CIp9ZURRp9yyayab X-Received: by 2002:a05:600c:2cd2:: with SMTP id l18mr27120052wmc.142.1621008289961; Fri, 14 May 2021 09:04:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2cNDNt54eElTU4ntgwAwGv8DLuKVmYlOP9o5OaZ1NyhnwXx1czVBxKeYBHYQO5IP4D8ak+Q== X-Received: by 2002:a05:600c:2cd2:: with SMTP id l18mr27120005wmc.142.1621008289568; Fri, 14 May 2021 09:04:49 -0700 (PDT) Received: from redhat.com ([2a10:800c:1fa6:0:3809:fe0c:bb87:250e]) by smtp.gmail.com with ESMTPSA id p20sm6759987wmq.10.2021.05.14.09.04.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 09:04:49 -0700 (PDT) Date: Fri, 14 May 2021 12:04:47 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 13/16] hw/smbios: support for type 41 (onboard devices extended information) Message-ID: <20210514160245.91918-14-mst@redhat.com> References: <20210514160245.91918-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210514160245.91918-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , Igor Mammedov , Richard Henderson , qemu-arm@nongnu.org, Vincent Bernat , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Vincent Bernat Type 41 defines the attributes of devices that are onboard. The original intent was to imply the BIOS had some level of control over the enablement of the associated devices. If network devices are present in this table, by default, udev will name the corresponding interfaces enoX, X being the instance number. Without such information, udev will fallback to using the PCI ID and this usually gives ens3 or ens4. This can be a bit annoying as the name of the network card may depend on the order of options and may change if a new PCI device is added earlier on the commande line. Being able to provide SMBIOS type 41 entry ensure the name of the interface won't change and helps the user guess the right name without booting a first time. This can be invoked with: $QEMU -netdev user,id=internet -device virtio-net-pci,mac=50:54:00:00:00:42,netdev=internet,id=internet-dev \ -smbios type=41,designation='Onboard LAN',instance=1,kind=ethernet,pcidev=internet-dev The PCI segment is assumed to be 0. This should hold true for most cases. $ dmidecode -t 41 # dmidecode 3.3 Getting SMBIOS data from sysfs. SMBIOS 2.8 present. Handle 0x2900, DMI type 41, 11 bytes Onboard Device Reference Designation: Onboard LAN Type: Ethernet Status: Enabled Type Instance: 1 Bus Address: 0000:00:09.0 $ ip -brief a lo UNKNOWN 127.0.0.1/8 ::1/128 eno1 UP 10.0.2.14/24 fec0::5254:ff:fe00:42/64 fe80::5254:ff:fe00:42/64 Signed-off-by: Vincent Bernat Message-Id: <20210401171138.62970-1-vincent@bernat.ch> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/firmware/smbios.h | 14 +++- hw/arm/virt.c | 7 +- hw/i386/fw_cfg.c | 4 +- hw/smbios/smbios.c | 124 ++++++++++++++++++++++++++++++++++- qemu-options.hx | 30 ++++++++- 5 files changed, 173 insertions(+), 6 deletions(-) diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h index 02a0ced0a0..5a0dd0c8cf 100644 --- a/include/hw/firmware/smbios.h +++ b/include/hw/firmware/smbios.h @@ -258,6 +258,17 @@ struct smbios_type_32 { uint8_t boot_status; } QEMU_PACKED; +/* SMBIOS type 41 - Onboard Devices Extended Information */ +struct smbios_type_41 { + struct smbios_structure_header header; + uint8_t reference_designation_str; + uint8_t device_type; + uint8_t device_type_instance; + uint16_t segment_group_number; + uint8_t bus_number; + uint8_t device_number; +} QEMU_PACKED; + /* SMBIOS type 127 -- End-of-table */ struct smbios_type_127 { struct smbios_structure_header header; @@ -273,5 +284,6 @@ void smbios_get_tables(MachineState *ms, const struct smbios_phys_mem_area *mem_array, const unsigned int mem_array_size, uint8_t **tables, size_t *tables_len, - uint8_t **anchor, size_t *anchor_len); + uint8_t **anchor, size_t *anchor_len, + Error **errp); #endif /* QEMU_SMBIOS_H */ diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 9f01d9041b..26a1e252fe 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -53,6 +53,7 @@ #include "sysemu/kvm.h" #include "hw/loader.h" #include "exec/address-spaces.h" +#include "qapi/error.h" #include "qemu/bitops.h" #include "qemu/error-report.h" #include "qemu/module.h" @@ -1524,8 +1525,10 @@ static void virt_build_smbios(VirtMachineState *vms) vmc->smbios_old_sys_ver ? "1.0" : mc->name, false, true, SMBIOS_ENTRY_POINT_30); - smbios_get_tables(MACHINE(vms), NULL, 0, &smbios_tables, &smbios_tables_len, - &smbios_anchor, &smbios_anchor_len); + smbios_get_tables(MACHINE(vms), NULL, 0, + &smbios_tables, &smbios_tables_len, + &smbios_anchor, &smbios_anchor_len, + &error_fatal); if (smbios_anchor) { fw_cfg_add_file(vms->fw_cfg, "etc/smbios/smbios-tables", diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c index e48a54fa36..4e68d5dea4 100644 --- a/hw/i386/fw_cfg.c +++ b/hw/i386/fw_cfg.c @@ -22,6 +22,7 @@ #include "hw/nvram/fw_cfg.h" #include "e820_memory_layout.h" #include "kvm/kvm_i386.h" +#include "qapi/error.h" #include CONFIG_DEVICES struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX}; @@ -78,7 +79,8 @@ void fw_cfg_build_smbios(MachineState *ms, FWCfgState *fw_cfg) } smbios_get_tables(ms, mem_array, array_count, &smbios_tables, &smbios_tables_len, - &smbios_anchor, &smbios_anchor_len); + &smbios_anchor, &smbios_anchor_len, + &error_fatal); g_free(mem_array); if (smbios_anchor) { diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index f22c4f5b73..7397e56737 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -27,6 +27,7 @@ #include "hw/firmware/smbios.h" #include "hw/loader.h" #include "hw/boards.h" +#include "hw/pci/pci_bus.h" #include "smbios_build.h" /* legacy structures and constants for <= 2.0 machines */ @@ -118,6 +119,28 @@ static struct { uint16_t speed; } type17; +static QEnumLookup type41_kind_lookup = { + .array = (const char *const[]) { + "other", + "unknown", + "video", + "scsi", + "ethernet", + "tokenring", + "sound", + "pata", + "sata", + "sas", + }, + .size = 10 +}; +struct type41_instance { + const char *designation, *pcidev; + uint8_t instance, kind; + QTAILQ_ENTRY(type41_instance) next; +}; +static QTAILQ_HEAD(, type41_instance) type41 = QTAILQ_HEAD_INITIALIZER(type41); + static QemuOptsList qemu_smbios_opts = { .name = "smbios", .head = QTAILQ_HEAD_INITIALIZER(qemu_smbios_opts.head), @@ -358,6 +381,32 @@ static const QemuOptDesc qemu_smbios_type17_opts[] = { { /* end of list */ } }; +static const QemuOptDesc qemu_smbios_type41_opts[] = { + { + .name = "type", + .type = QEMU_OPT_NUMBER, + .help = "SMBIOS element type", + },{ + .name = "designation", + .type = QEMU_OPT_STRING, + .help = "reference designation string", + },{ + .name = "kind", + .type = QEMU_OPT_STRING, + .help = "device type", + .def_value_str = "other", + },{ + .name = "instance", + .type = QEMU_OPT_NUMBER, + .help = "device type instance", + },{ + .name = "pcidev", + .type = QEMU_OPT_STRING, + .help = "PCI device", + }, + { /* end of list */ } +}; + static void smbios_register_config(void) { qemu_add_opts(&qemu_smbios_opts); @@ -773,6 +822,53 @@ static void smbios_build_type_32_table(void) SMBIOS_BUILD_TABLE_POST; } +static void smbios_build_type_41_table(Error **errp) +{ + unsigned instance = 0; + struct type41_instance *t41; + + QTAILQ_FOREACH(t41, &type41, next) { + SMBIOS_BUILD_TABLE_PRE(41, 0x2900 + instance, true); + + SMBIOS_TABLE_SET_STR(41, reference_designation_str, t41->designation); + t->device_type = t41->kind; + t->device_type_instance = t41->instance; + t->segment_group_number = cpu_to_le16(0); + t->bus_number = 0; + t->device_number = 0; + + if (t41->pcidev) { + PCIDevice *pdev = NULL; + int rc = pci_qdev_find_device(t41->pcidev, &pdev); + if (rc != 0) { + error_setg(errp, + "No PCI device %s for SMBIOS type 41 entry %s", + t41->pcidev, t41->designation); + return; + } + /* + * We only handle the case were the device is attached to + * the PCI root bus. The general case is more complex as + * bridges are enumerated later and the table would need + * to be updated at this moment. + */ + if (!pci_bus_is_root(pci_get_bus(pdev))) { + error_setg(errp, + "Cannot create type 41 entry for PCI device %s: " + "not attached to the root bus", + t41->pcidev); + return; + } + t->segment_group_number = cpu_to_le16(0); + t->bus_number = pci_dev_bus_num(pdev); + t->device_number = pdev->devfn; + } + + SMBIOS_BUILD_TABLE_POST; + instance++; + } +} + static void smbios_build_type_127_table(void) { SMBIOS_BUILD_TABLE_PRE(127, 0x7F00, true); /* required */ @@ -883,7 +979,8 @@ void smbios_get_tables(MachineState *ms, const struct smbios_phys_mem_area *mem_array, const unsigned int mem_array_size, uint8_t **tables, size_t *tables_len, - uint8_t **anchor, size_t *anchor_len) + uint8_t **anchor, size_t *anchor_len, + Error **errp) { unsigned i, dimm_cnt; @@ -928,6 +1025,7 @@ void smbios_get_tables(MachineState *ms, smbios_build_type_32_table(); smbios_build_type_38_table(); + smbios_build_type_41_table(errp); smbios_build_type_127_table(); smbios_validate_table(ms); @@ -1224,6 +1322,30 @@ void smbios_entry_add(QemuOpts *opts, Error **errp) save_opt(&type17.part, opts, "part"); type17.speed = qemu_opt_get_number(opts, "speed", 0); return; + case 41: { + struct type41_instance *t; + Error *local_err = NULL; + + if (!qemu_opts_validate(opts, qemu_smbios_type41_opts, errp)) { + return; + } + t = g_new0(struct type41_instance, 1); + save_opt(&t->designation, opts, "designation"); + t->kind = qapi_enum_parse(&type41_kind_lookup, + qemu_opt_get(opts, "kind"), + 0, &local_err) + 1; + t->kind |= 0x80; /* enabled */ + if (local_err != NULL) { + error_propagate(errp, local_err); + g_free(t); + return; + } + t->instance = qemu_opt_get_number(opts, "instance", 1); + save_opt(&t->pcidev, opts, "pcidev"); + + QTAILQ_INSERT_TAIL(&type41, t, next); + return; + } default: error_setg(errp, "Don't know how to build fields for SMBIOS type %ld", diff --git a/qemu-options.hx b/qemu-options.hx index fd21002bd6..f71f716aa0 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2370,7 +2370,9 @@ DEF("smbios", HAS_ARG, QEMU_OPTION_smbios, " specify SMBIOS type 11 fields\n" "-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str]\n" " [,asset=str][,part=str][,speed=%d]\n" - " specify SMBIOS type 17 fields\n", + " specify SMBIOS type 17 fields\n" + "-smbios type=41[,designation=str][,kind=str][,instance=%d][,pcidev=str]\n" + " specify SMBIOS type 41 fields\n", QEMU_ARCH_I386 | QEMU_ARCH_ARM) SRST ``-smbios file=binary`` @@ -2432,6 +2434,32 @@ SRST ``-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str][,asset=str][,part=str][,speed=%d]`` Specify SMBIOS type 17 fields + +``-smbios type=41[,designation=str][,kind=str][,instance=%d][,pcidev=str]`` + Specify SMBIOS type 41 fields + + This argument can be repeated multiple times. Its main use is to allow network interfaces be created + as ``enoX`` on Linux, with X being the instance number, instead of the name depending on the interface + position on the PCI bus. + + Here is an example of use: + + .. parsed-literal:: + + -netdev user,id=internet \\ + -device virtio-net-pci,mac=50:54:00:00:00:42,netdev=internet,id=internet-dev \\ + -smbios type=41,designation='Onboard LAN',instance=1,kind=ethernet,pcidev=internet-dev + + In the guest OS, the device should then appear as ``eno1``: + + ..parsed-literal:: + + $ ip -brief l + lo UNKNOWN 00:00:00:00:00:00 + eno1 UP 50:54:00:00:00:42 + + Currently, the PCI device has to be attached to the root bus. + ERST DEFHEADING() From patchwork Fri May 14 16:04:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1478576 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gkKkXOu9; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FhYVp1cQ8z9sWY for ; Sat, 15 May 2021 02:13:52 +1000 (AEST) Received: from localhost ([::1]:36796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhaRh-0001WK-CK for incoming@patchwork.ozlabs.org; Fri, 14 May 2021 12:13:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48638) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaLc-000478-Fm for qemu-devel@nongnu.org; Fri, 14 May 2021 12:07:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:43097) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaLa-0007Vz-Qk for qemu-devel@nongnu.org; Fri, 14 May 2021 12:07:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621008450; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=z6/vEA+i4paY/RqNIqLBRDb+FPp4ZLN89GOA4Mb7wvk=; b=gkKkXOu9Y2hSYeqn+USOSVJ5VGGnabBtT17l92B/vfrqavwr5BhBo7ZOxIKgCez+NrCoLo 5M1f7Juf1Fde93KRtbGiZo0AWSxYLCqgKM1UbooJD8TGC/amq9q0WqVqJQcNxhD5tXcfzR +CONxowTplCnfthRwVLYYMgxbXrRREU= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-431-12Htccp1MuOt9ETnfpVf7g-1; Fri, 14 May 2021 12:04:53 -0400 X-MC-Unique: 12Htccp1MuOt9ETnfpVf7g-1 Received: by mail-wr1-f69.google.com with SMTP id u5-20020adf9e050000b029010df603f280so12879046wre.18 for ; Fri, 14 May 2021 09:04:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=z6/vEA+i4paY/RqNIqLBRDb+FPp4ZLN89GOA4Mb7wvk=; b=Z1pCTK/vgRyDyLyX/IhvGSqhP+1UfNFv1S+BiZRRt9m/WHAiwyHtBeuh9ZZYaTdRvF +/0qZ75alZF9DYDzHFr5qyWCIhW0kJTHbrhE3QGdnn27RwSRG9f1kPJIp3f3z1MXnWq2 kypgZWAHWl7oL9jCEe0t+MrK+Z6Fpa5eI0o/f/abVLl4liTdolcHRH/pbLbnLbS3EhoX ZmOuFxYWIVpRZbxy1EAvT943X3ELpk2GsiCXuwCzzCpUK2LmDJe4NvJdDf4LDC/6aIML vSE7OhsyT3oMEMtcImj+Q1AuyelaeIDhWJxqOS3kr9go8CHcEID18zXyxRX4iZBjxbiM nXdA== X-Gm-Message-State: AOAM533A5CMfYHnfZI97+xNyblw6w1KQXFw3fy34Crf+eUH3/U2aNED0 RstNCY89W/Y7PY9rl9UYd1nsQdVtRwQSsWJdFdpFoo+wi74faSixnau5rOPZYQlVeWQDgf3pOMA 6N4Fnzw6vBor5D6hmbfGWEmXSgfsr62+byqN08UhrRqy791JQdVX+Jnzbu/9t X-Received: by 2002:a05:600c:4242:: with SMTP id r2mr10201879wmm.140.1621008291772; Fri, 14 May 2021 09:04:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYMaCFp5aqbB1qgSRfBidcZarQcXNaQr+bDAhPwmGCuTuVzWj18bWy1bBuRLuww81O55RTzA== X-Received: by 2002:a05:600c:4242:: with SMTP id r2mr10201862wmm.140.1621008291589; Fri, 14 May 2021 09:04:51 -0700 (PDT) Received: from redhat.com ([2a10:800c:1fa6:0:3809:fe0c:bb87:250e]) by smtp.gmail.com with ESMTPSA id h15sm5494541wmq.4.2021.05.14.09.04.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 09:04:51 -0700 (PDT) Date: Fri, 14 May 2021 12:04:49 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 14/16] hw/virtio: enable ioeventfd configuring for mmio Message-ID: <20210514160245.91918-15-mst@redhat.com> References: <20210514160245.91918-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210514160245.91918-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Pavel Dovgalyuk Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Pavel Dovgalyuk This patch adds ioeventfd flag for virtio-mmio configuration. It allows switching ioeventfd on and off. Signed-off-by: Pavel Dovgalyuk Message-Id: <161700379211.1135943.8859209566937991305.stgit@pasha-ThinkPad-X280> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/virtio-mmio.h | 5 +++++ hw/virtio/virtio-mmio.c | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/hw/virtio/virtio-mmio.h b/include/hw/virtio/virtio-mmio.h index d4c4c386ab..090f7730e7 100644 --- a/include/hw/virtio/virtio-mmio.h +++ b/include/hw/virtio/virtio-mmio.h @@ -49,12 +49,17 @@ typedef struct VirtIOMMIOQueue { uint32_t used[2]; } VirtIOMMIOQueue; +#define VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT 1 +#define VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD \ + (1 << VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT) + struct VirtIOMMIOProxy { /* Generic */ SysBusDevice parent_obj; MemoryRegion iomem; qemu_irq irq; bool legacy; + uint32_t flags; /* Guest accessible state needing migration and reset */ uint32_t host_features_sel; uint32_t guest_features_sel; diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c index 342c918ea7..5952471b38 100644 --- a/hw/virtio/virtio-mmio.c +++ b/hw/virtio/virtio-mmio.c @@ -36,7 +36,9 @@ static bool virtio_mmio_ioeventfd_enabled(DeviceState *d) { - return kvm_eventfds_enabled(); + VirtIOMMIOProxy *proxy = VIRTIO_MMIO(d); + + return (proxy->flags & VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD) != 0; } static int virtio_mmio_ioeventfd_assign(DeviceState *d, @@ -720,6 +722,8 @@ static Property virtio_mmio_properties[] = { DEFINE_PROP_BOOL("format_transport_address", VirtIOMMIOProxy, format_transport_address, true), DEFINE_PROP_BOOL("force-legacy", VirtIOMMIOProxy, legacy, true), + DEFINE_PROP_BIT("ioeventfd", VirtIOMMIOProxy, flags, + VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT, true), DEFINE_PROP_END_OF_LIST(), }; @@ -731,6 +735,11 @@ static void virtio_mmio_realizefn(DeviceState *d, Error **errp) qbus_create_inplace(&proxy->bus, sizeof(proxy->bus), TYPE_VIRTIO_MMIO_BUS, d, NULL); sysbus_init_irq(sbd, &proxy->irq); + + if (!kvm_eventfds_enabled()) { + proxy->flags &= ~VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD; + } + if (proxy->legacy) { memory_region_init_io(&proxy->iomem, OBJECT(d), &virtio_legacy_mem_ops, proxy, From patchwork Fri May 14 16:04:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1478581 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=EF97fAw4; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FhYcz6RZhz9sVt for ; Sat, 15 May 2021 02:19:14 +1000 (AEST) Received: from localhost ([::1]:54206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhaWs-0005xW-Tx for incoming@patchwork.ozlabs.org; Fri, 14 May 2021 12:19:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47698) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaJB-0007Qw-4l for qemu-devel@nongnu.org; Fri, 14 May 2021 12:05:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:25133) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaJ9-0005ei-7Y for qemu-devel@nongnu.org; Fri, 14 May 2021 12:05:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621008298; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vnhVXVRJO7yDWeWARdc2oQopicnGk45iiCjyrv6W8TM=; b=EF97fAw4NJnyGdqBsnytWiRpTPhqiKqjpqrkC30GtQJm5VwEhj4im4Hog38Of5t8qA8lyG xZaoD9EryUz8d4x1DLvX1PV5khasaKOz7SelrNFR9D5g3fbBTbPME13TmfrMfi/OjWLJRS caBYy7BKI1Pm4emZHf+ymgFRTeO8U84= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-234-Uen13_bDMyim8WRLAa9Qng-1; Fri, 14 May 2021 12:04:56 -0400 X-MC-Unique: Uen13_bDMyim8WRLAa9Qng-1 Received: by mail-wr1-f72.google.com with SMTP id t5-20020adfb7c50000b029010dd0bb24cfso12887716wre.2 for ; Fri, 14 May 2021 09:04:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=vnhVXVRJO7yDWeWARdc2oQopicnGk45iiCjyrv6W8TM=; b=QwTegmM2sZX0m8qKxYmfnuBCBYFpSvjWspMhm/GlPweWS3xSYQoDsDrx7xombpahZg /CxJPe+WsEK5mB70KQcPIJItreRJMX2RAuB1BtHCjg3X/W/0YZy+XNAPGsX7i003+aAd L37UmAgZh/VGtNLT7EskH750tveVva5Gslhxc2XCF0FpjV+e+nnxdHSzlivJgGdkQWTo vN1eN2J3DGoV+V9TE+/EoHe9LgZRM16NZlo++6OZu3Y2gTIjgA0x1vcX5ud/+wClJTar 34ztRjfBj7pHuXyWsRUc6yBswaLLRnWXhB2JFMmsH1fQWud4EovrU9TxsiYPw5afv3M/ SuIA== X-Gm-Message-State: AOAM531sWtxz89Zuir31LeHTaQjCQusxjwV/KfqzVSb0DWOUxQ/e3m2/ iFkwug11CBgOSHxEO9h1g2gwFAJ/O89tIYN6/gbVgCylnaaIJ4hYcvqGSUiWv/ac8j++e646zO1 FqGXp9mdCWSb7dOfeIjoVHgJTixlSkUb8L4HU7KOyg8i/w4FgXBvsbnwpvEqE X-Received: by 2002:a1c:9d83:: with SMTP id g125mr1988556wme.179.1621008295038; Fri, 14 May 2021 09:04:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhtIVNEyWEGY2t4BxlyahnNt3rapHCTbH44+Pk+4j7Ac+F1KxjCK6T2MvBP4d4kPqBl9Yn6Q== X-Received: by 2002:a1c:9d83:: with SMTP id g125mr1988533wme.179.1621008294815; Fri, 14 May 2021 09:04:54 -0700 (PDT) Received: from redhat.com ([2a10:800c:1fa6:0:3809:fe0c:bb87:250e]) by smtp.gmail.com with ESMTPSA id g19sm5683585wme.48.2021.05.14.09.04.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 09:04:54 -0700 (PDT) Date: Fri, 14 May 2021 12:04:51 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 15/16] vhost-vdpa: Make vhost_vdpa_get_device_id() static Message-ID: <20210514160245.91918-16-mst@redhat.com> References: <20210514160245.91918-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210514160245.91918-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zenghui Yu , Peter Maydell , Philippe =?utf-8?q?Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Stefano Garzarella Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Zenghui Yu As it's only used inside hw/virtio/vhost-vdpa.c. Signed-off-by: Zenghui Yu Message-Id: <20210413133737.1574-1-yuzenghui@huawei.com> Reviewed-by: Stefano Garzarella Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost-vdpa.h | 2 -- hw/virtio/vhost-vdpa.c | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h index 9b81a409da..28ca65018e 100644 --- a/include/hw/virtio/vhost-vdpa.h +++ b/include/hw/virtio/vhost-vdpa.h @@ -22,6 +22,4 @@ typedef struct vhost_vdpa { } VhostVDPA; extern AddressSpace address_space_memory; -extern int vhost_vdpa_get_device_id(struct vhost_dev *dev, - uint32_t *device_id); #endif diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 01d2101d09..8f2fb9f10b 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -371,8 +371,8 @@ static int vhost_vdpa_set_backend_cap(struct vhost_dev *dev) return 0; } -int vhost_vdpa_get_device_id(struct vhost_dev *dev, - uint32_t *device_id) +static int vhost_vdpa_get_device_id(struct vhost_dev *dev, + uint32_t *device_id) { int ret; ret = vhost_vdpa_call(dev, VHOST_VDPA_GET_DEVICE_ID, device_id); From patchwork Fri May 14 16:04:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1478592 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Kf/R6g8M; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FhZ0H53jrz9sVb for ; Sat, 15 May 2021 02:35:59 +1000 (AEST) Received: from localhost ([::1]:56478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhan6-00031c-Cy for incoming@patchwork.ozlabs.org; Fri, 14 May 2021 12:35:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48902) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaMJ-0005XR-QO for qemu-devel@nongnu.org; Fri, 14 May 2021 12:08:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:42697) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhaME-0007rJ-Uh for qemu-devel@nongnu.org; Fri, 14 May 2021 12:08:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621008490; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LxjtdzbPa/ql+N+GGzHz8d9IgsKkLlFWnOvUnsNIB/I=; b=Kf/R6g8MX0AsFv85Y8dD9DW0jVYIQoJO2LddaeFPNTnkar/OINq2v5Xa5/FgX3iHTWJkwk ct4Cx8NmWJhsdQfMmQnlkeWJljk37VU2ZtMXg+pvnIfXCwfnAhAtgt6OxypKgY0trHn3O9 /Cq1JsSo/gWtWZ2+t9Dig4liT5/sL10= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-59-rAqBwlAoOdSYEYDByLqGOw-1; Fri, 14 May 2021 12:04:59 -0400 X-MC-Unique: rAqBwlAoOdSYEYDByLqGOw-1 Received: by mail-wm1-f70.google.com with SMTP id c138-20020a1c9a900000b0290173dd9788cdso243637wme.4 for ; Fri, 14 May 2021 09:04:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=LxjtdzbPa/ql+N+GGzHz8d9IgsKkLlFWnOvUnsNIB/I=; b=YrFyTyHa8bEcRaBkGw59n4qtQWzdpoH+iYYs7lQGpvxe33NBzz6zqGjp/TDCAtQ+aT B+0Lb9YoSlbiAGoMQdxn7ILtRU1hT2RWy7/nMBDYZIu9gROjBxEBqKJT/BDvioh3r75U euiOicOwoZWXLcLhiUuiKpjIcGB6Ftw4SLbES/w7WJUxY0V829JkmS7kKvHLrncnipYO Lg9549u1OmX0yWypyj/Q7Ne9Qhl7KvxhPmI1R3hgdC6NYpq5Gxa7gmfJdCzyCW4Byb4I kAZ1pSnGIa9N1NgrRf3NuWv37tHJ3Htq5HNqcuOGVD2vYOttoIwNT6LFCtImAZXP7gbk NOcQ== X-Gm-Message-State: AOAM532q22xLIz5KrhEBGv8FJHken+ei1qdknDqUrtscx7ha9EaN+LIM OBsu96oL7eFX03SXalt3p2wE6D3WGxrmzM0s7X+agkOSYYtjfa5mc1laPpZtMZ6rv8ik+y1u4US 474BQKRkugB8GL4A/9Q8NXFAYX39iQyqMukhoWFQm1SMR6dSqcsziow/SGn9D X-Received: by 2002:adf:f683:: with SMTP id v3mr58638839wrp.133.1621008297487; Fri, 14 May 2021 09:04:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqPK8Tz3J3YG3eMoZzCGmUybo/No3UvZK78q2mMaGdRqIZig/7/b0c/fxR0pl1EDKC8o/dRg== X-Received: by 2002:adf:f683:: with SMTP id v3mr58638786wrp.133.1621008296946; Fri, 14 May 2021 09:04:56 -0700 (PDT) Received: from redhat.com ([2a10:800c:1fa6:0:3809:fe0c:bb87:250e]) by smtp.gmail.com with ESMTPSA id s5sm5731821wrw.95.2021.05.14.09.04.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 09:04:56 -0700 (PDT) Date: Fri, 14 May 2021 12:04:55 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 16/16] Fix build with 64 bits time_t Message-ID: <20210514160245.91918-17-mst@redhat.com> References: <20210514160245.91918-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210514160245.91918-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Fabrice Fontaine , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Fabrice Fontaine time element is deprecated on new input_event structure in kernel's input.h [1] This will avoid the following build failure: hw/input/virtio-input-host.c: In function 'virtio_input_host_handle_status': hw/input/virtio-input-host.c:198:28: error: 'struct input_event' has no member named 'time' 198 | if (gettimeofday(&evdev.time, NULL)) { | ^ Fixes: - http://autobuild.buildroot.org/results/a538167e288c14208d557cd45446df86d3d599d5 - http://autobuild.buildroot.org/results/efd4474fb4b6c0ce0ab3838ce130429c51e43bbb [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=152194fe9c3f Signed-off-by: Fabrice Fontaine Message-Id: <20201203195819.583626-1-fontaine.fabrice@gmail.com> Fixes: https://gitlab.com/qemu-project/qemu/-/issues/246 Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- contrib/vhost-user-input/main.c | 8 ++++++-- hw/input/virtio-input-host.c | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/contrib/vhost-user-input/main.c b/contrib/vhost-user-input/main.c index c15d18c33f..081230da54 100644 --- a/contrib/vhost-user-input/main.c +++ b/contrib/vhost-user-input/main.c @@ -6,12 +6,13 @@ #include "qemu/osdep.h" -#include +#include #include "qemu/iov.h" #include "qemu/bswap.h" #include "qemu/sockets.h" #include "libvhost-user-glib.h" +#include "standard-headers/linux/input.h" #include "standard-headers/linux/virtio_input.h" #include "qapi/error.h" @@ -113,13 +114,16 @@ vi_evdev_watch(VuDev *dev, int condition, void *data) static void vi_handle_status(VuInput *vi, virtio_input_event *event) { struct input_event evdev; + struct timeval tval; int rc; - if (gettimeofday(&evdev.time, NULL)) { + if (gettimeofday(&tval, NULL)) { perror("vi_handle_status: gettimeofday"); return; } + evdev.input_event_sec = tval.tv_sec; + evdev.input_event_usec = tval.tv_usec; evdev.type = le16toh(event->type); evdev.code = le16toh(event->code); evdev.value = le32toh(event->value); diff --git a/hw/input/virtio-input-host.c b/hw/input/virtio-input-host.c index 85daf73f1a..137efba57b 100644 --- a/hw/input/virtio-input-host.c +++ b/hw/input/virtio-input-host.c @@ -193,13 +193,16 @@ static void virtio_input_host_handle_status(VirtIOInput *vinput, { VirtIOInputHost *vih = VIRTIO_INPUT_HOST(vinput); struct input_event evdev; + struct timeval tval; int rc; - if (gettimeofday(&evdev.time, NULL)) { + if (gettimeofday(&tval, NULL)) { perror("virtio_input_host_handle_status: gettimeofday"); return; } + evdev.input_event_sec = tval.tv_sec; + evdev.input_event_usec = tval.tv_usec; evdev.type = le16_to_cpu(event->type); evdev.code = le16_to_cpu(event->code); evdev.value = le32_to_cpu(event->value);