From nobody Sat May 18 23:14:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579763550; cv=none; d=zohomail.com; s=zohoarc; b=MkaQFt5DgbpjxhoAgAiv7erTMu/4NVIz46+i+s4tHwAtPP1Oaekcn/GGw9hOuoWJzgn5sc7RapDyTmCmq2BwfgTytKQjmlwIvd8+mEPaO4wwyX9gtFjf69HineL4MFB8fAiM7E0uBjs0B4+6M0u2+ZadUMg5xg5VrV8P9TEmO7s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579763550; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Kg8dkgToII+17yCLdud4DGcpR3GxCmqyAmpoGaHxRIE=; b=lx1iCWNghe0LdPMK+nmM16wk2s4pYzPJNnMvxjz4UNtiqg8i+YAhMcixKcwhSQOsc2jqUh4OMnwhcQ0Ose0KJPWhCNRtgBfx7OHqcjlxOWC0HtiUmsgsPZqCLzWFi18ZZgLxYwrCQpyyx0HnuPl4NbjWt8tLGtwK9YrBjZmqKUo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579763550908193.8313885721965; Wed, 22 Jan 2020 23:12:30 -0800 (PST) Received: from localhost ([::1]:52043 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWfD-0007Wd-Cj for importer@patchew.org; Thu, 23 Jan 2020 02:12:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37164) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWd8-0005du-6O for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iuWd5-0007k2-8Z for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:18 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:37086 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iuWd5-0007jc-41 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:15 -0500 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-247-KQ1I_UFFNJCrDg5odpw-bQ-1; Thu, 23 Jan 2020 02:10:13 -0500 Received: by mail-wm1-f71.google.com with SMTP id s25so246341wmj.3 for ; Wed, 22 Jan 2020 23:10:12 -0800 (PST) Received: from redhat.com (bzq-79-176-0-156.red.bezeqint.net. [79.176.0.156]) by smtp.gmail.com with ESMTPSA id l3sm1838822wrt.29.2020.01.22.23.10.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 23:10:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579763414; 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=Kg8dkgToII+17yCLdud4DGcpR3GxCmqyAmpoGaHxRIE=; b=EqmlFwdr6DDwz6H7PI6OOgX7KHz9iOKVc0Sv1i+3jv+y5fIqSk6jnujksMncGzPU2x7qkU /lRGbPwvicUqw6yybpgK6yPVrOXtETtUmBTGXxkmUpMvUcVyO9ub2yhL/CqIqpOAYRQOy2 2TQjxmlwYg9G/5DuzUrvUyjhpekkVCU= 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=SZlgsbuRexepbyzGOJZSIRK1RX+EEBHf43p6wbErIqU=; b=npMedmvdcjwPeKsnqoziAp3wDGt+PijaYvrPOGjvlJo6i72J4ijpzfU3ntlDVp+wy3 otqhQZG/EcbZe1hdKKbmEXFbE46vMPL9Mex0P+iyMsl12C92Y5zRkUoX6NNmObKSKX/7 iBzbYVlXz4t+3RP/MBNYsgpRKMxGD0JeRIUy/QY5Iv+cKIQpIAxI3nvSoUQBJGJPWAIB 3bVmBLUSWprqQqrARJKtPGfiJa64ZhYgyI7wj/NCxdz6/+GQJJpen/OfLA3XUNG9zmac GmA1vVAUr1QXfrsCICgVieWV9lQWxiPtVCNJDAmuAZnljbYSBpCropsEbSqGXOI4tovR yKdA== X-Gm-Message-State: APjAAAXYTJuPnORbgJI2socn7VzkTmYGd24dQfWnr4t+zxGfJhY486P+ qJJE7EXgCW0vXgbIt/KmXXIj1x7XpTqtqPtVTq95ObJb7CF+9MtYG+NiQJa/49rvb8kGXvE8Au/ nOOEqtgNM6tverd0= X-Received: by 2002:a5d:6441:: with SMTP id d1mr15326423wrw.93.1579763411470; Wed, 22 Jan 2020 23:10:11 -0800 (PST) X-Google-Smtp-Source: APXvYqxy8rMxhUh4AJ7Qgy4YRfRynLNh5q3YUb5SsoSZS/n978QVvswMjMFdzO+BHqI3gvDtpp5/iQ== X-Received: by 2002:a5d:6441:: with SMTP id d1mr15326386wrw.93.1579763411118; Wed, 22 Jan 2020 23:10:11 -0800 (PST) Date: Thu, 23 Jan 2020 02:10:08 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v3 01/18] q35: implement 128K SMRAM at default SMBASE address Message-ID: <20200123070913.626488-2-mst@redhat.com> References: <20200123070913.626488-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200123070913.626488-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-MC-Unique: KQ1I_UFFNJCrDg5odpw-bQ-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 207.211.31.120 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 , Paolo Bonzini , Laszlo Ersek , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Igor Mammedov It's not what real HW does, implementing which would be overkill [**] and would require complex cross stack changes (QEMU+firmware) to make it work. So considering that SMRAM is owned by MCH, for simplicity (ab)use reserved Q35 register, which allows QEMU and firmware easily init and make RAM at SMBASE available only from SMM context. Patch uses commit (2f295167e0 q35/mch: implement extended TSEG sizes) for inspiration and uses reserved register in config space at 0x9c offset [*] to extend q35 pci-host with ability to use 128K at 0x30000 as SMRAM and hide it (like TSEG) from non-SMM context. Usage: 1: write 0xff in the register 2: if the feature is supported, follow up read from the register should return 0x01. At this point RAM at 0x30000 is still available for SMI handler configuration from non-SMM context 3: writing 0x02 in the register, locks SMBASE area, making its contents available only from SMM context. In non-SMM context, reads return 0xff and writes are ignored. Further writes into the register are ignored until the system reset. *) https://www.mail-archive.com/qemu-devel@nongnu.org/msg455991.html **) https://www.mail-archive.com/qemu-devel@nongnu.org/msg646965.html Signed-off-by: Igor Mammedov Message-Id: <1575896942-331151-3-git-send-email-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Tested-by: Laszlo Ersek --- include/hw/pci-host/q35.h | 10 +++++ hw/i386/pc.c | 4 +- hw/pci-host/q35.c | 84 +++++++++++++++++++++++++++++++++++---- 3 files changed, 90 insertions(+), 8 deletions(-) diff --git a/include/hw/pci-host/q35.h b/include/hw/pci-host/q35.h index b3bcf2e632..976fbae599 100644 --- a/include/hw/pci-host/q35.h +++ b/include/hw/pci-host/q35.h @@ -32,6 +32,7 @@ #include "hw/acpi/ich9.h" #include "hw/pci-host/pam.h" #include "hw/i386/intel_iommu.h" +#include "qemu/units.h" =20 #define TYPE_Q35_HOST_DEVICE "q35-pcihost" #define Q35_HOST_DEVICE(obj) \ @@ -54,6 +55,8 @@ typedef struct MCHPCIState { MemoryRegion smram_region, open_high_smram; MemoryRegion smram, low_smram, high_smram; MemoryRegion tseg_blackhole, tseg_window; + MemoryRegion smbase_blackhole, smbase_window; + bool has_smram_at_smbase; Range pci_hole; uint64_t below_4g_mem_size; uint64_t above_4g_mem_size; @@ -97,6 +100,13 @@ typedef struct Q35PCIHost { #define MCH_HOST_BRIDGE_EXT_TSEG_MBYTES_QUERY 0xffff #define MCH_HOST_BRIDGE_EXT_TSEG_MBYTES_MAX 0xfff =20 +#define MCH_HOST_BRIDGE_SMBASE_SIZE (128 * KiB) +#define MCH_HOST_BRIDGE_SMBASE_ADDR 0x30000 +#define MCH_HOST_BRIDGE_F_SMBASE 0x9c +#define MCH_HOST_BRIDGE_F_SMBASE_QUERY 0xff +#define MCH_HOST_BRIDGE_F_SMBASE_IN_RAM 0x01 +#define MCH_HOST_BRIDGE_F_SMBASE_LCK 0x02 + #define MCH_HOST_BRIDGE_PCIEXBAR 0x60 /* 64bit register */ #define MCH_HOST_BRIDGE_PCIEXBAR_SIZE 8 /* 64bit register */ #define MCH_HOST_BRIDGE_PCIEXBAR_DEFAULT 0xb0000000 diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 8054bc4147..a6302a772d 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -93,7 +93,9 @@ #include "fw_cfg.h" #include "trace.h" =20 -GlobalProperty pc_compat_4_2[] =3D {}; +GlobalProperty pc_compat_4_2[] =3D { + { "mch", "smbase-smram", "off" }, +}; const size_t pc_compat_4_2_len =3D G_N_ELEMENTS(pc_compat_4_2); =20 GlobalProperty pc_compat_4_1[] =3D {}; diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index 158d270b9f..6342f73b9f 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -275,20 +275,20 @@ static const TypeInfo q35_host_info =3D { * MCH D0:F0 */ =20 -static uint64_t tseg_blackhole_read(void *ptr, hwaddr reg, unsigned size) +static uint64_t blackhole_read(void *ptr, hwaddr reg, unsigned size) { return 0xffffffff; } =20 -static void tseg_blackhole_write(void *opaque, hwaddr addr, uint64_t val, - unsigned width) +static void blackhole_write(void *opaque, hwaddr addr, uint64_t val, + unsigned width) { /* nothing */ } =20 -static const MemoryRegionOps tseg_blackhole_ops =3D { - .read =3D tseg_blackhole_read, - .write =3D tseg_blackhole_write, +static const MemoryRegionOps blackhole_ops =3D { + .read =3D blackhole_read, + .write =3D blackhole_write, .endianness =3D DEVICE_NATIVE_ENDIAN, .valid.min_access_size =3D 1, .valid.max_access_size =3D 4, @@ -430,6 +430,46 @@ static void mch_update_ext_tseg_mbytes(MCHPCIState *mc= h) } } =20 +static void mch_update_smbase_smram(MCHPCIState *mch) +{ + PCIDevice *pd =3D PCI_DEVICE(mch); + uint8_t *reg =3D pd->config + MCH_HOST_BRIDGE_F_SMBASE; + bool lck; + + if (!mch->has_smram_at_smbase) { + return; + } + + if (*reg =3D=3D MCH_HOST_BRIDGE_F_SMBASE_QUERY) { + pd->wmask[MCH_HOST_BRIDGE_F_SMBASE] =3D + MCH_HOST_BRIDGE_F_SMBASE_LCK; + *reg =3D MCH_HOST_BRIDGE_F_SMBASE_IN_RAM; + return; + } + + /* + * default/reset state, discard written value + * which will disable SMRAM balackhole at SMBASE + */ + if (pd->wmask[MCH_HOST_BRIDGE_F_SMBASE] =3D=3D 0xff) { + *reg =3D 0x00; + } + + memory_region_transaction_begin(); + if (*reg & MCH_HOST_BRIDGE_F_SMBASE_LCK) { + /* disable all writes */ + pd->wmask[MCH_HOST_BRIDGE_F_SMBASE] &=3D + ~MCH_HOST_BRIDGE_F_SMBASE_LCK; + *reg =3D MCH_HOST_BRIDGE_F_SMBASE_LCK; + lck =3D true; + } else { + lck =3D false; + } + memory_region_set_enabled(&mch->smbase_blackhole, lck); + memory_region_set_enabled(&mch->smbase_window, lck); + memory_region_transaction_commit(); +} + static void mch_write_config(PCIDevice *d, uint32_t address, uint32_t val, int len) { @@ -456,6 +496,10 @@ static void mch_write_config(PCIDevice *d, MCH_HOST_BRIDGE_EXT_TSEG_MBYTES_SIZE)) { mch_update_ext_tseg_mbytes(mch); } + + if (ranges_overlap(address, len, MCH_HOST_BRIDGE_F_SMBASE, 1)) { + mch_update_smbase_smram(mch); + } } =20 static void mch_update(MCHPCIState *mch) @@ -464,6 +508,7 @@ static void mch_update(MCHPCIState *mch) mch_update_pam(mch); mch_update_smram(mch); mch_update_ext_tseg_mbytes(mch); + mch_update_smbase_smram(mch); =20 /* * pci hole goes from end-of-low-ram to io-apic. @@ -514,6 +559,9 @@ static void mch_reset(DeviceState *qdev) MCH_HOST_BRIDGE_EXT_TSEG_MBYTES_QUERY); } =20 + d->config[MCH_HOST_BRIDGE_F_SMBASE] =3D 0; + d->wmask[MCH_HOST_BRIDGE_F_SMBASE] =3D 0xff; + mch_update(mch); } =20 @@ -563,7 +611,7 @@ static void mch_realize(PCIDevice *d, Error **errp) memory_region_add_subregion(&mch->smram, 0xfeda0000, &mch->high_smram); =20 memory_region_init_io(&mch->tseg_blackhole, OBJECT(mch), - &tseg_blackhole_ops, NULL, + &blackhole_ops, NULL, "tseg-blackhole", 0); memory_region_set_enabled(&mch->tseg_blackhole, false); memory_region_add_subregion_overlap(mch->system_memory, @@ -575,6 +623,27 @@ static void mch_realize(PCIDevice *d, Error **errp) memory_region_set_enabled(&mch->tseg_window, false); memory_region_add_subregion(&mch->smram, mch->below_4g_mem_size, &mch->tseg_window); + + /* + * This is not what hardware does, so it's QEMU specific hack. + * See commit message for details. + */ + memory_region_init_io(&mch->smbase_blackhole, OBJECT(mch), &blackhole_= ops, + NULL, "smbase-blackhole", + MCH_HOST_BRIDGE_SMBASE_SIZE); + memory_region_set_enabled(&mch->smbase_blackhole, false); + memory_region_add_subregion_overlap(mch->system_memory, + MCH_HOST_BRIDGE_SMBASE_ADDR, + &mch->smbase_blackhole, 1); + + memory_region_init_alias(&mch->smbase_window, OBJECT(mch), + "smbase-window", mch->ram_memory, + MCH_HOST_BRIDGE_SMBASE_ADDR, + MCH_HOST_BRIDGE_SMBASE_SIZE); + memory_region_set_enabled(&mch->smbase_window, false); + memory_region_add_subregion(&mch->smram, MCH_HOST_BRIDGE_SMBASE_ADDR, + &mch->smbase_window); + object_property_add_const_link(qdev_get_machine(), "smram", OBJECT(&mch->smram), &error_abort); =20 @@ -601,6 +670,7 @@ uint64_t mch_mcfg_base(void) static Property mch_props[] =3D { DEFINE_PROP_UINT16("extended-tseg-mbytes", MCHPCIState, ext_tseg_mbyte= s, 16), + DEFINE_PROP_BOOL("smbase-smram", MCHPCIState, has_smram_at_smbase, tru= e), DEFINE_PROP_END_OF_LIST(), }; =20 --=20 MST From nobody Sat May 18 23:14:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579763599; cv=none; d=zohomail.com; s=zohoarc; b=iNN5vljSjbcIkDtgf77Gynkyvg/B45f78ukyPFivVyqHcwR8H9uwrX6ncWD4XoPBNS1qOwyTkzftQApqgDqCYOFcWMfbbHB3Ng1ku2eBBlsy8SaGCnNYFm9wetZrUWGeeg2BwWLHRqL9143hH+7fMwhthTlC9BXa4xVq+a6+LS0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579763599; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gDntRjnqkdZXlC1JZeGY/cuEoEt7aTCjD9wGxlyp8Vo=; b=G5VQ1nxdAO10NZTlhrk1J5rzJtkmtQ08RWDB2c0oRWUEhXedFyOlEiMoZ0mqNCYsiI6FMQmkwoT5387omYz5diGdSRSh/A1Di+iPjqZDURdOkUOnZenwLNR9RwyRXyolwAw2XkzA3NR7iM+rDLlqrwIhgJ2SNk+KqNWRVF7qH54= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579763599755585.529312800447; Wed, 22 Jan 2020 23:13:19 -0800 (PST) Received: from localhost ([::1]:52044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWg2-0000AD-06 for importer@patchew.org; Thu, 23 Jan 2020 02:13:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37191) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWdA-0005i5-Lh for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iuWd9-0007os-7o for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:20 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:33913 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iuWd9-0007o9-34 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:19 -0500 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-54-nGhcGBaENbmPp0T1PsWMyA-1; Thu, 23 Jan 2020 02:10:16 -0500 Received: by mail-wm1-f70.google.com with SMTP id e12so304369wma.7 for ; Wed, 22 Jan 2020 23:10:15 -0800 (PST) Received: from redhat.com (bzq-79-176-0-156.red.bezeqint.net. [79.176.0.156]) by smtp.gmail.com with ESMTPSA id p18sm1501881wmg.4.2020.01.22.23.10.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 23:10:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579763418; 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=gDntRjnqkdZXlC1JZeGY/cuEoEt7aTCjD9wGxlyp8Vo=; b=fJG/8CWkcdIq1E4v0OlG0TQR5fy+v/GqJB6tzNhoGAEZYZNx3WW9lhLN/TTeBWv3FCJ3sz 8rQwoH3lXTkKV+YEVzanbWnURPUNmhyAy8z12dPUvTabl+aErE5hFq3pq21dPEMdtqcgjK rLDMA6cvqQ6KNkYGU+dUQXoIT/OjTn8= 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=o0n2DkkmVlJvF/kJjOaBKtOGbZzvtHQ/1x2pWKeDMgM=; b=f3Y384uIDOunY/GE9UTXxxP8rpW+58qoKnoGXb3nNCtq5gDtxAC+POwZgIOajIAltl 8JpxrTcJBFBXXVRubkDW4Jw44yAlxdS5OyIfKQCanRN7FD9QjE5YRIYmLxZ0WmLGuaqb hq2Nyc7v6QDXgqvgxMFCblnqYuM6UE3bUKmxUK4rC5PZhz0uC2zLbGK9vrtWQlo/yJHp x7ih3yGrzY7j4DxdWo9qZKV2XoKON2BKcwOjYOGvTk3eq69LEDdBNLVqoPZTxI03ScA6 aeQrM6qJs3z8KI/ID6/klEPrlLl9pdW6TvdVKNWMrEXZ4ict2Cjm4gZhlQq5KFibEoQN BpnQ== X-Gm-Message-State: APjAAAVCFvl0pYd/FhzPn+vXVPlVgUwv7vv+okv++NczadRhtAk0rRZK AU32Em03X1HZNv1A3ml3Oyt5V27fHjAVOtj6MNqYfUCEwhfZ9Yswip2KLzNt8EJpKZ7I4MdAd4P qRWSFUpOXujGC5RU= X-Received: by 2002:a05:600c:20f:: with SMTP id 15mr2428198wmi.128.1579763414261; Wed, 22 Jan 2020 23:10:14 -0800 (PST) X-Google-Smtp-Source: APXvYqzR7DtbuLN5iukYyvPbUnDLKMCnSDLg1uMzFos2uVFjwRKl8k2I8JU6r+RYftRxwMNYBgvjAQ== X-Received: by 2002:a05:600c:20f:: with SMTP id 15mr2428170wmi.128.1579763414070; Wed, 22 Jan 2020 23:10:14 -0800 (PST) Date: Thu, 23 Jan 2020 02:10:11 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v3 02/18] tests: q35: MCH: add default SMBASE SMRAM lock test Message-ID: <20200123070913.626488-3-mst@redhat.com> References: <20200123070913.626488-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200123070913.626488-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-MC-Unique: nGhcGBaENbmPp0T1PsWMyA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 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: Laurent Vivier , Peter Maydell , Thomas Huth , Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Igor Mammedov test lockable SMRAM at default SMBASE feature, introduced by patch "q35: implement 128K SMRAM at default SMBASE address" Signed-off-by: Igor Mammedov Message-Id: <1575899217-333105-1-git-send-email-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/q35-test.c | 105 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/tests/qtest/q35-test.c b/tests/qtest/q35-test.c index a68183d513..c922d81bc0 100644 --- a/tests/qtest/q35-test.c +++ b/tests/qtest/q35-test.c @@ -186,6 +186,109 @@ static void test_tseg_size(const void *data) qtest_quit(qts); } =20 +#define SMBASE 0x30000 +#define SMRAM_TEST_PATTERN 0x32 +#define SMRAM_TEST_RESET_PATTERN 0x23 + +static void test_smram_smbase_lock(void) +{ + QPCIBus *pcibus; + QPCIDevice *pcidev; + QDict *response; + QTestState *qts; + int i; + + qts =3D qtest_init("-M q35"); + + pcibus =3D qpci_new_pc(qts, NULL); + g_assert(pcibus !=3D NULL); + + pcidev =3D qpci_device_find(pcibus, 0); + g_assert(pcidev !=3D NULL); + + /* check that SMRAM is not enabled by default */ + g_assert(qpci_config_readb(pcidev, MCH_HOST_BRIDGE_F_SMBASE) =3D=3D 0); + qtest_writeb(qts, SMBASE, SMRAM_TEST_PATTERN); + g_assert_cmpint(qtest_readb(qts, SMBASE), =3D=3D, SMRAM_TEST_PATTERN); + + /* check that writing junk to 0x9c before before negotiating is ignore= d */ + for (i =3D 0; i < 0xff; i++) { + qpci_config_writeb(pcidev, MCH_HOST_BRIDGE_F_SMBASE, i); + g_assert(qpci_config_readb(pcidev, MCH_HOST_BRIDGE_F_SMBASE) =3D= =3D 0); + } + + /* enable SMRAM at SMBASE */ + qpci_config_writeb(pcidev, MCH_HOST_BRIDGE_F_SMBASE, 0xff); + g_assert(qpci_config_readb(pcidev, MCH_HOST_BRIDGE_F_SMBASE) =3D=3D 0x= 01); + /* lock SMRAM at SMBASE */ + qpci_config_writeb(pcidev, MCH_HOST_BRIDGE_F_SMBASE, 0x02); + g_assert(qpci_config_readb(pcidev, MCH_HOST_BRIDGE_F_SMBASE) =3D=3D 0x= 02); + + /* check that SMRAM at SMBASE is locked and can't be unlocked */ + g_assert_cmpint(qtest_readb(qts, SMBASE), =3D=3D, 0xff); + for (i =3D 0; i <=3D 0xff; i++) { + /* make sure register is immutable */ + qpci_config_writeb(pcidev, MCH_HOST_BRIDGE_F_SMBASE, i); + g_assert(qpci_config_readb(pcidev, MCH_HOST_BRIDGE_F_SMBASE) =3D= =3D 0x02); + + /* RAM access should go into black hole */ + qtest_writeb(qts, SMBASE, SMRAM_TEST_PATTERN); + g_assert_cmpint(qtest_readb(qts, SMBASE), =3D=3D, 0xff); + } + + /* reset */ + response =3D qtest_qmp(qts, "{'execute': 'system_reset', 'arguments': = {} }"); + g_assert(response); + g_assert(!qdict_haskey(response, "error")); + qobject_unref(response); + + /* check RAM at SMBASE is available after reset */ + g_assert_cmpint(qtest_readb(qts, SMBASE), =3D=3D, SMRAM_TEST_PATTERN); + g_assert(qpci_config_readb(pcidev, MCH_HOST_BRIDGE_F_SMBASE) =3D=3D 0); + qtest_writeb(qts, SMBASE, SMRAM_TEST_RESET_PATTERN); + g_assert_cmpint(qtest_readb(qts, SMBASE), =3D=3D, SMRAM_TEST_RESET_PAT= TERN); + + g_free(pcidev); + qpci_free_pc(pcibus); + + qtest_quit(qts); +} + +static void test_without_smram_base(void) +{ + QPCIBus *pcibus; + QPCIDevice *pcidev; + QTestState *qts; + int i; + + qts =3D qtest_init("-M pc-q35-4.1"); + + pcibus =3D qpci_new_pc(qts, NULL); + g_assert(pcibus !=3D NULL); + + pcidev =3D qpci_device_find(pcibus, 0); + g_assert(pcidev !=3D NULL); + + /* check that RAM is accessible */ + qtest_writeb(qts, SMBASE, SMRAM_TEST_PATTERN); + g_assert_cmpint(qtest_readb(qts, SMBASE), =3D=3D, SMRAM_TEST_PATTERN); + + /* check that writing to 0x9c succeeds */ + for (i =3D 0; i <=3D 0xff; i++) { + qpci_config_writeb(pcidev, MCH_HOST_BRIDGE_F_SMBASE, i); + g_assert(qpci_config_readb(pcidev, MCH_HOST_BRIDGE_F_SMBASE) =3D= =3D i); + } + + /* check that RAM is still accessible */ + qtest_writeb(qts, SMBASE, SMRAM_TEST_PATTERN + 1); + g_assert_cmpint(qtest_readb(qts, SMBASE), =3D=3D, (SMRAM_TEST_PATTERN = + 1)); + + g_free(pcidev); + qpci_free_pc(pcibus); + + qtest_quit(qts); +} + int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); @@ -197,5 +300,7 @@ int main(int argc, char **argv) qtest_add_data_func("/q35/tseg-size/8mb", &tseg_8mb, test_tseg_size); qtest_add_data_func("/q35/tseg-size/ext/16mb", &tseg_ext_16mb, test_tseg_size); + qtest_add_func("/q35/smram/smbase_lock", test_smram_smbase_lock); + qtest_add_func("/q35/smram/legacy_smbase", test_without_smram_base); return g_test_run(); } --=20 MST From nobody Sat May 18 23:14:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579763547; cv=none; d=zohomail.com; s=zohoarc; b=heTbhdqHzb4xn8YOaGE+YldN20Ss+8k+elaXn7kd5MnI/nPPR7d4LmXvcdfNrS6AmG+/Yl4x1TCb3YSj4o+BlAis0eydh7vpq0RmOgrYUPF/Y48AlmO2nT+O3mitqvvllooKCSQqpQ3+/viVooyHCsBk5KmQOGETl3NCPwo8Kuo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579763547; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OhMnOXw2jltLb3g6o0bZN0GY8d9d1JsgKnb3ojyU5uY=; b=R2+jWGHUDCrB/EJafwxvmPwLYL9rj8q0br6PZczCwqjdf5nI3FVpSQov4Be0euN3gqxIKaO6+/l86Hm0T48Cc4fouvTSml28ZtCiRUZRINrxU223VRrZ+6UT0dwvneixsHacGDLEl2fWGMybfpnkFmHK0gq0wwH16HTEctqOTtY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579763547022355.9289566781223; Wed, 22 Jan 2020 23:12:27 -0800 (PST) Received: from localhost ([::1]:52040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWf7-0007U4-AE for importer@patchew.org; Thu, 23 Jan 2020 02:12:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37212) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWdC-0005ko-6S for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iuWdA-0007qE-Vd for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:22 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:60228 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iuWdA-0007pp-RF for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:20 -0500 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-83-85EewQqVMdu_F2AuXz3bNQ-1; Thu, 23 Jan 2020 02:10:18 -0500 Received: by mail-wr1-f72.google.com with SMTP id d8so1290890wrq.12 for ; Wed, 22 Jan 2020 23:10:18 -0800 (PST) Received: from redhat.com (bzq-79-176-0-156.red.bezeqint.net. [79.176.0.156]) by smtp.gmail.com with ESMTPSA id i5sm1804616wrv.34.2020.01.22.23.10.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 23:10:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579763420; 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=OhMnOXw2jltLb3g6o0bZN0GY8d9d1JsgKnb3ojyU5uY=; b=PJheTzMjDu6XC3bbXY/uVe27qzxkics+U0vYZ9b5tHq9G0UFPhhe0bi+vn0f9SZurEF1Us Pqcp20l1qxn5HjIhFMMe5bDzNpHko8AJjFP+rv1VLsYm0FLgLOuN5ID6/jC6uWfOu5Zdei cBzsgu4aQMlx+pI+9wcRw8Ea81cTI/s= 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=SmP96JjZ61jUtUgNUruj35mPI4zb3UYO5pk5xajyjow=; b=ZVSm/bad8t+lpSxAhvBm9+WIkwj25HCULkFIwlAVrbA6ITBbBTMFmRU6ArQGSA0wSW StL69qFNyGlb4lAsPEhkKm5SD4Q2ZwoTKIvpAvWwIRxYbqNl+9+Te0BfKfvEYrzm4KLj VOsDTHZUUhwRs0nfICwxXeXwmsp8usVQh8KrxcQd0I/1X3jYyAmkR+89A5kduawrhhdP QUd0zo9p8lX/KNE84GQriAeDOaxuiE9tOo4wisXALEbuQmrui5RpKEOzl7JgHUlAA4Zn MudFPkBL9LgllYlSvaYsEbvB7QkMk+BMxtkrtWzjSeyVrQNZOpNRSBPbFiRP6rsu2E1w S3MA== X-Gm-Message-State: APjAAAVPLw9GQsVZ1W7mAT48T3ec/MDyrlYqkdz3J6X/lg2qZGVvxgAk r363LqLXUExOVkwwrU+mBsrcF/WOE1sX9zkokRTCgJTeINT96qRXoFweu/SwpRtzGyQumkvpi5E Skl+/m91ViFKrf0U= X-Received: by 2002:adf:dfd2:: with SMTP id q18mr16511108wrn.152.1579763417043; Wed, 22 Jan 2020 23:10:17 -0800 (PST) X-Google-Smtp-Source: APXvYqxaNxGAPJdxygRPKu1udOieOGOZ+OV3WhAgziY1NytEKk1xV/eZco/+HAUYAndcC3hDhnlVJg== X-Received: by 2002:adf:dfd2:: with SMTP id q18mr16511079wrn.152.1579763416733; Wed, 22 Jan 2020 23:10:16 -0800 (PST) Date: Thu, 23 Jan 2020 02:10:14 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v3 03/18] acpi: cpuhp: spec: clarify 'CPU selector' register usage and endianness Message-ID: <20200123070913.626488-4-mst@redhat.com> References: <20200123070913.626488-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200123070913.626488-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-MC-Unique: 85EewQqVMdu_F2AuXz3bNQ-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 207.211.31.81 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 , Laszlo Ersek , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Igor Mammedov * Move reserved registers to the top of the section, so reader would be aware of effects when reading registers description. * State registers endianness explicitly at the beginning of the section * Describe registers behavior in case of 'CPU selector' register contains value that doesn't point to a possible CPU. Signed-off-by: Igor Mammedov Reviewed-by: Laszlo Ersek Message-Id: <1575896942-331151-5-git-send-email-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- docs/specs/acpi_cpu_hotplug.txt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/specs/acpi_cpu_hotplug.txt b/docs/specs/acpi_cpu_hotplug.= txt index ee219c8358..4e65286ff5 100644 --- a/docs/specs/acpi_cpu_hotplug.txt +++ b/docs/specs/acpi_cpu_hotplug.txt @@ -30,6 +30,18 @@ Register block base address: Register block size: ACPI_CPU_HOTPLUG_REG_LEN =3D 12 =20 +All accesses to registers described below, imply little-endian byte order. + +Reserved resisters behavior: + - write accesses are ignored + - read accesses return all bits set to 0. + +The last stored value in 'CPU selector' must refer to a possible CPU, othe= rwise + - reads from any register return 0 + - writes to any other register are ignored until valid value is stored i= nto it +On QEMU start, 'CPU selector' is initialized to a valid value, on reset it +keeps the current value. + read access: offset: [0x0-0x3] reserved @@ -86,9 +98,3 @@ write access: ACPI_DEVICE_OST QMP event from QEMU to external applicati= ons with current values of OST event and status registers. other values: reserved - -Selecting CPU device beyond possible range has no effect on platform: - - write accesses to CPU hot-plug registers not documented above are - ignored - - read accesses to CPU hot-plug registers not documented above return - all bits set to 0. --=20 MST From nobody Sat May 18 23:14:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579763692; cv=none; d=zohomail.com; s=zohoarc; b=lV1RZhuykvKHZOyVB8SQlnb4YQJc4Zj278NOKV/7JbhZ3miZybteLHWXu0lw4gctNHWnag5vduUTenPqft12nDMpHWNSr5n/4H/GqCm+L4+QxhZzvSz7xKebIMTcgLS5sGqYBZ8eZZ2BkFw4iSEHu2r4aZLruDXZCA45FmU80i4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579763692; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZL7cOBRrNjS5xV9Me0lJk0ipNP0N1056GF7w4b0GCrQ=; b=emGXJ84amHIPruHfsx9mHaR+JCwxG/OwMJF/ITAPxRaGeHjR7P+5yp2bUc6n1WK0hUIv2hdxicEh8LrXe6LTAzVcI+sYns7JqLB3PyygdG3mPlItB9qe4TLjla3vJpEPTOMTo9e1uX40UzDwb6a2eaKelfFIcMAsho3RhyBsP34= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579763692791828.6038846010098; Wed, 22 Jan 2020 23:14:52 -0800 (PST) Received: from localhost ([::1]:52062 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWhX-0002JF-2r for importer@patchew.org; Thu, 23 Jan 2020 02:14:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37260) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWdH-0005su-BM for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iuWdG-0007vX-57 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:27 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:51000 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iuWdG-0007tg-1X for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:26 -0500 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-116-Xggtf5yFMteKKsi3uRM-JQ-1; Thu, 23 Jan 2020 02:10:21 -0500 Received: by mail-wr1-f70.google.com with SMTP id f10so1303385wro.14 for ; Wed, 22 Jan 2020 23:10:21 -0800 (PST) Received: from redhat.com (bzq-79-176-0-156.red.bezeqint.net. [79.176.0.156]) by smtp.gmail.com with ESMTPSA id i16sm1507914wmb.36.2020.01.22.23.10.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 23:10:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579763424; 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=ZL7cOBRrNjS5xV9Me0lJk0ipNP0N1056GF7w4b0GCrQ=; b=CpZZJAftO5SrwcQc89uHW797BEG9aeNCOCP6BkzJOElF7axCTYx2zNNjMKc5l/m/5RNdN/ wlWfTGO8T++w8vfcwCvNgvK1RoXXSarqQfCg8tWLr6j+mIgKiPAAVySnF3Tg5X5dQZuvpe fXoA77haNVDvHsalLB2pYJIWIAjxO8E= 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=0NReYyn4JQkVdN7PoAGTBso0lphxyHmehPnh64blNL8=; b=hWKPGRxXxLcdV6/pujAxhmnwiiUIH8YULaOw8NsSKVRPFrKDerieGaCNGX13w7XMUJ FD0L1lD9/4H767MeinlVFHMfIXLO0c4pKPXdxWsz4FVPhGYVGoibbJSFzAxCUiPZ5MVd lqQ96jdhX5Mrm1mxckBCNuAnh0YSYFBPbgP5ObsG4l9+JYf6Wa4YJ/tAD5L2pniyHrYD vxNdchSMTlg+rnzzm9wydH/PV6W4i6MR8j0O1bE3K6G7Qs9nvJxwgMiQkAAPIV5lAC0m cji2Lz1V5ky95bDDEJmAVAukJ4K2V5p6jEtXD9/VOFKD7R2PrHV7qVI3qEob9Hnwm+nj Hudg== X-Gm-Message-State: APjAAAUt4fxVm1DJVoAg/FlMChhRjY/6SQmLxOdXnw6JinfhAUs/UBla lAHCk36zxOZOke0p9L4zgdMc7gwJL4+bMIa0ytxENMz8hqNXInp+fBcLOF7bqNkRe1SVQOAgSUB ef2OoMXAlPDYpGJg= X-Received: by 2002:adf:eb8e:: with SMTP id t14mr15576028wrn.384.1579763420259; Wed, 22 Jan 2020 23:10:20 -0800 (PST) X-Google-Smtp-Source: APXvYqwN/R/1APgnH2EBXncPvXLbN6i0/kbQO/0iZqxZI7ioLiC84ma/MSkdmc0POU/FnFa4JsMknQ== X-Received: by 2002:adf:eb8e:: with SMTP id t14mr15576005wrn.384.1579763420064; Wed, 22 Jan 2020 23:10:20 -0800 (PST) Date: Thu, 23 Jan 2020 02:10:17 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v3 04/18] acpi: cpuhp: spec: fix 'Command data' description Message-ID: <20200123070913.626488-5-mst@redhat.com> References: <20200123070913.626488-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200123070913.626488-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-MC-Unique: Xggtf5yFMteKKsi3uRM-JQ-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 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 , Laszlo Ersek , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Igor Mammedov Correct returned value description in case 'Command field' =3D=3D 0x0, it's not PXM but CPU selector value with pending event In addition describe 0 blanket value in case of not supported 'Command field' value. Signed-off-by: Igor Mammedov Reviewed-by: Laszlo Ersek Message-Id: <1575896942-331151-6-git-send-email-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- docs/specs/acpi_cpu_hotplug.txt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/specs/acpi_cpu_hotplug.txt b/docs/specs/acpi_cpu_hotplug.= txt index 4e65286ff5..d5108720bf 100644 --- a/docs/specs/acpi_cpu_hotplug.txt +++ b/docs/specs/acpi_cpu_hotplug.txt @@ -56,9 +56,8 @@ read access: 3-7: reserved and should be ignored by OSPM [0x5-0x7] reserved [0x8] Command data: (DWORD access) - in case of error or unsupported command reads is 0xFFFFFFFF - current 'Command field' value: - 0: returns PXM value corresponding to device + contains 0 unless value last stored in 'Command field' is one of: + 0: contains 'CPU selector' value of a CPU with pending event= [s] =20 write access: offset: @@ -81,9 +80,9 @@ write access: value: 0: selects a CPU device with inserting/removing events and following reads from 'Command data' register return - selected CPU (CPU selector value). If no CPU with events - found, the current CPU selector doesn't change and - corresponding insert/remove event flags are not set. + selected CPU ('CPU selector' value). + If no CPU with events found, the current 'CPU selector' doe= sn't + change and corresponding insert/remove event flags are not = modified. 1: following writes to 'Command data' register set OST event register in QEMU 2: following writes to 'Command data' register set OST status --=20 MST From nobody Sat May 18 23:14:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579763699; cv=none; d=zohomail.com; s=zohoarc; b=W3K1hGCwqTotrrtAoTG2IhChl0OeXi9eyTIdDf+tgY3PaRsUWCygecFHbYZW1Bvv7/bwpjEvzKY8XiRhZfV1i988d95dID6cN4GAYRkixzmN2GxHwEKIK8+hHBexKNmRi/2L/uHc5QtAi7jMIPJVpelHZROxj4Cam6pErejLQqc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579763699; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=47oh9akmDrhkEtMoFDskPeBdfNDdFnGRT7tngWCeWTo=; b=Bco4riixt/Ga3o8Jqs7hFq5azZiPORBgh1hFQnCM23766NM+sqkKgS0Ry+GxprUk7wUURiC8fiW6gY4UDtjwc1pxRsX+al8YcyNwq2vgoqkRd+IeUoY67P89oje3rHNbzrsNsUw5AXrXE1RItdq1dljlXCJdNmTjTSxxFILBHr8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579763699172400.87346589482627; Wed, 22 Jan 2020 23:14:59 -0800 (PST) Received: from localhost ([::1]:52066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWhd-0002Sx-Mk for importer@patchew.org; Thu, 23 Jan 2020 02:14:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37293) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWdJ-0005x2-Uv for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iuWdI-0007yM-Qw for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:29 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:60655 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iuWdI-0007yC-Mi for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:28 -0500 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-213-N7XQR-gGO6WGPnt737Kbxw-1; Thu, 23 Jan 2020 02:10:26 -0500 Received: by mail-wr1-f71.google.com with SMTP id o6so1301080wrp.8 for ; Wed, 22 Jan 2020 23:10:26 -0800 (PST) Received: from redhat.com (bzq-79-176-0-156.red.bezeqint.net. [79.176.0.156]) by smtp.gmail.com with ESMTPSA id l19sm1476052wmj.12.2020.01.22.23.10.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 23:10:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579763428; 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=47oh9akmDrhkEtMoFDskPeBdfNDdFnGRT7tngWCeWTo=; b=T0lRqNJFfimaPxgH9V8oZ2CUC5rQyjZjhmrB3h3CnPHLpAVUo+h7gVu4fsLvIQ6TvnBE9y WBHDLzOaDpjIJTXlK9eYLQ4OzploQ70nBc987zzZI+QoWVwNLU9WDLb55KGM6n6sh+0nAP Jns7u2YiHPEVpml0YtbHGPlElZ/4oKE= 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=qLwCkCIBdxpEX8Qu8xH9v4eZQ8D42cjdHR7wkseYBRA=; b=INWCBP3Hl3lfqijXupWROtfhQOm2gENxi6YcRmZti8nkt9IM7dF+bcG92HiNiQsxpS BzwmbDazKPBvhpbfBBSvueSqnUlfBgyibnoHsKpPdgMGN2fbQVnkOE3VvbGANGoV7rpm tVNZCWjknrzHhbaXyb4I+ldYeyUpL7y4cgclHA0QBZGXh4X5St4mm4PKdD8CWNlcihpG gzyDXQR17aN/AnlO7JWUQ01TsygTgrZJFAsTKWbpSYXxvW3/kUetM9pJhKFeEhl+1i32 Qn1PCTpgQNtJDW3HpqiS0rDMvkqqEVzYgM1/qwsLOgtloSXsNRpUVJfuY+EgZkzgyHLA 2how== X-Gm-Message-State: APjAAAUgBRmXZ75UKraS0TkwtgpsG4O9U2OIZsDe9euBxpKHf7XSHC8Q VidwXV2QRSTd8N4fA4ZiMsZZHqmNOKgs4QR74fpZKJPHdP/vX7wq6EbOJAWDBFBofTz5lKBU0Zd WckrzCaWoeB+UfOI= X-Received: by 2002:a05:6000:cf:: with SMTP id q15mr15682828wrx.393.1579763423787; Wed, 22 Jan 2020 23:10:23 -0800 (PST) X-Google-Smtp-Source: APXvYqwUFgwz+bupy4SfyPWHac6CAFk+cusWPS5rZQCDKLpZtQv56AvMiqif/MU9ynwZHQ7RlRIRcQ== X-Received: by 2002:a05:6000:cf:: with SMTP id q15mr15682806wrx.393.1579763423589; Wed, 22 Jan 2020 23:10:23 -0800 (PST) Date: Thu, 23 Jan 2020 02:10:20 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v3 05/18] acpi: cpuhp: spec: clarify store into 'Command data' when 'Command field' == 0 Message-ID: <20200123070913.626488-6-mst@redhat.com> References: <20200123070913.626488-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200123070913.626488-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-MC-Unique: N7XQR-gGO6WGPnt737Kbxw-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 207.211.31.81 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 , Laszlo Ersek , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Igor Mammedov Write section of 'Command data' register should describe what happens when it's written into. Correct description in case the last stored 'Command field' value is equal to 0, to reflect that currently it's not supported. Signed-off-by: Igor Mammedov Reviewed-by: Laszlo Ersek Message-Id: <1575896942-331151-7-git-send-email-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- docs/specs/acpi_cpu_hotplug.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/specs/acpi_cpu_hotplug.txt b/docs/specs/acpi_cpu_hotplug.= txt index d5108720bf..8fb9ad22e6 100644 --- a/docs/specs/acpi_cpu_hotplug.txt +++ b/docs/specs/acpi_cpu_hotplug.txt @@ -90,8 +90,7 @@ write access: other values: reserved [0x6-0x7] reserved [0x8] Command data: (DWORD access) - current 'Command field' value: - 0: OSPM reads value of CPU selector + if last stored 'Command field' value: 1: stores value into OST event register 2: stores value into OST status register, triggers ACPI_DEVICE_OST QMP event from QEMU to external applicati= ons --=20 MST From nobody Sat May 18 23:14:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579763698; cv=none; d=zohomail.com; s=zohoarc; b=JjFVAoV7sULLoUjtMuSM2W+GpODu77rYcq5WBIs6MT2JXkk/zodZwoYZ9itLLIN9t7+Vjz66HLknYGcyzatBPhJo9eWDYP0ugI73wKtEO491df47pEfmVFqCae3BOt5+t12qwb4Fed/cU6lWxOH2+6/aNB2ZJn8nAo5C0Mueot8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579763698; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/cZSw7eZYA9nW+mh3jM5ZF40fdaxfgONBvpYjIhz74s=; b=i7uUwcwFGiSqF98T25HPfFN38kLzcF8YXazcN1RkRGsTBWyhpos7ApfSkqu0aLylbFH2s8K8tWpKW3wscdNdp0ikrpLDEfT1zsM+rJkoPHhP/vV2NT2hHkfjyVy+e7uFjDJqIdb+Nes1yZ/iWkEE4vlpabYFw0FzNrVmahqlIAA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579763698953608.0493353742903; Wed, 22 Jan 2020 23:14:58 -0800 (PST) Received: from localhost ([::1]:52064 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWhd-0002QP-CG for importer@patchew.org; Thu, 23 Jan 2020 02:14:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37325) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWdM-00060e-9o for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iuWdL-00081T-0P for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:32 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:25816 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iuWdK-000816-T6 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:30 -0500 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-29-tjCQnRK2PFWGHJX1Q0dcNg-1; Thu, 23 Jan 2020 02:10:28 -0500 Received: by mail-wr1-f71.google.com with SMTP id u12so1298036wrt.15 for ; Wed, 22 Jan 2020 23:10:28 -0800 (PST) Received: from redhat.com (bzq-79-176-0-156.red.bezeqint.net. [79.176.0.156]) by smtp.gmail.com with ESMTPSA id g9sm1785074wro.67.2020.01.22.23.10.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 23:10:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579763430; 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=/cZSw7eZYA9nW+mh3jM5ZF40fdaxfgONBvpYjIhz74s=; b=R/RYeIlGW03YiRuxa/TFEOEJ4+ZGHX+evseO4o8y/Kr46VM0suUTJ8i+ximREsM0qqx64O T/FwkwMfBKxQ3+nX+Wj+Syuk8Q3hKrgt8uJuu0jwSpwmyXoV4XYD2EFFsfwqApfULldkMv anhZ3feQvebRKaN9uBz3yIhMS2CojRg= 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=mG4C1N5iHUE7eCiLg4lfrsmbX/tB8VxXvzlNPjmYI5U=; b=kmKnH7KvJxZV31wfqpbPLEYPsXFXcnJ8eXXd4baUbe4qWg+irwPShwzzcRHx8jnWK+ 31JeEcahrEBZFnLIv1cYwBBn1ZuRv6QqJRwHVrQxhgIp8KnflvuakliZATh78D4fDBkl lJ7qtmMHqsRlmYtmC6uBRtc3HLReMqYxJBrblMOo5Gz5dQVr60M1h7bv3+qKCZb+QqUO ktirHVBcuvECzA7KE8lK0ORbuCAk9FE8UrW56Akany6zqr21Gz0GgvY1TvbRIXEJZ2e5 Z4XiawFR+hdvs2AKPle2Ow+6NGSbvcX8pvTiX+z1S7PiXmwssikudpYoGim9g/C8AIpn JDzg== X-Gm-Message-State: APjAAAXiOtGhbpHnxeE4JUCxsGes+FX6qhZe+jqMMVlo0XYNZ/XvJl22 xL2CwLXjSGuVd+w88AOesjIIplEpLhIlxrYy9GvGsIENNCWPjqnA3UfXnuZAhrhIqbbLWChfKrL oCJ8g3wKFTnt+6Tg= X-Received: by 2002:a05:600c:2050:: with SMTP id p16mr2426153wmg.176.1579763427114; Wed, 22 Jan 2020 23:10:27 -0800 (PST) X-Google-Smtp-Source: APXvYqyHHHJubxE5lOoxtfMKsUHvN4O6KcszTMSQ5pFOujnyIQNmZuNdoQ131iNTXwGI4IcrF5viJw== X-Received: by 2002:a05:600c:2050:: with SMTP id p16mr2426128wmg.176.1579763426886; Wed, 22 Jan 2020 23:10:26 -0800 (PST) Date: Thu, 23 Jan 2020 02:10:24 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v3 06/18] acpi: cpuhp: introduce 'Command data 2' field Message-ID: <20200123070913.626488-7-mst@redhat.com> References: <20200123070913.626488-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200123070913.626488-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-MC-Unique: tjCQnRK2PFWGHJX1Q0dcNg-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 207.211.31.81 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 , Laszlo Ersek , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Igor Mammedov No functional change in practice, patch only aims to properly document (in spec and code) intended usage of the reserved space. The new field is to be used for 2 purposes: - detection of modern CPU hotplug interface using CPHP_GET_NEXT_CPU_WITH_EVENT_CMD command. procedure will be described in follow up patch: "acpi: cpuhp: spec: add typical usecases" - for returning upper 32 bits of architecture specific CPU ID, for new CPHP_GET_CPU_ID_CMD command added by follow up patch: "acpi: cpuhp: add CPHP_GET_CPU_ID_CMD command" Change is backward compatible with 4.2 and older machines, as field was unconditionally reserved and always returned 0x0 if modern CPU hotplug interface was enabled. Signed-off-by: Igor Mammedov Message-Id: <1575896942-331151-8-git-send-email-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Laszlo Ersek --- docs/specs/acpi_cpu_hotplug.txt | 5 ++++- hw/acpi/cpu.c | 11 +++++++++++ hw/acpi/trace-events | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/docs/specs/acpi_cpu_hotplug.txt b/docs/specs/acpi_cpu_hotplug.= txt index 8fb9ad22e6..9879f9ef7e 100644 --- a/docs/specs/acpi_cpu_hotplug.txt +++ b/docs/specs/acpi_cpu_hotplug.txt @@ -44,7 +44,10 @@ keeps the current value. =20 read access: offset: - [0x0-0x3] reserved + [0x0-0x3] Command data 2: (DWORD access) + if value last stored in 'Command field': + 0: reads as 0x0 + other values: reserved [0x4] CPU device status fields: (1 byte access) bits: 0: Device is enabled and may be used by guest diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c index 87f30a31d7..d475c06953 100644 --- a/hw/acpi/cpu.c +++ b/hw/acpi/cpu.c @@ -12,6 +12,7 @@ #define ACPI_CPU_FLAGS_OFFSET_RW 4 #define ACPI_CPU_CMD_OFFSET_WR 5 #define ACPI_CPU_CMD_DATA_OFFSET_RW 8 +#define ACPI_CPU_CMD_DATA2_OFFSET_R 0 =20 enum { CPHP_GET_NEXT_CPU_WITH_EVENT_CMD =3D 0, @@ -79,6 +80,16 @@ static uint64_t cpu_hotplug_rd(void *opaque, hwaddr addr= , unsigned size) } trace_cpuhp_acpi_read_cmd_data(cpu_st->selector, val); break; + case ACPI_CPU_CMD_DATA2_OFFSET_R: + switch (cpu_st->command) { + case CPHP_GET_NEXT_CPU_WITH_EVENT_CMD: + val =3D 0; + break; + default: + break; + } + trace_cpuhp_acpi_read_cmd_data2(cpu_st->selector, val); + break; default: break; } diff --git a/hw/acpi/trace-events b/hw/acpi/trace-events index 96b8273297..afbc77de1c 100644 --- a/hw/acpi/trace-events +++ b/hw/acpi/trace-events @@ -23,6 +23,7 @@ cpuhp_acpi_read_flags(uint32_t idx, uint8_t flags) "idx[0= x%"PRIx32"] flags: 0x%" cpuhp_acpi_write_idx(uint32_t idx) "set active cpu idx: 0x%"PRIx32 cpuhp_acpi_write_cmd(uint32_t idx, uint8_t cmd) "idx[0x%"PRIx32"] cmd: 0x%= "PRIx8 cpuhp_acpi_read_cmd_data(uint32_t idx, uint32_t data) "idx[0x%"PRIx32"] da= ta: 0x%"PRIx32 +cpuhp_acpi_read_cmd_data2(uint32_t idx, uint32_t data) "idx[0x%"PRIx32"] d= ata: 0x%"PRIx32 cpuhp_acpi_cpu_has_events(uint32_t idx, bool ins, bool rm) "idx[0x%"PRIx32= "] inserting: %d, removing: %d" cpuhp_acpi_clear_inserting_evt(uint32_t idx) "idx[0x%"PRIx32"]" cpuhp_acpi_clear_remove_evt(uint32_t idx) "idx[0x%"PRIx32"]" --=20 MST From nobody Sat May 18 23:14:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579763895; cv=none; d=zohomail.com; s=zohoarc; b=fEnYjIa4ThPMGAzrnEQmzhMBXOUD4VsYX53yzSHuKw+CwJSLcGqH7wzE4MxPzjp5onouJSyBKKZ9coMWTxzCXg8J93spRTNOS5MtaUgk6oU8W8UV/NRDE7UIDNzoLvSsb1RtopePl3pc/inpn8vcPIdZkNNCIfl+ptJUe5Rykv4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579763895; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=e6oF8ptLJSLl44PBoGi3WUQj8MqGR3g9tIutmWvq7mo=; b=gt1Sb9D3VU0eh0+q7zJDnG28EsGfFReitO0TzNvxZjnulpdGjybb4EM915rttbO9cLuc0hq0ugTsEfqpqwls/LF0i0Hi2DUpX5tS1bz1dzuhsru6rZDYvlbKYh/JF7Yxv6xBjzsgBnFPP55c0/As8jj86CBGZ4yFOqe9Vp/9Feg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157976389568728.627485429356625; Wed, 22 Jan 2020 23:18:15 -0800 (PST) Received: from localhost ([::1]:52094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWkn-0005U1-Vf for importer@patchew.org; Thu, 23 Jan 2020 02:18:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37364) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWdR-00066J-TN for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iuWdO-00086z-SM for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:36 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:58253 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iuWdO-00085k-Oe for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:34 -0500 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-424-826jshYLM2a2oStWr88nZA-1; Thu, 23 Jan 2020 02:10:32 -0500 Received: by mail-wr1-f70.google.com with SMTP id z15so1327165wrw.0 for ; Wed, 22 Jan 2020 23:10:32 -0800 (PST) Received: from redhat.com (bzq-79-176-0-156.red.bezeqint.net. [79.176.0.156]) by smtp.gmail.com with ESMTPSA id g18sm1411146wmh.48.2020.01.22.23.10.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 23:10:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579763434; 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=e6oF8ptLJSLl44PBoGi3WUQj8MqGR3g9tIutmWvq7mo=; b=SEZ71dTJTKK/DUFk4U/eosXmwTcJj5ZSmYv9+x54D6hiEeMapPnpwUIW0OTLVsTc3YjMNJ jGKdS13AeCooIg5LlEVexjd+xaeGaoXtH3sLBdYoSuuq9GtLj2xH96WuOlhToys8aIcOrX kVrW0AGouDiKs2e5qnIeaYH2sHnWOwY= 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=e+M60MZmw7NUe0xGRZqvTtNyN03f8rI9bLRMhM9s7VE=; b=gIgRFhIQMfiUPxMedSJxvcsqtCR4i0avnQZpN2z5+kdxNtFQbRfChaH0Cqq/MO1ouR qWQfAQGO6QxXv+GxyjNHB5kacAMF3r5fdqOK2yfQ5eWTKhPMLi+pTQstiUX/ZvYsLjup JbEMaWH/gCc0JWp6D47EM57Zl1Rcdidi39JFgEW4ypZCei3ZzH4GDmIHezl+jpp6mqfF 9OYTQMw6vU8BBnzksJKZqDoLhuBljXaYmrvdPntUWG+GpQB5ovMVj049UynvkMwn/G0d laSBZ+GQa0FCLvMD9qHddwFBAPNLRilmBha8bG5+Zr1v9EoKGUmFIYIxOHGjO3h0v9gb xJnQ== X-Gm-Message-State: APjAAAVrh6QZcIz4Fjzx+HRAcYoUjTMY/cwcm8Im1CsJ88+YxQtiYp2h l1Hb3+aW7I5OtOfYsncuaZtPfIK3oYLSqgv0sN0n3FVbHNddrr4ryeK5CB0SBBV/jVIq8yRX2Rm yQo/8Kofw3dOl7fI= X-Received: by 2002:adf:eb51:: with SMTP id u17mr16648354wrn.29.1579763430546; Wed, 22 Jan 2020 23:10:30 -0800 (PST) X-Google-Smtp-Source: APXvYqxtxWWXEj8kE/s5kHug6PLRbX/8617w/p6enVdV4YuCUvvmGay673xt+NTHoDDQghH1S16fAw== X-Received: by 2002:adf:eb51:: with SMTP id u17mr16648322wrn.29.1579763430251; Wed, 22 Jan 2020 23:10:30 -0800 (PST) Date: Thu, 23 Jan 2020 02:10:27 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v3 07/18] acpi: cpuhp: spec: add typical usecases Message-ID: <20200123070913.626488-8-mst@redhat.com> References: <20200123070913.626488-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200123070913.626488-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-MC-Unique: 826jshYLM2a2oStWr88nZA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 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 , Laszlo Ersek , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Igor Mammedov Document work-flows for * enabling/detecting modern CPU hotplug interface * finding a CPU with pending 'insert/remove' event * enumerating present and possible CPUs Signed-off-by: Igor Mammedov Message-Id: <1575896942-331151-9-git-send-email-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Laszlo Ersek --- docs/specs/acpi_cpu_hotplug.txt | 51 +++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/docs/specs/acpi_cpu_hotplug.txt b/docs/specs/acpi_cpu_hotplug.= txt index 9879f9ef7e..cb99cf3c8e 100644 --- a/docs/specs/acpi_cpu_hotplug.txt +++ b/docs/specs/acpi_cpu_hotplug.txt @@ -15,14 +15,14 @@ CPU present bitmap for: PIIX-PM (IO port 0xaf00-0xaf1f, 1-byte access) One bit per CPU. Bit position reflects corresponding CPU APIC ID. Read-o= nly. The first DWORD in bitmap is used in write mode to switch from legacy - to new CPU hotplug interface, write 0 into it to do switch. + to modern CPU hotplug interface, write 0 into it to do switch. --------------------------------------------------------------- QEMU sets corresponding CPU bit on hot-add event and issues SCI with GPE.2 event set. CPU present map is read by ACPI BIOS GPE.2 handler to notify OS about CPU hot-add events. CPU hot-remove isn't supported. =20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D -ACPI CPU hotplug interface registers: +Modern ACPI CPU hotplug interface registers: ------------------------------------- Register block base address: ICH9-LPC IO port 0x0cd8 @@ -67,6 +67,7 @@ write access: [0x0-0x3] CPU selector: (DWORD access) selects active CPU device. All following accesses to other registers will read/store data from/to selected CPU. + Valid values: [0 .. max_cpus) [0x4] CPU device control fields: (1 byte access) bits: 0: reserved, OSPM must clear it before writing to register. @@ -98,4 +99,48 @@ write access: 2: stores value into OST status register, triggers ACPI_DEVICE_OST QMP event from QEMU to external applicati= ons with current values of OST event and status registers. - other values: reserved + other values: reserved + +Typical usecases: + - (x86) Detecting and enabling modern CPU hotplug interface. + QEMU starts with legacy CPU hotplug interface enabled. Detecting and + switching to modern interface is based on the 2 legacy CPU hotplug f= eatures: + 1. Writes into CPU bitmap are ignored. + 2. CPU bitmap always has bit#0 set, corresponding to boot CPU. + + Use following steps to detect and enable modern CPU hotplug interfac= e: + 1. Store 0x0 to the 'CPU selector' register, + attempting to switch to modern mode + 2. Store 0x0 to the 'CPU selector' register, + to ensure valid selector value + 3. Store 0x0 to the 'Command field' register, + 4. Read the 'Command data 2' register. + If read value is 0x0, the modern interface is enabled. + Otherwise legacy or no CPU hotplug interface available + + - Get a cpu with pending event + 1. Store 0x0 to the 'CPU selector' register. + 2. Store 0x0 to the 'Command field' register. + 3. Read the 'CPU device status fields' register. + 4. If both bit#1 and bit#2 are clear in the value read, there is no = CPU + with a pending event and selected CPU remains unchanged. + 5. Otherwise, read the 'Command data' register. The value read is the + selector of the CPU with the pending event (which is already + selected). + + - Enumerate CPUs present/non present CPUs + 01. Set the present CPU count to 0. + 02. Set the iterator to 0. + 03. Store 0x0 to the 'CPU selector' register, to ensure that it's in + a valid state and that access to other registers won't be ignore= d. + 04. Store 0x0 to the 'Command field' register to make 'Command data' + register return 'CPU selector' value of selected CPU + 05. Read the 'CPU device status fields' register. + 06. If bit#0 is set, increment the present CPU count. + 07. Increment the iterator. + 08. Store the iterator to the 'CPU selector' register. + 09. Read the 'Command data' register. + 10. If the value read is not zero, goto 05. + 11. Otherwise store 0x0 to the 'CPU selector' register, to put it + into a valid state and exit. + The iterator at this point equals "max_cpus". --=20 MST From nobody Sat May 18 23:14:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579764067; cv=none; d=zohomail.com; s=zohoarc; b=eW+TAUtFjQOdYHQ/MFI6dlz3BFUb3HxJN29xp7PJXCfZSJnyo/mTac/9CKNK0fWc7HTOp73UzS4T6cuJApanKHCstYwtzMdWWfAjcoAl1AjEV/NnixLnOhHbNO2+FbO5b7EtUozpGEQY7GPAnF6Sb7NIYd7HMC0g8jhaSBZHM4k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579764067; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lSs10h7+g5GHkd748u1YKdPjMw3sPPNZXswgwHDuFfc=; b=jrArugRcGiN+zd++BWPpbGlkMftGe89kYBT9Vui2TbMJkpB3nUXTjrJVx9nVmBVyLZRQfOPBrUlgY6rcDqNxWNbncSS2ir/a5u31H+DbH+wIEqQ1dXu7f14CyZqb75C+Uf/6iOcGnRFEf+4nzHE0U7IOHilcPdREJvi9mrM7QKI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579764067376747.942493945351; Wed, 22 Jan 2020 23:21:07 -0800 (PST) Received: from localhost ([::1]:52128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWna-0000aN-43 for importer@patchew.org; Thu, 23 Jan 2020 02:21:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37654) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWe7-0006x1-88 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:11:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iuWe6-0000L1-2Q for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:11:19 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:51934 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iuWe5-0000Kk-UB for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:11:18 -0500 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-152-1FtVqQYGMnSmhvJbI3y8Mw-1; Thu, 23 Jan 2020 02:10:35 -0500 Received: by mail-wm1-f69.google.com with SMTP id e12so304654wma.7 for ; Wed, 22 Jan 2020 23:10:35 -0800 (PST) Received: from redhat.com (bzq-79-176-0-156.red.bezeqint.net. [79.176.0.156]) by smtp.gmail.com with ESMTPSA id s15sm1819215wrp.4.2020.01.22.23.10.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 23:10:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579763477; 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=lSs10h7+g5GHkd748u1YKdPjMw3sPPNZXswgwHDuFfc=; b=OGaZeiE4ez1gO0SkZuVWAkQLa+wRSutCWM3NjR7xIl2FCj9U6Tf9FKndG7LsNBFwIFKR91 py+XkLBcboc91XLAWYvdMHJNJuQUdWaa0oWKeICdwAkqY3+8+5ufvRv0oH6IbCqPQsgrHQ GvQgLulbLUtQCdd0qO3fg7viKVVwUrs= 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=bshZ29A7PK62drys54Y2NwFiWKvTA5OkiFM7lPNvHYk=; b=InB9evdijQeo+az1gfH5AdqjypMb+LcdFliFeb5lWiLkMdy26qd7j7iCQN19JjzMqn YdjJTHnqYfydB9dHGkwm5seuKgqpU+JXYaCjabHQfYJc+nUIqOdZwrSpPEqXffd1rXBq 0yW8usty3YtKuNGUswFH1kXty7tBum1hbwC8vHxLtxlnziwO9b27aD+XKsMHBwhn0wNi 7HEcBnx798j7rSy2g9mNAx+sce/FSdG3WkQuSJsq1XV6KwabyBq8rk2AvEtwxEzHTIKf 37DPGW3tUXTM3I5tePG5Oob/R6DJ2sm2QD+ksF+JvET1kq/z7y2LHnGV5jvtQnH/clVT FTKQ== X-Gm-Message-State: APjAAAWEnrwi8fC/k+cvLHpSY8i2uKe24CgLttIGR9YBOI6YEwjfJmvr aoy2ncRuvsWR3OoKsyoUtlz5bTFOuuDy7ZNi8TdgaQofKhHreiQz3QkpQN54/LU59bP4DK57nhZ aFXe5Xb1wcwml4TM= X-Received: by 2002:a05:600c:d6:: with SMTP id u22mr2491756wmm.77.1579763433814; Wed, 22 Jan 2020 23:10:33 -0800 (PST) X-Google-Smtp-Source: APXvYqw25w3wi8+Fmbg0/xUdeTXLTw5Y1cHEVOhzg2+lgeUvQij5P2ur5ET2qLWpJU9dfv0+8swvAw== X-Received: by 2002:a05:600c:d6:: with SMTP id u22mr2491735wmm.77.1579763433620; Wed, 22 Jan 2020 23:10:33 -0800 (PST) Date: Thu, 23 Jan 2020 02:10:31 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v3 08/18] acpi: cpuhp: add CPHP_GET_CPU_ID_CMD command Message-ID: <20200123070913.626488-9-mst@redhat.com> References: <20200123070913.626488-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200123070913.626488-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-MC-Unique: 1FtVqQYGMnSmhvJbI3y8Mw-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 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 , Laszlo Ersek , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Igor Mammedov Firmware can enumerate present at boot APs by broadcasting wakeup IPI, so that woken up secondary CPUs could register them-selves. However in CPU hotplug case, it would need to know architecture specific CPU IDs for possible and hotplugged CPUs so it could prepare environment for and wake hotplugged AP. Reuse and extend existing CPU hotplug interface to return architecture specific ID for currently selected CPU in 2 registers: - lower 32 bits in ACPI_CPU_CMD_DATA_OFFSET_RW - upper 32 bits in ACPI_CPU_CMD_DATA2_OFFSET_R On x86, firmware will use CPHP_GET_CPU_ID_CMD for fetching the APIC ID when handling hotplug SMI. Later, CPHP_GET_CPU_ID_CMD will be used on ARM to retrieve MPIDR, which serves the similar to APIC ID purpose. Signed-off-by: Igor Mammedov Message-Id: <1575896942-331151-10-git-send-email-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Laszlo Ersek --- docs/specs/acpi_cpu_hotplug.txt | 3 +++ hw/acpi/cpu.c | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/docs/specs/acpi_cpu_hotplug.txt b/docs/specs/acpi_cpu_hotplug.= txt index cb99cf3c8e..a8ce5e7402 100644 --- a/docs/specs/acpi_cpu_hotplug.txt +++ b/docs/specs/acpi_cpu_hotplug.txt @@ -47,6 +47,7 @@ read access: [0x0-0x3] Command data 2: (DWORD access) if value last stored in 'Command field': 0: reads as 0x0 + 3: upper 32 bits of architecture specific CPU ID value other values: reserved [0x4] CPU device status fields: (1 byte access) bits: @@ -61,6 +62,8 @@ read access: [0x8] Command data: (DWORD access) contains 0 unless value last stored in 'Command field' is one of: 0: contains 'CPU selector' value of a CPU with pending event= [s] + 3: lower 32 bits of architecture specific CPU ID value + (in x86 case: APIC ID) =20 write access: offset: diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c index d475c06953..e2c957ce00 100644 --- a/hw/acpi/cpu.c +++ b/hw/acpi/cpu.c @@ -18,6 +18,7 @@ enum { CPHP_GET_NEXT_CPU_WITH_EVENT_CMD =3D 0, CPHP_OST_EVENT_CMD =3D 1, CPHP_OST_STATUS_CMD =3D 2, + CPHP_GET_CPU_ID_CMD =3D 3, CPHP_CMD_MAX }; =20 @@ -75,6 +76,9 @@ static uint64_t cpu_hotplug_rd(void *opaque, hwaddr addr,= unsigned size) case CPHP_GET_NEXT_CPU_WITH_EVENT_CMD: val =3D cpu_st->selector; break; + case CPHP_GET_CPU_ID_CMD: + val =3D cdev->arch_id & 0xFFFFFFFF; + break; default: break; } @@ -85,6 +89,9 @@ static uint64_t cpu_hotplug_rd(void *opaque, hwaddr addr,= unsigned size) case CPHP_GET_NEXT_CPU_WITH_EVENT_CMD: val =3D 0; break; + case CPHP_GET_CPU_ID_CMD: + val =3D cdev->arch_id >> 32; + break; default: break; } --=20 MST From nobody Sat May 18 23:14:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579763893; cv=none; d=zohomail.com; s=zohoarc; b=NN22zIDLn9/UCSh2EhlbHxq0k3u5oXRjmQyoRn39OiHw9I2b81y1CHNCMfS6drfmLhkvQi+GBLecerlSWgSN0mBfvCNse6/5oBxpt7aiuvG00FCyQZbG1hZEnbI61FGV++K/Qp79J8WEALYvjOAojEcayCcLNsSwERlaBADG8Nc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579763893; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eTnESgkc4Q1IE7eK3yhiRdRiKjKhsh/o/b9VSLnbvfo=; b=Gen6eKZv4lOwL9aUNHCn1snn0MPwfScuUun2DneTb41CxPnpSFzMlcNJ4vmClaVHOBMRRsqY+mdiL71Znh0c/XAKpogbQNsPb3tQ1Clu9y1v69YfyihgyyivxRgwKXGm2xDwcnckzn3bQc4UBlZ7rwR1I0E/WNzYaf633ebKJEk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579763893503862.5661760471244; Wed, 22 Jan 2020 23:18:13 -0800 (PST) Received: from localhost ([::1]:52092 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWkl-0005R5-Ip for importer@patchew.org; Thu, 23 Jan 2020 02:18:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37402) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWdW-0006AO-LE for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iuWdV-0008EM-Ga for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:42 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:29695 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iuWdV-0008Dm-CI for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:41 -0500 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-64-u1TTpu1tPHK1OuZW_TTEkg-1; Thu, 23 Jan 2020 02:10:39 -0500 Received: by mail-wm1-f69.google.com with SMTP id w205so603999wmb.5 for ; Wed, 22 Jan 2020 23:10:39 -0800 (PST) Received: from redhat.com (bzq-79-176-0-156.red.bezeqint.net. [79.176.0.156]) by smtp.gmail.com with ESMTPSA id f1sm1888607wru.6.2020.01.22.23.10.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 23:10:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579763441; 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=eTnESgkc4Q1IE7eK3yhiRdRiKjKhsh/o/b9VSLnbvfo=; b=FbvRQWsjR2s0YC0HFxpmR4XsIEAog8l4rYeiAPPPLl66YgHMV2wUphJJQXTfw2gBhG1wxS XpxYq9MDtFGnvY3FhLK9sFSwP+ywtQwNc2X1KoHO3A8822VHeZblMxaMcCrFXPnYHCboen QH0akwJDxzecrClw70uei8zFFeZXyGc= 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=eAd3+nCoRQPzLOmjcY8CULrwvjv4VOu8uY/RSRtK8kQ=; b=LSOZCI1cl8bNe4WHEyzwbbihTXfeg1ni/FRV2bDcMchMQCDDGNELo4r7AmHw7/whKs dEJmf1aAQg0oyfEqtMFv2vq8PH+UFObo1BsiXPbg7l94inw0iPJZfAEnIVmfrxoe3wQd i2k8ezTItG5uEdS0Zh29oYZyvbAI6BvEtqk9trLZoW9YjPFIFwOWxRB05oc3ImahWdkv 4jHu8GiJwm8OtkPM++FRplQ0EuWY+mFZQ0NPP4BrJtQ3Rm4REKDZRPaWexX1w3drE55n 5ToBcrotjaHean1XBwA/f8TfdP9RwQDDccF/V6nRAfazQPVxD3/1qillrdcjkIWMSdlf 63fw== X-Gm-Message-State: APjAAAUKFuaKyrWxCB6pMXXVR5zH3mOm5FRx/EV0/3xKbuUswCrp/rwF T7dZT49uJgServ2xzq4faRxsxR3cX4DIgnWmG65ce2A7TYJ0LB7VBrjy/X6qgr1okh2sjUAnqk5 X4l4yOnU6YRrOMT4= X-Received: by 2002:a5d:4a8c:: with SMTP id o12mr15227755wrq.43.1579763437381; Wed, 22 Jan 2020 23:10:37 -0800 (PST) X-Google-Smtp-Source: APXvYqwzN3VAAz2iyEM6ziZRYkcooAJK6a5vGCwz2vG3AvnS7HPXkP9ZnZT+w598VRnZdw1IDosDQw== X-Received: by 2002:a5d:4a8c:: with SMTP id o12mr15227726wrq.43.1579763437166; Wed, 22 Jan 2020 23:10:37 -0800 (PST) Date: Thu, 23 Jan 2020 02:10:34 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v3 09/18] bios-tables-test: document expected file update Message-ID: <20200123070913.626488-10-mst@redhat.com> References: <20200123070913.626488-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200123070913.626488-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-MC-Unique: u1TTpu1tPHK1OuZW_TTEkg-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 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: Laurent Vivier , Peter Maydell , Thomas Huth , Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Document the flow for the case where contributor updates the expected files. Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index f1ac2d7e96..3ab4872bd7 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -16,7 +16,10 @@ * 1. add empty files for new tables, if any, under tests/data/acpi * 2. list any changed files in tests/bios-tables-test-allowed-diff.h * 3. commit the above *before* making changes that affect the tables - * Maintainer: + * + * Contributor or ACPI Maintainer (steps 4-7 need to be redone to resolve = conflicts + * in binary commit created in step 6): + * * After 1-3 above tests will pass but ignore differences with the expecte= d files. * You will also notice that tests/bios-tables-test-allowed-diff.h lists * a bunch of files. This is your hint that you need to do the below: @@ -28,13 +31,23 @@ * output. If not - disassemble them yourself in any way you like. * Look at the differences - make sure they make sense and match what the * changes you are merging are supposed to do. + * Save the changes, preferably in form of ASL diff for the commit log in + * step 6. * * 5. From build directory, run: * $(SRC_PATH)/tests/data/acpi/rebuild-expected-aml.sh - * 6. Now commit any changes. - * 7. Before doing a pull request, make sure tests/bios-tables-test-allowe= d-diff.h - * is empty - this will ensure following changes to ACPI tables will - * be noticed. + * 6. Now commit any changes to the expected binary, include diff from ste= p 4 + * in commit log. + * 7. Before sending patches to the list (Contributor) + * or before doing a pull request (Maintainer), make sure + * tests/bios-tables-test-allowed-diff.h is empty - this will ensure + * following changes to ACPI tables will be noticed. + * + * The resulting patchset/pull request then looks like this: + * - patch 1: list changed files in tests/bios-tables-test-allowed-diff.h. + * - patches 2 - n: real changes, may contain multiple patches. + * - patch n + 1: update golden master binaries and empty + * tests/bios-tables-test-allowed-diff.h */ =20 #include "qemu/osdep.h" --=20 MST From nobody Sat May 18 23:14:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579764007; cv=none; d=zohomail.com; s=zohoarc; b=T9lNbDIFQeorm3/S5tVEcMiN9d4p8bDIhNA7gOje/NHwer+2JaSSNhxR3dImra0bB12+Lctc5xiBKr+BZN0yhwnD58QdZsqspiEpdyu7/n1ziJ/Mw7XUkEzHPTvaiDkt6yhZm4JMKe3t5b8LYi2H3dyu8Is97f1+fgN9ntYEY/g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579764007; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7X8PjfcFHzdyIHec4OG6du8gOrCYueQPk/uwOaIht1o=; b=FmxsQ2rmodRKy2SSBLq66HnrpkID18jQBH6xuViL3oIAq0zLASjWXBdc9LUtqvwFa8U7D6ikhVZ0GO6af1mhNUeC4CLaX2gM8btLjWmTTgE1teanbWO+aqwYJ5DPsD0nK+cPUEQUt9iTSW02eCXdTuJsnGnevXoOcfODSi6UV6A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579764007566990.8125346941363; Wed, 22 Jan 2020 23:20:07 -0800 (PST) Received: from localhost ([::1]:52114 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWmc-00085z-9v for importer@patchew.org; Thu, 23 Jan 2020 02:20:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37424) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWdZ-0006FU-Pb for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iuWdY-0008Gu-L0 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:45 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:46630 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iuWdY-0008Gb-H1 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:44 -0500 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-198-6N3gqnW8PHS1P5tzNg9wqQ-1; Thu, 23 Jan 2020 02:10:42 -0500 Received: by mail-wr1-f69.google.com with SMTP id z15so1327349wrw.0 for ; Wed, 22 Jan 2020 23:10:41 -0800 (PST) Received: from redhat.com (bzq-79-176-0-156.red.bezeqint.net. [79.176.0.156]) by smtp.gmail.com with ESMTPSA id d23sm1845357wra.30.2020.01.22.23.10.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 23:10:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579763444; 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=7X8PjfcFHzdyIHec4OG6du8gOrCYueQPk/uwOaIht1o=; b=KgcNktffRDUUXeEPOywAIeDhYmcJzvR+USkYIKBD7Qq6TB2RB2rZAIdChJD/7510j3brxl 70pZ/GBoE1UaOvK9VCEsrKkhVlcV+H5/4nJeDU+D4WKcAKYm9UxQQdxD7xe2eIenQMke4H R0E6uoM0G2CFNtTBDDIjvqJlNVSmg0Q= 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=dKz9Yp7TsPHys5pVT0H9YPlrICr7T8Twac2SXPW2Rdw=; b=HGhvHKWFQtdugSjL8XJFg6O5QS7vxPYT3uIUTh7KvlyCMoT0YlMmlNKDWdRlCnYwxQ x+bGBbH8gWEzt5t0Fr34L48JVchjNSFfy4+VmI3g5X+RVXa878TmwPOLsHIKvc5X3Vd5 KPvXyUCCqzHQ9RFFFav8hqPpvQhuT4si0NVkhnpNS0U9rzSIz3OkHrhD1X5F1V/RZ8r5 gs3lJiGCtARnOZBM71MFyWOC1UycSwyMmpn5R31auoqmdTS4J4vIkooiyrJjirvsrzOM 0AsHnW3t0zqftlkFGKKvzBZ1JUVS72pMbxE+HiEyMRh97rekYnzwRfrpVbXDZfEInsnU nA7Q== X-Gm-Message-State: APjAAAUcznQ2vxaacCHDrab5SgIEugVjJnV5IvPGXNvjGz+mvK0u4W9i FF9jp53o49gtsGWvxtZzxTZpEcIAA0CDOxV/vXBIF+OcFcmfKutz1jC4ubzzlj0pX+Z5z8tXBgA SNKM+2/ELPXk8UWo= X-Received: by 2002:a5d:49c7:: with SMTP id t7mr15325031wrs.369.1579763440659; Wed, 22 Jan 2020 23:10:40 -0800 (PST) X-Google-Smtp-Source: APXvYqzl4O84SI0buRHLFNMhF+WhO00ttiWcJjo+dmPXyU6bx5rIrFPh57ygI6ZyhG6ygl4+zDLi+A== X-Received: by 2002:a5d:49c7:: with SMTP id t7mr15325009wrs.369.1579763440413; Wed, 22 Jan 2020 23:10:40 -0800 (PST) Date: Thu, 23 Jan 2020 02:10:38 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v3 10/18] virtio-9p-device: fix memleak in virtio_9p_device_unrealize Message-ID: <20200123070913.626488-11-mst@redhat.com> References: <20200123070913.626488-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200123070913.626488-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-MC-Unique: 6N3gqnW8PHS1P5tzNg9wqQ-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 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 , Christian Schoenebeck , Pan Nengyuan , Greg Kurz , Euler Robot Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Pan Nengyuan v->vq forgot to cleanup in virtio_9p_device_unrealize, the memory leak stack is as follow: Direct leak of 14336 byte(s) in 2 object(s) allocated from: #0 0x7f819ae43970 (/lib64/libasan.so.5+0xef970) ??:? #1 0x7f819872f49d (/lib64/libglib-2.0.so.0+0x5249d) ??:? #2 0x55a3a58da624 (./x86_64-softmmu/qemu-system-x86_64+0x2c14624) /mnt/s= db/qemu/hw/virtio/virtio.c:2327 #3 0x55a3a571bac7 (./x86_64-softmmu/qemu-system-x86_64+0x2a55ac7) /mnt/s= db/qemu/hw/9pfs/virtio-9p-device.c:209 #4 0x55a3a58e7bc6 (./x86_64-softmmu/qemu-system-x86_64+0x2c21bc6) /mnt/s= db/qemu/hw/virtio/virtio.c:3504 #5 0x55a3a5ebfb37 (./x86_64-softmmu/qemu-system-x86_64+0x31f9b37) /mnt/s= db/qemu/hw/core/qdev.c:876 Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Message-Id: <20200117060927.51996-2-pannengyuan@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Christian Schoenebeck Acked-by: Greg Kurz --- hw/9pfs/virtio-9p-device.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c index 991e175c82..ba35892940 100644 --- a/hw/9pfs/virtio-9p-device.c +++ b/hw/9pfs/virtio-9p-device.c @@ -218,6 +218,7 @@ static void virtio_9p_device_unrealize(DeviceState *dev= , Error **errp) V9fsVirtioState *v =3D VIRTIO_9P(dev); V9fsState *s =3D &v->state; =20 + virtio_del_queue(vdev, 0); virtio_cleanup(vdev); v9fs_device_unrealize_common(s, errp); } --=20 MST From nobody Sat May 18 23:14:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579763789; cv=none; d=zohomail.com; s=zohoarc; b=iBEwQO1hR3Yls0sDYOl6RBkSvctwp/qSTXQ6yySaIyHVi9ehS3l5y3SULnz8NCMT5guYDOhOGJtcHMNxdqg0f+4zvhn3e2qHDUxb5j/mNAXS+f8ACIt4iZeBBsoURnMV/UhfmDXFsYWbzFJdUyT27kbV9Uvm+QqpFhD1NBF0aQk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579763789; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WBcIJ+XtEg+ynI5J149ubW51ZuYdwReRoLvMT6MynBM=; b=EnP+B/t9VRBce8++c6XizDqvUCtkinG6p0Wp6C+c/UqrED9xfvpJE7X4vnQouMTLlNB6ks8/I1vuZ79NHQ/gZqSy8y2wxMpgCHO3r/MgALvLKQdgIuU5guW/0LVXmEJ6XdOWbytSOpIjOBnC2bJhATZZX1hNclyvVwkhJmay5+c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579763789172389.6597173335807; Wed, 22 Jan 2020 23:16:29 -0800 (PST) Received: from localhost ([::1]:52074 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWj6-0003fG-3r for importer@patchew.org; Thu, 23 Jan 2020 02:16:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37452) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWde-0006NI-MX for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iuWdd-0008KB-Mq for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:50 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:40704 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iuWdd-0008K3-Ik for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:49 -0500 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-23-ttwloaPeN-K6rpFFxI3-Ww-1; Thu, 23 Jan 2020 02:10:45 -0500 Received: by mail-wr1-f72.google.com with SMTP id t3so1266045wrm.23 for ; Wed, 22 Jan 2020 23:10:45 -0800 (PST) Received: from redhat.com (bzq-79-176-0-156.red.bezeqint.net. [79.176.0.156]) by smtp.gmail.com with ESMTPSA id w83sm1388709wmb.42.2020.01.22.23.10.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 23:10:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579763449; 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=WBcIJ+XtEg+ynI5J149ubW51ZuYdwReRoLvMT6MynBM=; b=gtrJ7eRI1bWOswNjKAUiDknszs3Uoihw5It7tOc9fTDKvDe/cezoe1ZA3eNvAZEkceEFAC m2FhXUJ88aubsnqzYG2Dc1IgBO5lx2ynLqTDO1H8cpRavTt7wfCTSqUTn4OG6uV8iRX/O7 b/0hmmksGKQMYdes05lVc2OHOwkj600= 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=crW7LUnM5y+vbTajSaV+13MSOoh5cZCcUuqLsKZn8gg=; b=itCHtLjMks6b02ASw5aw/V+mo8lkTtUBFpkz7zEY6l/TQBsNSsz9VwhUke+N6D4Zzm j70GNEyqIJUWO/e71GFWyAAJLPE/FSE60slIt25WuCJoVmBiA/CP+04DU+4tGTHxSH6r SNqs70ZI8TYwBbsMt9kXsEhaoV6qD9QQhrhV7AwPfAdwipTZ28uzq0o5f6QaFWZME3Rk noc3fM99HGfbnQmWcqQZOfkcPciw/+G5c0TFj328GjF69L6Byemark93Fu537D8nRWAy AXitu+et1Q+zhA/d4n7AktlIZKo1YKn6IeiHZ1HD+3qwRHRE1J7G0sGJ9t9EXScEurIo A2dw== X-Gm-Message-State: APjAAAVdLoCKtixmeXG5GNZw24ynsv2/EsReyfQwMbcC2u/Q9u8N5TUJ Ti4OdrrudYM0UUNuQ1LeUYIaKqIZ6onde9TmBcYb4WBmFRidRjbD5mvjqpQnwGCe9w55i0n2BO9 Kz1ShgFQ53J5Fx/I= X-Received: by 2002:adf:a141:: with SMTP id r1mr14581458wrr.285.1579763443774; Wed, 22 Jan 2020 23:10:43 -0800 (PST) X-Google-Smtp-Source: APXvYqxj+GrKspIpNxhPKJqGA5fUm/32iQYPkKyyGPVleKZfLUSZ9cQmEZU1iKDHvjTufd7sb3P7ug== X-Received: by 2002:adf:a141:: with SMTP id r1mr14581436wrr.285.1579763443584; Wed, 22 Jan 2020 23:10:43 -0800 (PST) Date: Thu, 23 Jan 2020 02:10:41 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v3 11/18] virtio-9p-device: convert to new virtio_delete_queue Message-ID: <20200123070913.626488-12-mst@redhat.com> References: <20200123070913.626488-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200123070913.626488-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-MC-Unique: ttwloaPeN-K6rpFFxI3-Ww-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 207.211.31.81 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 , Christian Schoenebeck , Pan Nengyuan , Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Pan Nengyuan Use virtio_delete_queue to make it more clear. Signed-off-by: Pan Nengyuan Message-Id: <20200117060927.51996-3-pannengyuan@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Acked-by: Christian Schoenebeck --- hw/9pfs/virtio-9p-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c index ba35892940..1d1c50409c 100644 --- a/hw/9pfs/virtio-9p-device.c +++ b/hw/9pfs/virtio-9p-device.c @@ -218,7 +218,7 @@ static void virtio_9p_device_unrealize(DeviceState *dev= , Error **errp) V9fsVirtioState *v =3D VIRTIO_9P(dev); V9fsState *s =3D &v->state; =20 - virtio_del_queue(vdev, 0); + virtio_delete_queue(v->vq); virtio_cleanup(vdev); v9fs_device_unrealize_common(s, errp); } --=20 MST From nobody Sat May 18 23:14:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579764003; cv=none; d=zohomail.com; s=zohoarc; b=ih/kylQmssJvyONJuceE6/QOPUCcaVtABTilRAvNwYX64M/bBD3HlFQetMxr0AsUz7bOrvNZr/+x9tOkWt0EJuY3Jha4wB5ce4HdOgDlb0DY12cXJtyLqrY5yR8IsMrrrkxafsGuuzQ1mgpyAINaCys5dBku1w+6c/TqPXeEZcg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579764003; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EE2u/AAZTtiTF3BR1usKNAN0L1IlKKsiavRWKotl39g=; b=TayIVqFw/W4E/onwAqfv4kusfcJJfoM4W0o+DTVLV+b5n5K6VHPqNNxOgde5W3x4OO+9SA4b++J/iwmUViv9DaUqRgYFSGIThxgwPntSEo7uPZZAgdTxiNOjSUvzTZzSXjkFsMD/i5hJGUErJ0TFa6RWoiwz204XXCSx+U6SVVc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157976400311132.552423684169185; Wed, 22 Jan 2020 23:20:03 -0800 (PST) Received: from localhost ([::1]:52110 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWmX-00080p-Uz for importer@patchew.org; Thu, 23 Jan 2020 02:20:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37466) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWdh-0006Q6-9S for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iuWdf-0008Lo-2q for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:53 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:26573 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iuWde-0008LF-Va for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:51 -0500 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-364-EKs5JKD7Myah2lhb6VqUXQ-1; Thu, 23 Jan 2020 02:10:48 -0500 Received: by mail-wm1-f69.google.com with SMTP id b133so609745wmb.2 for ; Wed, 22 Jan 2020 23:10:48 -0800 (PST) Received: from redhat.com (bzq-79-176-0-156.red.bezeqint.net. [79.176.0.156]) by smtp.gmail.com with ESMTPSA id g79sm509792wme.17.2020.01.22.23.10.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 23:10:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579763450; 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=EE2u/AAZTtiTF3BR1usKNAN0L1IlKKsiavRWKotl39g=; b=G6J0SbNSvA21i+nNmKZ+/Sb9jdy6jbMHKkIIsnfv0zVZigVJtt6DU1FZtaRhs/wJrkrv0d eJyWYsDjIugyORduf6L0gnPvHC67gqcslxq9bnfDuCwQz1JnQvm4y6F8MGcxKA42iTvQHo nlhVEfv5cNuVG6cNdjjb+CjV3O7gnSo= 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=uL+2BTDQ25Kv4JEooHriCyXb60bUBMFr6mqaTgyAVpc=; b=fDqw4KfQW5irpq+K4XV4nXVy97dz7MTzP3LOyjNzZgjrEc7sLzGxoR6MQFijE6u2fy ZheYQaqbj+IO5HUPzGAS9fiLKPue8HA9miDbfpdqcLBwgCwFnP+jvufgW2jATuS9hm6m 6UEGyFDu7fI4HGWTdjX5m5/etRIf9ICtio+VpdRH1KG0D0iWFyaOjR9pxFcMyF1qdLdg 7srfKQ3F+3kyzkgOtXGF9ucLEmoHIRFNv2vE7cB85IPhnvp9yg7Nbbj+6V3gemtinNBD 9jTAzGVWH2ECn8GR5z3SsC0QjvHJOicasZDz5tVDoUCJx8SyClHDuwAjrz0US/xuEJ+g nOVA== X-Gm-Message-State: APjAAAXrJ27JrP5o9exGtLxZSHW4kmkGL/rdY4A/n0lLI9BEkamK2Tbf xWrdbv0pmOq9JdBC3lFuSntP15BlH5q8FqpW21OlvkJeS5RfYBStcndpjnzzX6mrJMf9sqCAAVB vGOyfJWDEfRhke54= X-Received: by 2002:a7b:c3d7:: with SMTP id t23mr2487223wmj.33.1579763447168; Wed, 22 Jan 2020 23:10:47 -0800 (PST) X-Google-Smtp-Source: APXvYqwD24tbLy1+JPJJtuocF4uodx6o5eIxJ5Vkykd56QNSfLvaEcY5VJOaQU5Lv38VDSWD6/9LaQ== X-Received: by 2002:a7b:c3d7:: with SMTP id t23mr2487208wmj.33.1579763446957; Wed, 22 Jan 2020 23:10:46 -0800 (PST) Date: Thu, 23 Jan 2020 02:10:44 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v3 12/18] virtio-scsi: delete vqs in unrealize to avoid memleaks Message-ID: <20200123070913.626488-13-mst@redhat.com> References: <20200123070913.626488-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200123070913.626488-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-MC-Unique: EKs5JKD7Myah2lhb6VqUXQ-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 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 , Pan Nengyuan , Stefan Hajnoczi , Euler Robot , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Pan Nengyuan This patch fix memleaks when attaching/detaching virtio-scsi device, the memory leak stack is as follow: Direct leak of 21504 byte(s) in 3 object(s) allocated from: #0 0x7f491f2f2970 (/lib64/libasan.so.5+0xef970) ??:? #1 0x7f491e94649d (/lib64/libglib-2.0.so.0+0x5249d) ??:? #2 0x564d0f3919fa (./x86_64-softmmu/qemu-system-x86_64+0x2c3e9fa) /mnt/s= db/qemu/hw/virtio/virtio.c:2333 #3 0x564d0f2eca55 (./x86_64-softmmu/qemu-system-x86_64+0x2b99a55) /mnt/s= db/qemu/hw/scsi/virtio-scsi.c:912 #4 0x564d0f2ece7b (./x86_64-softmmu/qemu-system-x86_64+0x2b99e7b) /mnt/s= db/qemu/hw/scsi/virtio-scsi.c:924 #5 0x564d0f39ee47 (./x86_64-softmmu/qemu-system-x86_64+0x2c4be47) /mnt/s= db/qemu/hw/virtio/virtio.c:3531 #6 0x564d0f980224 (./x86_64-softmmu/qemu-system-x86_64+0x322d224) /mnt/s= db/qemu/hw/core/qdev.c:865 Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Message-Id: <20200117075547.60864-2-pannengyuan@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Stefan Hajnoczi --- hw/scsi/virtio-scsi.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 4bc73a370e..858b3aaccb 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -943,7 +943,13 @@ void virtio_scsi_common_unrealize(DeviceState *dev) { VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(dev); + int i; =20 + virtio_del_queue(vdev, 0); + virtio_del_queue(vdev, 1); + for (i =3D 0; i < vs->conf.num_queues; i++) { + virtio_del_queue(vdev, i + 2); + } g_free(vs->cmd_vqs); virtio_cleanup(vdev); } --=20 MST From nobody Sat May 18 23:14:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579763931; cv=none; d=zohomail.com; s=zohoarc; b=DEa16eM8LHqaHWVc7nZWGmdtEvEPnzKhBFqRQCUq3GcnixBTxWMuKae4bsCTAUSfKfzFRii4YBgXB/zEP/E/qRGi0EGg5dPI+heRjmpH2ePJulyf1z8zN/35J60BtYPtaPpWC9VbA5XSYo5zpPHW+0IvMJtShXl01DSlRpEIOmE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579763931; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1MaCdSCC18sa84xXKLha22neuWnQ0FyF+hqtGDwgw+w=; b=VucvSEpAYr0T7/clqqjv7R0R3jlBCI8GLymS7HkGlf0pILjzFXvDm3S4uyZeSlnRZGiO2ivQOsYJ0vguwkQ3aTelAxwemxUb+3EFae/V9borFB4u/63J+p/ehFSseDfVvKfcsAm55HSLkHGg3UFpa7vL4Z+dQ02uVxZqNisYkvE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15797639317361009.0446198591615; Wed, 22 Jan 2020 23:18:51 -0800 (PST) Received: from localhost ([::1]:52096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWlN-0006Jq-JZ for importer@patchew.org; Thu, 23 Jan 2020 02:18:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37484) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWdi-0006SQ-OI for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iuWdh-0008ON-QF for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:54 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:24078 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iuWdh-0008OD-Nj for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:53 -0500 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-131-iUGiP2cdPkm6IAhHvB2Ugg-1; Thu, 23 Jan 2020 02:10:51 -0500 Received: by mail-wm1-f70.google.com with SMTP id z2so243758wmf.5 for ; Wed, 22 Jan 2020 23:10:51 -0800 (PST) Received: from redhat.com (bzq-79-176-0-156.red.bezeqint.net. [79.176.0.156]) by smtp.gmail.com with ESMTPSA id p5sm1781351wrt.79.2020.01.22.23.10.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 23:10:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579763453; 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=1MaCdSCC18sa84xXKLha22neuWnQ0FyF+hqtGDwgw+w=; b=OKTkr3ws/Qk/kXTHbIkCAOsQaxsUuFJ5fHk1LfJVCMARy9quCspG/wUy3wpOT9qdaLTPBP dd3aFhlj2LxmsSj+/pV4q9rKuY38jvMIpSM6CrgJAqbJsLdtKKH/Yb4uquc/gbOAL2lTFr OMHD7JwK0ac2u7chVvqGsbVMCeH0BEQ= 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=JmSFm2DvEaju83wiB8EwbENmzUyJC9M0V+2bn9XbrpU=; b=KDDjHhyWk1fwT6inegnUgQa5Yyyh/t8DEegXYKc283ufy7Fm7H4nTOnH2+qw0zvRD+ Fv2K6s4KaZuFfE+e3XLKYGj/UYG9p5kJNesESEEpPmqVyO4oLKANR413QjIGEi2s+RyE H2M+BQy15oHDohouAd78pWEzcvc5lVA+fBiiNRxeuCzWdZ3by/RqiU0ajGYz3QUEb9XF U+QZ7BqqiNdZ0LBisghNSon/DjVeZ42pxRpn1ep4eG1Nc5dqanLqhIPluFCoiSla1L4q AZd0aGF8cRtLipoV33KiWGMdEj9fSDRUPr/ctODvomirWtjmM9g1oTcQ5/lkQ9xlDg69 yGNA== X-Gm-Message-State: APjAAAUzijHBjqHPOQN79jbDyPcaD86NDcKDMzHAxOp1PvMfAIPeU33Z vAiWpfW9RWWFaIbiWRJhZmJ4z+ywXmlilpiA/8zs5Q1xvVgL5vxqAcoOuyrVJS6EzFCGPvOLRWZ nbcwT4BZfV9c90vo= X-Received: by 2002:a05:600c:22d3:: with SMTP id 19mr2462251wmg.20.1579763450158; Wed, 22 Jan 2020 23:10:50 -0800 (PST) X-Google-Smtp-Source: APXvYqyX91Oz/AP/cCNyEUMSD0zZcgLNBF6XWbTUBwQc5ZFDUR+UVkZ6rwBzgLfrEU8xe0L/TMHwCQ== X-Received: by 2002:a05:600c:22d3:: with SMTP id 19mr2462238wmg.20.1579763449993; Wed, 22 Jan 2020 23:10:49 -0800 (PST) Date: Thu, 23 Jan 2020 02:10:47 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v3 13/18] virtio-scsi: convert to new virtio_delete_queue Message-ID: <20200123070913.626488-14-mst@redhat.com> References: <20200123070913.626488-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200123070913.626488-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-MC-Unique: iUGiP2cdPkm6IAhHvB2Ugg-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 207.211.31.81 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 , Pan Nengyuan , Stefan Hajnoczi , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Pan Nengyuan Use virtio_delete_queue to make it more clear. Signed-off-by: Pan Nengyuan Message-Id: <20200117075547.60864-3-pannengyuan@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Stefan Hajnoczi --- hw/scsi/virtio-scsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 858b3aaccb..d3af42ef92 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -945,10 +945,10 @@ void virtio_scsi_common_unrealize(DeviceState *dev) VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(dev); int i; =20 - virtio_del_queue(vdev, 0); - virtio_del_queue(vdev, 1); + virtio_delete_queue(vs->ctrl_vq); + virtio_delete_queue(vs->event_vq); for (i =3D 0; i < vs->conf.num_queues; i++) { - virtio_del_queue(vdev, i + 2); + virtio_delete_queue(vs->cmd_vqs[i]); } g_free(vs->cmd_vqs); virtio_cleanup(vdev); --=20 MST From nobody Sat May 18 23:14:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579764180; cv=none; d=zohomail.com; s=zohoarc; b=F3+L3V0/5upXijD0cIInxySJ75zfJd2I8ddr+uKZ00qSl/By4HZm197sClCZdoNlIKimMuZgUXgrDLIA7uODf417a+hp2rIaaTr+iD2neUT6W3b1u5rCToaKd4xSvLBLHcq+DD31+znnWFAfkMqWtTpCqvwrqenSPCFYPDip4q0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579764180; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Fvu/JejnrpbIYjtd6kH0elorwKES/+22eaULELxAawU=; b=Hq3jfOeJwa+TecDGwzfEWcyGitzDDc41mjPQEmDUTMHKYQLXHmgjRiAdaYbQMGQI+9Y6A6gNby8Lv3TdmARPRt+6Qp+O25YOkcRx9hwDVKpAEInrHlXI5NSU9BgqcGdVB7tR6sH66i4XbdiFDhXT3D1SZGaIyBWDxVH80uTGmN8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579764180777674.7307338089325; Wed, 22 Jan 2020 23:23:00 -0800 (PST) Received: from localhost ([::1]:52156 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWpP-0002la-AF for importer@patchew.org; Thu, 23 Jan 2020 02:22:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37514) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWdm-0006Yl-8O for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iuWdk-0008RW-TX for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:58 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:38662 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iuWdk-0008QD-Pa for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:10:56 -0500 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-305-0SNh41DJNQG5gpU81litbA-1; Thu, 23 Jan 2020 02:10:54 -0500 Received: by mail-wr1-f69.google.com with SMTP id h30so1312318wrh.5 for ; Wed, 22 Jan 2020 23:10:54 -0800 (PST) Received: from redhat.com (bzq-79-176-0-156.red.bezeqint.net. [79.176.0.156]) by smtp.gmail.com with ESMTPSA id a1sm1481349wmj.40.2020.01.22.23.10.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 23:10:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579763456; 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=Fvu/JejnrpbIYjtd6kH0elorwKES/+22eaULELxAawU=; b=ax+AZiBEuc/q8eoWYzgzo15hNIKz9eT41IaQkjz6Nac8wFu3TRNuspyiJvb9OinqTJCOeW LJl7fG+WAGGe1hlre9e2nT6bXY6Dw855w/55F0Gsjlxn3kCw6/Yxpqy8NViiMiBh3LIvOo i3iikr/xT23FReWa5/hBRR1ecXykHH4= 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=Pvkfe/62fecBB0WaC+0Ls5admcVzWgltEZR0OGv8pe0=; b=RVgaQDKMePtVfljcS8gfLhpIGMothCPQ7PK0ud2FjN0oBCCLBZTr3JcOCA9B4c1NuI c7ttWW541nWN6jJ2cdBPnxkRlIS6/P99SBlzz/kBUY6wSoWRFbDAtS40R5QhimlvQpl8 4Tb3eKHCVhXZUClYCO/gswVcnsonv4H06LtOxkhZaZigkAwtAl/vAptuHIALoOyIE/1v CD8qmtztjs7RbGSlSysAOb1YkRSOLvf8BGgcrpMoMKlsjn+NWvj9MOmHD4WvH8HU54Ku 839XbV7POTPHdrMepUvMuUBG52Y9AprcbhzOukzeXXn5nEDnAKD1hTYrE4fB5xdThxab BSyA== X-Gm-Message-State: APjAAAVdr8TILxSxgW7u09misa3hxLJJH7+/5uhfxC+6a4rtcnAvwyF2 cY0vDoFbZbLBOxS6aowtIHBMPYR7+wcNBgRZ7Wa4rRf4eijPbwpkN2pua3+WfSt3SroGvcPbU0B prD50kjBWwLf7Pnw= X-Received: by 2002:a5d:46d0:: with SMTP id g16mr15314162wrs.287.1579763453071; Wed, 22 Jan 2020 23:10:53 -0800 (PST) X-Google-Smtp-Source: APXvYqx57RUb/rDO/ecikoUtDTGTPZJuyiwsSSVYDlvVLrtIIEzXlGrJNHc5a9wgCCLQlsAyy4yjow== X-Received: by 2002:a5d:46d0:: with SMTP id g16mr15314145wrs.287.1579763452828; Wed, 22 Jan 2020 23:10:52 -0800 (PST) Date: Thu, 23 Jan 2020 02:10:50 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v3 14/18] vhost-vsock: delete vqs in vhost_vsock_unrealize to avoid memleaks Message-ID: <20200123070913.626488-15-mst@redhat.com> References: <20200123070913.626488-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200123070913.626488-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-MC-Unique: 0SNh41DJNQG5gpU81litbA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 207.211.31.81 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 , Stefano Garzarella , Pan Nengyuan , Stefan Hajnoczi , Euler Robot Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Pan Nengyuan Receive/transmit/event vqs forgot to cleanup in vhost_vsock_unrealize. This patch save receive/transmit vq pointer in realize() and cleanup vqs through those vq pointers in unrealize(). The leak stack is as follow: Direct leak of 21504 byte(s) in 3 object(s) allocated from: #0 0x7f86a1356970 (/lib64/libasan.so.5+0xef970) ??:? #1 0x7f86a09aa49d (/lib64/libglib-2.0.so.0+0x5249d) ??:? #2 0x5604852f85ca (./x86_64-softmmu/qemu-system-x86_64+0x2c3e5ca) /mnt/s= db/qemu/hw/virtio/virtio.c:2333 #3 0x560485356208 (./x86_64-softmmu/qemu-system-x86_64+0x2c9c208) /mnt/s= db/qemu/hw/virtio/vhost-vsock.c:339 #4 0x560485305a17 (./x86_64-softmmu/qemu-system-x86_64+0x2c4ba17) /mnt/s= db/qemu/hw/virtio/virtio.c:3531 #5 0x5604858e6b65 (./x86_64-softmmu/qemu-system-x86_64+0x322cb65) /mnt/s= db/qemu/hw/core/qdev.c:865 #6 0x5604861e6c41 (./x86_64-softmmu/qemu-system-x86_64+0x3b2cc41) /mnt/s= db/qemu/qom/object.c:2102 Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Message-Id: <20200115062535.50644-1-pannengyuan@huawei.com> Reviewed-by: Stefano Garzarella Reviewed-by: Stefan Hajnoczi Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost-vsock.h | 2 ++ hw/virtio/vhost-vsock.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/hw/virtio/vhost-vsock.h b/include/hw/virtio/vhost-vsoc= k.h index d509d67c4a..bc5a988ee5 100644 --- a/include/hw/virtio/vhost-vsock.h +++ b/include/hw/virtio/vhost-vsock.h @@ -33,6 +33,8 @@ typedef struct { struct vhost_virtqueue vhost_vqs[2]; struct vhost_dev vhost_dev; VirtQueue *event_vq; + VirtQueue *recv_vq; + VirtQueue *trans_vq; QEMUTimer *post_load_timer; =20 /*< public >*/ diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c index f5744363a8..b6cee479bb 100644 --- a/hw/virtio/vhost-vsock.c +++ b/hw/virtio/vhost-vsock.c @@ -335,8 +335,10 @@ static void vhost_vsock_device_realize(DeviceState *de= v, Error **errp) sizeof(struct virtio_vsock_config)); =20 /* Receive and transmit queues belong to vhost */ - virtio_add_queue(vdev, VHOST_VSOCK_QUEUE_SIZE, vhost_vsock_handle_outp= ut); - virtio_add_queue(vdev, VHOST_VSOCK_QUEUE_SIZE, vhost_vsock_handle_outp= ut); + vsock->recv_vq =3D virtio_add_queue(vdev, VHOST_VSOCK_QUEUE_SIZE, + vhost_vsock_handle_output); + vsock->trans_vq =3D virtio_add_queue(vdev, VHOST_VSOCK_QUEUE_SIZE, + vhost_vsock_handle_output); =20 /* The event queue belongs to QEMU */ vsock->event_vq =3D virtio_add_queue(vdev, VHOST_VSOCK_QUEUE_SIZE, @@ -363,6 +365,9 @@ static void vhost_vsock_device_realize(DeviceState *dev= , Error **errp) err_vhost_dev: vhost_dev_cleanup(&vsock->vhost_dev); err_virtio: + virtio_delete_queue(vsock->recv_vq); + virtio_delete_queue(vsock->trans_vq); + virtio_delete_queue(vsock->event_vq); virtio_cleanup(vdev); close(vhostfd); return; @@ -379,6 +384,9 @@ static void vhost_vsock_device_unrealize(DeviceState *d= ev, Error **errp) vhost_vsock_set_status(vdev, 0); =20 vhost_dev_cleanup(&vsock->vhost_dev); + virtio_delete_queue(vsock->recv_vq); + virtio_delete_queue(vsock->trans_vq); + virtio_delete_queue(vsock->event_vq); virtio_cleanup(vdev); } =20 --=20 MST From nobody Sat May 18 23:14:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579764178; cv=none; d=zohomail.com; s=zohoarc; b=BTc0jQF1T4xpYT6AKXAP8jsGYanrX9fTJiKOu57Joxn7x5abefL9wIYBzxWFABqfoget3lIHlUbDYBUa2Teyarcs+qm9rcG8IIk/EARb9Wl61LtLMTzxEhLZLQaWsCD12g5xj6VIK0nfhuALakVnd1MiHHGKnOtdAvES+S3Yuhc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579764178; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rfFv49LFSLdXK1/7HJzZJqCabeu5CMr+Q9T61Qs2V4s=; b=Eto7LW6rn4PPHPxEQTD3nZTYxYwckBklB397PnPGtVAZUtfB+lQHajUEAqwUpG/3if5L4W6uNDPoJcPHs6Chea1rTpbN4q/s8/eTFsUE/YrUJ4zxSWdnrolJbx4xziacTYTUXeVUR+mjawFh9yMw7Y6ei0mQjsCc407ESNdqUAg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579764178096923.5545098233216; Wed, 22 Jan 2020 23:22:58 -0800 (PST) Received: from localhost ([::1]:52148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWpM-0002gK-EZ for importer@patchew.org; Thu, 23 Jan 2020 02:22:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37545) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWdq-0006gI-KM for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:11:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iuWdp-000057-Kq for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:11:02 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:36834 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iuWdp-0008Vh-GY for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:11:01 -0500 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-375-EdXJv-HhOYimLgGB01mgtg-1; Thu, 23 Jan 2020 02:10:57 -0500 Received: by mail-wm1-f71.google.com with SMTP id t16so606769wmt.4 for ; Wed, 22 Jan 2020 23:10:57 -0800 (PST) Received: from redhat.com (bzq-79-176-0-156.red.bezeqint.net. [79.176.0.156]) by smtp.gmail.com with ESMTPSA id c2sm1808733wrp.46.2020.01.22.23.10.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 23:10:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579763461; 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=rfFv49LFSLdXK1/7HJzZJqCabeu5CMr+Q9T61Qs2V4s=; b=AvcxUVB4RCizMNNX+8xrswZivYulAf6IhxKDpfLA+e5W2rVHGMTZi0qF0lziuu/e4GOBn7 w+owA6CaV06hQMzyQX0xpN9PmaCrI80Ze8jcjkOJSv8rn4Xtsi2odX8nniJw50Xd5vCWzF iFD2AWyRSlRcV45nLmlQSz1LrKy5WB0= 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=EdvlCEDlyygl5LZfs8930w7NjWVUhDfxRmswNGuyQBQ=; b=P1xl/GyCIQGJ8ZcS+Y/NlIPwHIW84e3FFGRn91wroLgGBSRmMj9WXlLPkqM7PL62QG rYsSVEo07phInB3A63FLQ2I7Zz2R5CCqGPEAWKPCLnnwHtNxdKQVH1xkPe94wbhoJCoB SHh9cRtnIQSvCFbvhg12sYmAKy1csjo2aiQ2z9wpcKmQwUoguzO2HVvP1obWzzAj965Y 0roKFepD0oaJhjTAdwt7obQF022k6vO2QsVPMPplRlQu2Vz6YDap2Bg5rfdXhqA808Gj IKfrBV6koU+osDf4AO4UolsKLk/RwjQ/Khd7CUbrVuyuXCTp3VtJfZ9nyeoN4XtujqoM u5zw== X-Gm-Message-State: APjAAAV9nSW+dCquv73MU9VFjyOe+REtrBOwOoaBw+t5uvhqV6M90yGJ GmRvKJjbLg/hdY8v5rBgbA1tcjxVGDcmyXM7cHnPjxPT3wpDu0tEQTxDlChMeV1XXptSoVUVSgs toVp8l39A/34xi0Y= X-Received: by 2002:a1c:488a:: with SMTP id v132mr2498159wma.153.1579763456133; Wed, 22 Jan 2020 23:10:56 -0800 (PST) X-Google-Smtp-Source: APXvYqxy2KBbN9jBKdsimGRfOQOZiia3qxi7WRpKHhucsSTf8cgGd4oIC9ht/yvb+ze3tytaIkxwwQ== X-Received: by 2002:a1c:488a:: with SMTP id v132mr2498146wma.153.1579763455966; Wed, 22 Jan 2020 23:10:55 -0800 (PST) Date: Thu, 23 Jan 2020 02:10:53 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v3 15/18] vhost: Add names to section rounded warning Message-ID: <20200123070913.626488-16-mst@redhat.com> References: <20200123070913.626488-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200123070913.626488-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-MC-Unique: EdXJv-HhOYimLgGB01mgtg-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 207.211.31.81 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 , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" Add the memory region names to section rounding/alignment warnings. Signed-off-by: Dr. David Alan Gilbert Message-Id: <20200116202414.157959-2-dgilbert@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 4da0d5a6c5..774d87d98e 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -590,9 +590,10 @@ static void vhost_region_add_section(struct vhost_dev = *dev, * match up in the same RAMBlock if they do. */ if (mrs_gpa < prev_gpa_start) { - error_report("%s:Section rounded to %"PRIx64 - " prior to previous %"PRIx64, - __func__, mrs_gpa, prev_gpa_start); + error_report("%s:Section '%s' rounded to %"PRIx64 + " prior to previous '%s' %"PRIx64, + __func__, section->mr->name, mrs_gpa, + prev_sec->mr->name, prev_gpa_start); /* A way to cleanly fail here would be better */ return; } --=20 MST From nobody Sat May 18 23:14:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579764328; cv=none; d=zohomail.com; s=zohoarc; b=e/MJQFOwW8bOx45ResySZu9iTrYcQ8PLfkW25Hhf1YwCK1Wr6TbWU/SYWi7Xax5/vUxui9YqgKZyeyuV4eOHtlzuBWe7gTLZBRlcJR4A4Ynkesz+9bzvnWOWNVsDA4QlCkEb9wNyv/8kflUfvPsqk6625bH+rzR+nVRxH5sp3Mw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579764328; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=sUTzXG5c0P/cfpSyLzCfAtskYDWEcm5+URpIdvpUQzQ=; b=k0ZuA1Kb4pQMWMyZ5mu5aUdI3jIfyFneOiIykfMd0T/hxIGWp3RIZ1LEMX3Of/AziSPUqUoOnz0WP0Dsqh5L22PQHsAcPUEZwx7USCPpyEscaqFOcK0sML/uRXT6TaiGeSJJyMC8523tYj0bcSENwZNrDEPejsDiSY0oXR5c2PY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579764328824762.3389495195356; Wed, 22 Jan 2020 23:25:28 -0800 (PST) Received: from localhost ([::1]:52178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWrn-00060H-OY for importer@patchew.org; Thu, 23 Jan 2020 02:25:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37553) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWds-0006hB-1H for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:11:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iuWdq-00006f-Sm for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:11:03 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:34075 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iuWdq-00005x-PP for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:11:02 -0500 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-105-2Dm5adrUOZ6qLLKclhud7A-1; Thu, 23 Jan 2020 02:11:00 -0500 Received: by mail-wm1-f69.google.com with SMTP id s25so246616wmj.3 for ; Wed, 22 Jan 2020 23:11:00 -0800 (PST) Received: from redhat.com (bzq-79-176-0-156.red.bezeqint.net. [79.176.0.156]) by smtp.gmail.com with ESMTPSA id p5sm1781767wrt.79.2020.01.22.23.10.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 23:10:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579763462; 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=sUTzXG5c0P/cfpSyLzCfAtskYDWEcm5+URpIdvpUQzQ=; b=Y4QqMYgemMU0WV0KX4L4mfgcDyobmD4TtMOzV/7bx5yNu491fsDn7TS9moFEuRfnJoGKUF C7sXaDqXl8G1vbIOcXHl58SRpwfppPqSzJMsCxUXKosJwyxCJGZwiGopBD/qszZtu1/O3o 6DpLlD5pe2JU0kiJiLQ7vC8iBr0RgP8= 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=miOqrXp0EkoFa9QINKw9BvmGX6vXumq1+xiaY2GCJjQ=; b=bkowB6E1/uScpM1SHCVUV91afcCRM8puy5EtmxSxvmnAaNxCptJ8yRg89beQ58Sw8z dqHpmnCYJMBxtwYEc9kaALbQs2GorrcRWKjH4vLCWgtZ4uqeNvbhvN0E+ZnbL/3mdl2a 35w5dXrMl8ZdLMw0fd143Zdsllvc+gEj0c5MhA4Zk6+5msk5N88isSdkYyYC1NmoBJBd XHzveI+nPlHAOzr+PO58C/G/D+zUMls1PA5MpVXU0EqYL/GTs7T4xyfFDoFy6IiubxP7 3fdmQLPQywHPsmQEEURYoM2sEeCPBpWULTO1H21osCxsdmfSAEq9VBeZ0GjtXVSpclAr NoWQ== X-Gm-Message-State: APjAAAX6Rbs6c8jMOAY/zGY5IBnBTsxGD2WD8Rp/eZXzbx3mi4ZkAnqu dl8qDMK4J4pkeh912TBDOpmZ8bDwugst2h/yZ8PezdUvT8/hteijOB9bI1MHVZrpzjDxA6UANh6 FTOMCDUeDGOhrl74= X-Received: by 2002:a1c:b603:: with SMTP id g3mr2568056wmf.133.1579763458964; Wed, 22 Jan 2020 23:10:58 -0800 (PST) X-Google-Smtp-Source: APXvYqzicJq7F0guYantwv0HY45kVW/mwOgBX4YnxA5Zp098qEtSFopNkz+xKlTploPpYuGBdfw87Q== X-Received: by 2002:a1c:b603:: with SMTP id g3mr2568035wmf.133.1579763458749; Wed, 22 Jan 2020 23:10:58 -0800 (PST) Date: Thu, 23 Jan 2020 02:10:56 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v3 16/18] vhost: Only align sections for vhost-user Message-ID: <20200123070913.626488-17-mst@redhat.com> References: <20200123070913.626488-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200123070913.626488-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-MC-Unique: 2Dm5adrUOZ6qLLKclhud7A-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 207.211.31.81 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 , "Dr. David Alan Gilbert" , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" I added hugepage alignment code in c1ece84e7c9 to deal with vhost-user + postcopy which needs aligned pages when using userfault. However, on x86 the lower 2MB of address space tends to be shotgun'd with small fragments around the 512-640k range - e.g. video RAM, and with HyperV synic pages tend to sit around there - again splitting it up. The alignment code complains with a 'Section rounded to ...' error and gives up. Since vhost-user already filters out devices without an fd (see vhost-user.c vhost_user_mem_section_filter) it shouldn't be affected by those overlaps. Turn the alignment off on vhost-kernel so that it doesn't try and align, and thus won't hit the rounding issues. Signed-off-by: Dr. David Alan Gilbert Message-Id: <20200116202414.157959-3-dgilbert@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Paolo Bonzini --- hw/virtio/vhost.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 774d87d98e..25fd469179 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -547,26 +547,28 @@ static void vhost_region_add_section(struct vhost_dev= *dev, uintptr_t mrs_host =3D (uintptr_t)memory_region_get_ram_ptr(section->m= r) + section->offset_within_region; RAMBlock *mrs_rb =3D section->mr->ram_block; - size_t mrs_page =3D qemu_ram_pagesize(mrs_rb); =20 trace_vhost_region_add_section(section->mr->name, mrs_gpa, mrs_size, mrs_host); =20 - /* Round the section to it's page size */ - /* First align the start down to a page boundary */ - uint64_t alignage =3D mrs_host & (mrs_page - 1); - if (alignage) { - mrs_host -=3D alignage; - mrs_size +=3D alignage; - mrs_gpa -=3D alignage; + if (dev->vhost_ops->backend_type =3D=3D VHOST_BACKEND_TYPE_USER) { =20 + /* Round the section to it's page size */ + /* First align the start down to a page boundary */ + size_t mrs_page =3D qemu_ram_pagesize(mrs_rb); + uint64_t alignage =3D mrs_host & (mrs_page - 1); + if (alignage) { + mrs_host -=3D alignage; + mrs_size +=3D alignage; + mrs_gpa -=3D alignage; + } + /* Now align the size up to a page boundary */ + alignage =3D mrs_size & (mrs_page - 1); + if (alignage) { + mrs_size +=3D mrs_page - alignage; + } + trace_vhost_region_add_section_aligned(section->mr->name, mrs_gpa,= mrs_size, + mrs_host); } - /* Now align the size up to a page boundary */ - alignage =3D mrs_size & (mrs_page - 1); - if (alignage) { - mrs_size +=3D mrs_page - alignage; - } - trace_vhost_region_add_section_aligned(section->mr->name, mrs_gpa, mrs= _size, - mrs_host); =20 if (dev->n_tmp_sections) { /* Since we already have at least one section, lets see if --=20 MST From nobody Sat May 18 23:14:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579764409; cv=none; d=zohomail.com; s=zohoarc; b=FZ7y/s6K9fDMdoHL06QqWSla7zr0804NWxR8gCmL+R5/sB7iJr/cj8o9xOmD9CrDZcH1A/Yl53ehxa5rn9Bce5WhFRySl5+IxB82Updtk7nvFv+5CPLisPHvhDfHYhjkje1mlSi+k1sno7XggZNrekqAcTDzuzFiKcNoqiDnGcY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579764409; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ggBqUw/TkyscUgLTaAI+ToeLG/4Kdqwt2Kyfz0gAqcA=; b=iV9iN+x+ekGNvyQIYe0ygDGaRWO+nRMlenrwBXVxZaO6QhFvkRvSZculMwEYVgPWkSRNhD9BwH4b6L+7/o2z02ecEXkm8/vRXrT3qfLgCYQyRZhPN2RCpKJSwc8k6xYt0VwQUu20QfhMKQI7Wmd9P6WAll3+KNNmV2YPgcr+exM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579764409925317.0497639468273; Wed, 22 Jan 2020 23:26:49 -0800 (PST) Received: from localhost ([::1]:52206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWt6-0007Zp-Si for importer@patchew.org; Thu, 23 Jan 2020 02:26:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37607) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWdx-0006pr-GS for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:11:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iuWdv-0000Bh-VH for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:11:09 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:48381 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iuWdv-0000BX-RM for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:11:07 -0500 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-71-a2kL-y1bNiGoYYbCq5638w-1; Thu, 23 Jan 2020 02:11:03 -0500 Received: by mail-wr1-f69.google.com with SMTP id z14so1326994wrs.4 for ; Wed, 22 Jan 2020 23:11:03 -0800 (PST) Received: from redhat.com (bzq-79-176-0-156.red.bezeqint.net. [79.176.0.156]) by smtp.gmail.com with ESMTPSA id s10sm1801373wrw.12.2020.01.22.23.11.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 23:11:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579763467; 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=ggBqUw/TkyscUgLTaAI+ToeLG/4Kdqwt2Kyfz0gAqcA=; b=KdVCpxvH+EMzssDqqQTS0Ne0rWJ8LgOWf4nQFbGP9nwM6C/3OUB0EuuTd9DBmM0Y2MBzv5 0h4GRhubF9UTUIifBmpqY+OyRzwCQfAeAGnWAEdU3fAue3l1QoHDro2PuMZX0sswALrXaM KvNOzOdPq+uY8jnGU1P395h8AG/Ud6I= 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=cGSuN6h1x+S1blKGljaTMghfpV/GT8UXotLBiV9qbUk=; b=V/mLqvj8x7OhMfOg36ZpahLnNopYWjT7THwTmQtTJf4uA+WrRK8JmYb5D6iZTIiVa9 zkE2UZS8v280+DY+xx9iTZzrz2+tD+xDeJjQbxtjI1jQxE0CCyrIjh3D49UBTKjrK4pF YS3u4sjJDySEkhzLjKaSdZ2zkRqvSNs3YNOEUhr+dB1dTe4j4RKqCxbxzTU4tqYaLXSQ e93x9RThHaLuiFGA5IMr9xV2wtQgyUeJgjARPZ02BqJmZUb3q1lBpOcCrOZrQ39/ceH+ nee/9RmCSrn5nfB8PM/2PeihkYvG1rE6KkhnZxFBqP23zAqiKsq/RmxBwCBPZrpNHqDp hcKg== X-Gm-Message-State: APjAAAWWAgrlS8hY32chbODPW2IUTXicxIf0k9TWrWc4vCG2Pg9aEjPf 69e1sBmkrYYe2kAd5cImMbKbEebu1BzSIlKC/W3saQgC8ppn8hSPvkLze6hZEBUWmdxfnKgZsed jCcex0IHd1b12EQo= X-Received: by 2002:a05:600c:305:: with SMTP id q5mr2360521wmd.167.1579763462074; Wed, 22 Jan 2020 23:11:02 -0800 (PST) X-Google-Smtp-Source: APXvYqzxxPSujN6AQWntf1iApTcXz+WP3BlyrW1m6Bj0zinRfhdZ04IfDpKT25JpJTkgLr+lribqhA== X-Received: by 2002:a05:600c:305:: with SMTP id q5mr2360506wmd.167.1579763461860; Wed, 22 Jan 2020 23:11:01 -0800 (PST) Date: Thu, 23 Jan 2020 02:10:59 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v3 17/18] i386:acpi: Remove _HID from the SMBus ACPI entry Message-ID: <20200123070913.626488-18-mst@redhat.com> References: <20200123070913.626488-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200123070913.626488-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-MC-Unique: a2kL-y1bNiGoYYbCq5638w-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 207.211.31.120 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 , Corey Minyard , Paolo Bonzini , Igor Mammedov , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Corey Minyard Per the ACPI spec (version 6.1, section 6.1.5 _HID) it is not required on enumerated buses (like PCI in this case), _ADR is required (and is already there). And the _HID value is wrong. Linux appears to ignore the _HID entry, but Windows 10 detects it as 'Unknown Device' and there is no driver available. See https://bugs.launchpad.net/qemu/+bug/1856724 Signed-off-by: Corey Minyard Cc: Michael S. Tsirkin Cc: Igor Mammedov Reviewed-by: Igor Mammedov Message-Id: <20200120170725.24935-6-minyard@acm.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 1 - tests/data/acpi/q35/DSDT | Bin 7879 -> 7869 bytes tests/data/acpi/q35/DSDT.acpihmat | Bin 9203 -> 9193 bytes tests/data/acpi/q35/DSDT.bridge | Bin 7896 -> 7886 bytes tests/data/acpi/q35/DSDT.cphp | Bin 8342 -> 8332 bytes tests/data/acpi/q35/DSDT.dimmpxm | Bin 9532 -> 9522 bytes tests/data/acpi/q35/DSDT.ipmibt | Bin 7954 -> 7944 bytes tests/data/acpi/q35/DSDT.memhp | Bin 9238 -> 9228 bytes tests/data/acpi/q35/DSDT.mmio64 | Bin 9009 -> 8999 bytes tests/data/acpi/q35/DSDT.numamem | Bin 7885 -> 7875 bytes 10 files changed, 1 deletion(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index e25df838f0..9c4e46fa74 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1816,7 +1816,6 @@ static void build_smb0(Aml *table, I2CBus *smbus, int= devnr, int func) Aml *scope =3D aml_scope("_SB.PCI0"); Aml *dev =3D aml_device("SMB0"); =20 - aml_append(dev, aml_name_decl("_HID", aml_eisaid("APP0005"))); aml_append(dev, aml_name_decl("_ADR", aml_int(devnr << 16 | func))); build_acpi_ipmi_devices(dev, BUS(smbus), "\\_SB.PCI0.SMB0"); aml_append(scope, dev); diff --git a/tests/data/acpi/q35/DSDT b/tests/data/acpi/q35/DSDT index 77ea60ffed421c566138fe6341421f579129a582..1f91888d7a485850cf27f152e24= 7a90b208003dc 100644 GIT binary patch delta 42 xcmX?ZyVsV>CDe&h`+ diff --git a/tests/data/acpi/q35/DSDT.dimmpxm b/tests/data/acpi/q35/DSDT.di= mmpxm index 23fdf5e60a5069f60d6c680ac9c68c4a8a81318e..02ccdd5f38d5b2356dcca89398c= 41dcf2595dfff 100644 GIT binary patch delta 42 xcmdnvwaJUiCDv8151UVN}qe1Nm3L39&;u&FFx2QKET=3D2Ai9Y^*w@Km^J2+-Rsi7S3kU!J delta 52 zcmeCMn`Fo366_KpB+tOWxOgL1ouss?UVN}qe1Nm3L3ER3u&>&QD-BUv81%BUVN}qe1Nm3L3ER3u& (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579764322984642.9782466268089; Wed, 22 Jan 2020 23:25:22 -0800 (PST) Received: from localhost ([::1]:52176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWrh-0005mm-HN for importer@patchew.org; Thu, 23 Jan 2020 02:25:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37601) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuWdx-0006p2-2H for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:11:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iuWdv-0000Bm-Vn for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:11:08 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:26732 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iuWdv-0000BK-RC for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:11:07 -0500 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-210-gNZp70aSPHmD-NP_8CEJxw-1; Thu, 23 Jan 2020 02:11:06 -0500 Received: by mail-wr1-f72.google.com with SMTP id w6so1299877wrm.16 for ; Wed, 22 Jan 2020 23:11:05 -0800 (PST) Received: from redhat.com (bzq-79-176-0-156.red.bezeqint.net. [79.176.0.156]) by smtp.gmail.com with ESMTPSA id k16sm1967199wru.0.2020.01.22.23.11.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 23:11:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579763467; 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=7jbGyeuMwv2CGwDe+4+FRf90DJhJt/iFUIQrlaWheaQ=; b=RnEx0CxZYu7V6twGpgOBGzb2ExcxnfHbg/PHr13ZP9bZ09676Zgo7q7vubf17/D5e50Kta Vpm220do9QmMWF2yHT0SXm6r56ra8RSSWhyrh+vVoQUAVpoTxRkRF3wcAt3Se9ijB6iYxp O8AkEojuPTZ9A2aR7kwKHyDHmdPuhtY= 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=am4EjmW9E48Zpqsim6RC+G3gEvfWGSqcNR38rpxPe+M=; b=fIQmDxIMx1xJFhqtxtkl5QZqlp9CV83Hdl69TnrHLEHV3mAt1sbeTuBy5cVQGYKTre BXjkYuGOkJFuAm1doMw77rFTQwJQ01KZuNe4yl7/rpKmI7qLj7Pd64YLfvQLH761pkjt 4Hffjc3/Q5/cNESYh2xCUphutOKCqcOR1JR5IbnahJegshCef2fFr4eY5ed2b/KcVvvT PoEe37gCF+UBv75rkxm3zNaZv8Tp0ohQDJoD+5LTqvAurlbW+Hrd23Bzm5/d5mamzlVS EkHV9hQHiz0hw6TJy/DEFInEGMllXqUkJqmcHXIDTECfmNsjo8gsQz/fkkUDLJcqHz7G CARg== X-Gm-Message-State: APjAAAVBzLabTkNpCt2LkKeA7EECct4Rx1jUZltgt98edp/elgEw7Yte yNgC66Y5/lGbcvoslYOX4Ufj8QEOq/pLB2cFn9GKm4/9A/Wgs62bGhGgZasEknNq9TJQqff9tvN qp80IcWW2BSdq9u8= X-Received: by 2002:adf:f003:: with SMTP id j3mr16319794wro.423.1579763464601; Wed, 22 Jan 2020 23:11:04 -0800 (PST) X-Google-Smtp-Source: APXvYqyh/YOeDXA82fIQsmivjUPn5GpAPYFxlITkjzl8aen09sNsHgnqRP5zRDo/L3pnVvTCK/s2KA== X-Received: by 2002:adf:f003:: with SMTP id j3mr16319780wro.423.1579763464435; Wed, 22 Jan 2020 23:11:04 -0800 (PST) Date: Thu, 23 Jan 2020 02:11:02 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v3 18/18] vhost: coding style fix Message-ID: <20200123070913.626488-19-mst@redhat.com> References: <20200123070913.626488-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200123070913.626488-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-MC-Unique: gNZp70aSPHmD-NP_8CEJxw-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 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 Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Drop a trailing whitespace. Make line shorter. Fixes: 76525114736e8 ("vhost: Only align sections for vhost-user") Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 25fd469179..9edfadc81d 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -551,7 +551,7 @@ static void vhost_region_add_section(struct vhost_dev *= dev, trace_vhost_region_add_section(section->mr->name, mrs_gpa, mrs_size, mrs_host); =20 - if (dev->vhost_ops->backend_type =3D=3D VHOST_BACKEND_TYPE_USER) { =20 + if (dev->vhost_ops->backend_type =3D=3D VHOST_BACKEND_TYPE_USER) { /* Round the section to it's page size */ /* First align the start down to a page boundary */ size_t mrs_page =3D qemu_ram_pagesize(mrs_rb); @@ -566,8 +566,8 @@ static void vhost_region_add_section(struct vhost_dev *= dev, if (alignage) { mrs_size +=3D mrs_page - alignage; } - trace_vhost_region_add_section_aligned(section->mr->name, mrs_gpa,= mrs_size, - mrs_host); + trace_vhost_region_add_section_aligned(section->mr->name, mrs_gpa, + mrs_size, mrs_host); } =20 if (dev->n_tmp_sections) { --=20 MST