From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591973682; cv=none; d=zohomail.com; s=zohoarc; b=aK2RUBltYX+Jo5W1Bl42phm7LB6tf5CjRPUUv7HevUhXBliPj6ZV6Gp7ZWryjMKDSTEv4LoM01TWTvp6IOa3sGq7wGbPmmaN82p7FFfZdFp//SYXDU1eQD0dpolQUIeL7LkARwIqp7fm7xLidemjJ6S954515iobIuS2YjwpvNQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591973682; 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=vdSt1fYq3b/MNQ0x5ZZmdB8fAeuVH3A8AbIAmGm6Cls=; b=gVDMJfk+pp9M5ckfFonVh//FPBLnV/fCPrZMgV4P/ow6K24xCpeNfVkE+rrMwASrLatkUEKxCPnffDS1ymM+Le0KhdgFI9mpK2yE3/xFETNSQbAyeVuKfnOJwVQtHasQzI+LI/drbSg3CQmwJw+42hRtMGnZLTmjjMqAh2smgAI= 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 1591973682554381.1943299651673; Fri, 12 Jun 2020 07:54:42 -0700 (PDT) Received: from localhost ([::1]:45736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjl4r-0002sa-8a for importer@patchew.org; Fri, 12 Jun 2020 10:54:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl1V-0005Ao-2h for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:13 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:25412 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl1Q-0001Lg-9J for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:12 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-36-XtqLDnsuPgysA0YZJi1FaA-1; Fri, 12 Jun 2020 10:51:05 -0400 Received: by mail-wm1-f72.google.com with SMTP id p24so2034088wma.4 for ; Fri, 12 Jun 2020 07:51:05 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id e10sm10343278wrn.11.2020.06.12.07.51.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973467; 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=vdSt1fYq3b/MNQ0x5ZZmdB8fAeuVH3A8AbIAmGm6Cls=; b=AOkBfQrpRMp5w4jHCd5UO1jFJ8gavpIuO0L2yKh7nE6PFRk5nQpprEyjiPSy1DP4tp72ep iz9xZ4P4iME3QA+RxUkEnN4QzusEXjAOtWargdyfB8lmKVTGIQJa4QKCcmUTdjExD0vwou XvvEYk2uwWhbZa2G9fPcPTILUrjoHX0= X-MC-Unique: XtqLDnsuPgysA0YZJi1FaA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=vdSt1fYq3b/MNQ0x5ZZmdB8fAeuVH3A8AbIAmGm6Cls=; b=k2083f0Leji0TzpMnmKGBCe1TZjNxXucwAT14K0PF5oMtabWORbT9DwoGqgcsX6tV6 gfeVbaBPJNKPjfpKTOZFjPzegfY+f9RR3H3LrnRpHoWus7lUwuiqvRI+4zTjHzkrNzaX 9aX6A0XGuLqgKjRutBhU1KYdZl7NuBE8QXFmz96mgq4muJ4ifaGhNY9xfaPWM9OJo6Bn KlXyT6uNENpGObCMduoSQ5ktRAOhRfC6R5WdNKDlRROR19VJDo3Dqj3LBX2LnjPLbC8g uPadamjyox+8Q82D3gg3lX5Ns5EXw3boMxwYPKK+MizqGbqYFlPJrLwD/BTKYSvscMXl bnow== X-Gm-Message-State: AOAM533nFoz9MkCnZB2qRY90GysYHEA0XuGTOIqbbwpBMExMpj6BHt30 UAHb7oxtwaqQ1NuRxFXaJm95GjktdHdWAyRBduefQkTjzbAvmczzTfzhU6ffVCmBx8GP7yKtsa8 GlsuXaaa8mdmqnWo= X-Received: by 2002:a5d:608d:: with SMTP id w13mr15261033wrt.298.1591973464608; Fri, 12 Jun 2020 07:51:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUrM0ojZqr4grEpvjtvfOK0JdYEVvnKKk4HAiZBjZ13lYSduGzYrm8lOvzsEDAqrttN7GfaQ== X-Received: by 2002:a5d:608d:: with SMTP id w13mr15261013wrt.298.1591973464451; Fri, 12 Jun 2020 07:51:04 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:02 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 01/58] msix: allow qword MSI-X table accesses Message-ID: <20200612141917.9446-2-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 09:30:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) PCI spec says: For all accesses to MSI-X Table and MSI-X PBA fields, software must use aligned full DWORD or aligned full QWORD transactions; otherwise, the result is undefined. However, since MSI-X was converted to use memory API, QEMU started blocking qword transactions, only allowing DWORD ones. Guests do not seem to use QWORD accesses, but let's be spec compliant. Fixes: 95524ae8dc8f ("msix: convert to memory API") Signed-off-by: Michael S. Tsirkin Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci/msix.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/pci/msix.c b/hw/pci/msix.c index 29187898f2..e6a5559038 100644 --- a/hw/pci/msix.c +++ b/hw/pci/msix.c @@ -199,6 +199,9 @@ static const MemoryRegionOps msix_table_mmio_ops =3D { .endianness =3D DEVICE_LITTLE_ENDIAN, .valid =3D { .min_access_size =3D 4, + .max_access_size =3D 8, + }, + .impl =3D { .max_access_size =3D 4, }, }; @@ -227,6 +230,9 @@ static const MemoryRegionOps msix_pba_mmio_ops =3D { .endianness =3D DEVICE_LITTLE_ENDIAN, .valid =3D { .min_access_size =3D 4, + .max_access_size =3D 8, + }, + .impl =3D { .max_access_size =3D 4, }, }; --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591975207; cv=none; d=zohomail.com; s=zohoarc; b=D1upcWg3k+QJyFlved8MzaxO86KJURMHlvDRpQQGRPFyaCjeBm0sc2qM0OL4/Ph0dfTfyVyjXs0RwRFj5xFHK/RXujCJLYtW41EXwRUpUq19FlR1TodCP3IaJqJmkGG/rEusZBLYxck9LKT85C/4LjG1SiQOLL0wylsyMxPlAOo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591975207; h=Content-Type: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=kAMCwY6Ii66tK0+En6xfr/Bb9/oeXHnOnpsD9bdoRBE=; b=X4C3bvIVaNF706DPaItYaj7goZYcjNiqihbgXmEs/jMFZLQRI+BI5EsL83J1w3utEDwnQmWjp1u5p3EOWPFMOrNdM0Ub1ZPddXtYf86649dMshJWL0OQgMVWUDXjfSv3cEKt4/aCDdULzeSMl8loUCRCBqQoCexetAh5bB0jQj0= 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 1591975207831542.2897699718646; Fri, 12 Jun 2020 08:20:07 -0700 (PDT) Received: from localhost ([::1]:60162 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlTS-0008Bo-Jr for importer@patchew.org; Fri, 12 Jun 2020 11:20:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51070) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl4O-00031E-SF for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:54:12 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:39361 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl4L-0001qM-Bw for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:54:12 -0400 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-32-Mq-_R6AQOmuj616quP0hUQ-1; Fri, 12 Jun 2020 10:51:08 -0400 Received: by mail-wm1-f69.google.com with SMTP id 14so2514374wmi.8 for ; Fri, 12 Jun 2020 07:51:08 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id o10sm10407217wrq.40.2020.06.12.07.51.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973648; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=kAMCwY6Ii66tK0+En6xfr/Bb9/oeXHnOnpsD9bdoRBE=; b=WdOH7hVHgOMP3BZKyoW2QxkNbfsnn3pS8zpY9w1gGMKTIOLzfXXTKEJtebPmOf2bgbh+PA t2Ume63wxjvehOJzVQt43zRNtW6JDgHk1V5gnBy2pjNwu3UECEHR4NfpBK12G0nH+vvaQV Rlo/whCfuUwYPSAje8Qpf6S/dq3R4qY= X-MC-Unique: Mq-_R6AQOmuj616quP0hUQ-1 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=kAMCwY6Ii66tK0+En6xfr/Bb9/oeXHnOnpsD9bdoRBE=; b=RS31XClJksoXok4zWF04mG7M+/uBliU6+IXV8cSMSDghHCWmfBxJOXitRP3ggOj7o1 JxhV9MYboT0snw7qX3gMDzaTlaMNWre1lSfnOXsJIO9xYRkpHPXGAveGjAJbYLVR6cJW Q5XFD/1M+RIy0kqClIGJF9fEaHQFDQ7wuorA5OAWh9MurGWpgMCDjU1Ml8uN69WB/M1S sS42GN/J+eSdfzgF6rtjWWDQsPeSzM4ORoF4oX/YdwaO/ceXB/NujJEcMgoAJvtiyovR wMxvrr0HvLtpDotFjuyUZF9hslDDn81UIosJxGzy1Z0t532s9E3ulsXN9/yUmWrc4ogC a4AA== X-Gm-Message-State: AOAM531oWTURTO8eqb2gsbo8T+tNTB6EdNVtlZJPG7SVA9cZIFEEUZbs 2a0CEbHXe9C3KOkHeCNNuNs2KgPCjkzTzhNqYHMCiTyGNMGYtqLmLRTrmofFMvsxFArfTtk6XAI zsOiQXU8XeiZwBqU= X-Received: by 2002:a7b:cd06:: with SMTP id f6mr13653110wmj.8.1591973466926; Fri, 12 Jun 2020 07:51:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPXfXfB2hD4f9KCExUVh69jj9NTS6oEjhg0FSx7DpxEgZeRUv4OhDvqW4bHksYZYUVgLjrQw== X-Received: by 2002:a7b:cd06:: with SMTP id f6mr13653092wmj.8.1591973466723; Fri, 12 Jun 2020 07:51:06 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:04 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 02/58] diffs-allowed: add the SRAT AML to diffs-allowed Message-ID: <20200612141917.9446-3-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 09:30:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Igor Mammedov , Vishal Verma Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vishal Verma In anticipation of a change to the SRAT generation in qemu, add the AML file to diffs-allowed. Signed-off-by: Vishal Verma Message-Id: <20200606000911.9896-2-vishal.l.verma@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index dfb8523c8b..e8f2766a63 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,4 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/pc/SRAT.dimmpxm", +"tests/data/acpi/q35/SRAT.dimmpxm", +"tests/data/acpi/virt/SRAT.memhp", --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591973559; cv=none; d=zohomail.com; s=zohoarc; b=llR2mf7/4iwkoe4JTll+kYdF/utxhJRdE8Hp6t/iDj29jBimy4tN7hire6haUarHcglBZCQlRB2q7B2NNbFyI7+0WHf9ZT2ozWX58haTq532AsiUMeUhcxc2moojK+66sy5VNNME7RLTOpjGWB+qQTcflNqqhHFY7bd6n0N4rHA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591973559; h=Content-Type: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=ezVaZ39w/Zt6S04FtdW+skZfwDczX4yGiWwy5FV/qKo=; b=SlGqh4SonIWjwF2Ra3ShHMwEIgJ7LphqGJymC6959Zm7do9MjziVlFoN+rX4altZfc/RvNPdlkxzcDCgOs0ydmPfOa7t4+b3sV1kBbo1i04HliIPp5kyafTwd3v8CcnZ83RHy1tkEXJArfGb0D3X+7v214OehFyHzM1H9aafX+8= 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 1591973559633728.7541727554321; Fri, 12 Jun 2020 07:52:39 -0700 (PDT) Received: from localhost ([::1]:37554 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjl2s-00071k-5j for importer@patchew.org; Fri, 12 Jun 2020 10:52:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49518) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl1X-0005Cg-UH for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:15 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:47308 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl1V-0001MI-MW for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:15 -0400 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-30-b9gyMVJ9MiGJOKNPGi7sKA-1; Fri, 12 Jun 2020 10:51:11 -0400 Received: by mail-wm1-f70.google.com with SMTP id t145so2545028wmt.2 for ; Fri, 12 Jun 2020 07:51:10 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id y5sm10767253wrs.63.2020.06.12.07.51.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973473; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ezVaZ39w/Zt6S04FtdW+skZfwDczX4yGiWwy5FV/qKo=; b=ZzbiMyTfgVLqT7qu9Hy3w1MRBeWhRfiRht7Qu24WScpS7ia82m4KG5ZF4dRyMhGz8aXjRp b8YoSlOUVjoTlPcxkCpFZ7fMklxYqMMqeiMk/YL7z6xaVzKM34jdSR9C/r6wRb9SlL2Dn4 07lOxX1xRTXHqPZvFBt63YseyhknShU= X-MC-Unique: b9gyMVJ9MiGJOKNPGi7sKA-1 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=ezVaZ39w/Zt6S04FtdW+skZfwDczX4yGiWwy5FV/qKo=; b=cadq4J6pZc2IOE9Sfymdnuzq7HYzEtlhe0YzjoCF9nN9CbWxdoArP+vTFy4nzRHGJO 5S7Pgac2chJQDt/iOXoN3uocYQz++ziu5EK6E2St33fu9rRW78STTF9j2GXcYM1LXvrY PgxUoYCLe5UckRqOTNSydd1iqeB75+MYnamerpPZh5ss+pzSykYUb3ZGDRyHO9hF2rJJ m7JmqCbUYvkMRk9wp3OKCUAes/KhWuRmr9Qzb1mJx6eEoPEiqp2OCYIY1hafOlmy84MF B4ND+niHn8OKEbayTAvMTuM93gbzHsSQCJ0D5lXxHq7WVS7NXzhEUEzumYCUtN1H3cNV PF8w== X-Gm-Message-State: AOAM530Rj1fcy3TQEDfXUmA9J1nI5DOnRtTPDbb5OT7Mdz/iFHm/8QyX yxiYQSQO535Y+oBsz2hBjy65pTbzrVWyTQx2H4RbymB1WlRXIK5MFOtwRS2FMmuFrmy2jPXlFPI k8hTiMFWaky5rKdQ= X-Received: by 2002:a1c:2082:: with SMTP id g124mr14255826wmg.21.1591973469590; Fri, 12 Jun 2020 07:51:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEG0pJXLkOLT0yypGv25+q3tAYfMF2FkJ+8vRADgp1GU0Xko87chojkSQxIx77EuSNTk9gPA== X-Received: by 2002:a1c:2082:: with SMTP id g124mr14255796wmg.21.1591973469321; Fri, 12 Jun 2020 07:51:09 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:07 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 03/58] hw/acpi/nvdimm: add a helper to augment SRAT generation Message-ID: <20200612141917.9446-4-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:00:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Xiao Guangrong , Jingqi Liu , Eduardo Habkost , Shannon Zhao , Paolo Bonzini , Vishal Verma , Igor Mammedov , qemu-arm@nongnu.org, 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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vishal Verma NVDIMMs can belong to their own proximity domains, as described by the NFIT. In such cases, the SRAT needs to have Memory Affinity structures in the SRAT for these NVDIMMs, otherwise Linux doesn't populate node data structures properly during NUMA initialization. See the following for an example failure case. https://lore.kernel.org/linux-nvdimm/20200416225438.15208-1-vishal.l.verma@= intel.com/ Introduce a new helper, nvdimm_build_srat(), and call it for both the i386 and arm versions of 'build_srat()' to augment the SRAT with memory affinity information for NVDIMMs. The relevant command line options to exercise this are below. Nodes 0-1 contain CPUs and regular memory, and nodes 2-3 are the NVDIMM address space. -object memory-backend-ram,id=3Dmem0,size=3D2048M -numa node,nodeid=3D0,memdev=3Dmem0, -numa cpu,node-id=3D0,socket-id=3D0 -object memory-backend-ram,id=3Dmem1,size=3D2048M -numa node,nodeid=3D1,memdev=3Dmem1, -numa cpu,node-id=3D1,socket-id=3D1 -numa node,nodeid=3D2, -object memory-backend-file,id=3Dnvmem0,share,mem-path=3Dnvdimm-0,size= =3D16384M,align=3D1G -device nvdimm,memdev=3Dnvmem0,id=3Dnv0,label-size=3D2M,node=3D2 -numa node,nodeid=3D3, -object memory-backend-file,id=3Dnvmem1,share,mem-path=3Dnvdimm-1,size= =3D16384M,align=3D1G -device nvdimm,memdev=3Dnvmem1,id=3Dnv1,label-size=3D2M,node=3D3 Cc: Jingqi Liu Cc: Michael S. Tsirkin Reviewed-by: Jingqi Liu Reviewed-by: Igor Mammedov Signed-off-by: Vishal Verma Message-Id: <20200606000911.9896-3-vishal.l.verma@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/mem/nvdimm.h | 1 + hw/acpi/nvdimm.c | 23 +++++++++++++++++++++++ hw/arm/virt-acpi-build.c | 4 ++++ hw/i386/acpi-build.c | 5 +++++ 4 files changed, 33 insertions(+) diff --git a/include/hw/mem/nvdimm.h b/include/hw/mem/nvdimm.h index a3c08955e8..b67a1aedf6 100644 --- a/include/hw/mem/nvdimm.h +++ b/include/hw/mem/nvdimm.h @@ -155,6 +155,7 @@ typedef struct NVDIMMState NVDIMMState; void nvdimm_init_acpi_state(NVDIMMState *state, MemoryRegion *io, struct AcpiGenericAddress dsm_io, FWCfgState *fw_cfg, Object *owner); +void nvdimm_build_srat(GArray *table_data); void nvdimm_build_acpi(GArray *table_offsets, GArray *table_data, BIOSLinker *linker, NVDIMMState *state, uint32_t ram_slots); diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c index 9316d12b70..8f7cc16add 100644 --- a/hw/acpi/nvdimm.c +++ b/hw/acpi/nvdimm.c @@ -28,6 +28,7 @@ =20 #include "qemu/osdep.h" #include "qemu/uuid.h" +#include "qapi/error.h" #include "hw/acpi/acpi.h" #include "hw/acpi/aml-build.h" #include "hw/acpi/bios-linker-loader.h" @@ -1334,6 +1335,28 @@ static void nvdimm_build_ssdt(GArray *table_offsets,= GArray *table_data, free_aml_allocator(); } =20 +void nvdimm_build_srat(GArray *table_data) +{ + GSList *device_list =3D nvdimm_get_device_list(); + + for (; device_list; device_list =3D device_list->next) { + AcpiSratMemoryAffinity *numamem =3D NULL; + DeviceState *dev =3D device_list->data; + Object *obj =3D OBJECT(dev); + uint64_t addr, size; + int node; + + node =3D object_property_get_int(obj, PC_DIMM_NODE_PROP, &error_ab= ort); + addr =3D object_property_get_uint(obj, PC_DIMM_ADDR_PROP, &error_a= bort); + size =3D object_property_get_uint(obj, PC_DIMM_SIZE_PROP, &error_a= bort); + + numamem =3D acpi_data_push(table_data, sizeof *numamem); + build_srat_memory(numamem, addr, size, node, + MEM_AFFINITY_ENABLED | MEM_AFFINITY_NON_VOLATILE= ); + } + g_slist_free(device_list); +} + void nvdimm_build_acpi(GArray *table_offsets, GArray *table_data, BIOSLinker *linker, NVDIMMState *state, uint32_t ram_slots) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 1b0a584c7b..2cbccd5fe2 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -539,6 +539,10 @@ build_srat(GArray *table_data, BIOSLinker *linker, Vir= tMachineState *vms) } } =20 + if (ms->nvdimms_state->is_enabled) { + nvdimm_build_srat(table_data); + } + if (ms->device_memory) { numamem =3D acpi_data_push(table_data, sizeof *numamem); build_srat_memory(numamem, ms->device_memory->base, diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 2e15f6848e..d996525e2c 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2428,6 +2428,11 @@ build_srat(GArray *table_data, BIOSLinker *linker, M= achineState *machine) MEM_AFFINITY_ENABLED); } } + + if (machine->nvdimms_state->is_enabled) { + nvdimm_build_srat(table_data); + } + slots =3D (table_data->len - numa_start) / sizeof *numamem; for (; slots < pcms->numa_nodes + 2; slots++) { numamem =3D acpi_data_push(table_data, sizeof *numamem); --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591975102; cv=none; d=zohomail.com; s=zohoarc; b=UXzvZZQn+ZOTeLCxPeR0lZpwIF+SZb9MsGHyfjgzClbjHORpbaiqveqtIN6fdtUh/jhkp/mx79jkBtI2BI+Ew200IqjLBM/v9He+ZJTRexroLTfb3//JdX1pDs31Z9uLboW6mNj7OS2e9QPV/HaZzLVJY7ySlNoj+TR0hN5+iCE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591975102; h=Content-Type: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=0VpX9XjFjoE089UEoUCw+lrLKWRiMsf9KCnDg50S3IA=; b=RrrUfRufGr0eUEA6dSnyL8kZftAGPoa37SkuLYcY8AOMXxkR6+BIddDdLbkB+bDNUogdRgfMyiCKJ/6ZLZIKx95/8iwbjp+WwJrIYJrDAUOpyg15ldveJwRo/UlMAWn7Z0I8PAL/zNVwkI/HT14jhVZPHrqzEanxZM7+PMXBiGA= 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 1591975102324960.2229650284869; Fri, 12 Jun 2020 08:18:22 -0700 (PDT) Received: from localhost ([::1]:51704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlRk-0004la-SL for importer@patchew.org; Fri, 12 Jun 2020 11:18:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51046) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl4N-0002ze-Oh for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:54:11 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:46502 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl4L-0001qL-BM for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:54:11 -0400 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-108-Ixa02MTBORG3wSLreoAB2w-1; Fri, 12 Jun 2020 10:51:13 -0400 Received: by mail-wr1-f69.google.com with SMTP id z10so4016604wrs.2 for ; Fri, 12 Jun 2020 07:51:12 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id k17sm10624039wrl.54.2020.06.12.07.51.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973648; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0VpX9XjFjoE089UEoUCw+lrLKWRiMsf9KCnDg50S3IA=; b=d5uZnv/UIiJNeNgsw3CPeQtfFCYzcz3TIXHZUo1frGa/t2IuqwJhBnCPqKEZjjySH+zPlx ZRDH9FdA0p2xYCQb35I7FE8YC7AFsUBWxgswFjSk7miccxarGnhoGeFGLvwXpvdSq97BDg s/6ZXi0xcD3Qc4SEPsI/4R1VFlMgNy4= X-MC-Unique: Ixa02MTBORG3wSLreoAB2w-1 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=0VpX9XjFjoE089UEoUCw+lrLKWRiMsf9KCnDg50S3IA=; b=ocVLOp45Zl7l877HeBQPYbU5cPLYdkdZcsfprJ4B2WBAmU4m4GDYlxlRfIDRWGLslj Tb8xv4P5wzShgcrPQdVq228mp1pHx9Pt+XrhmAn6lcOGh/7VEEg5r5+N4ZFpCyFyA2SE Lvi1FPbJQHqWl8rkE4EFG3cHozW97AHL1jLxMMWUZiUgevquvZcOneq1u3lawVCQHpPT 2OfkKOciL8gC0tDHb6vRZUe22/DW3y8AL2MnWvDIrdIUENWwf1z4rzeM8chWa4cTsgmC CH1rtpA+PRSDfkn5i2J66ZAQEzOwAUBE4MFcNJ0v9nMtQNxn7DxD/4pCB+EAOZ/wqqCB 8u7g== X-Gm-Message-State: AOAM532plwqAAfnhk9H2R3wg23y7DwFWzkYINgucq9W6BI0rRhokKkoZ dRpxpVpSRpcbzK++rkevYvgnJ7EEIs8Xf9MLknUx/ULaCS/CtAKEeJaPSEEvjMaIEcWO+LhiddB vDn2e66dLPmek2Sc= X-Received: by 2002:adf:bac8:: with SMTP id w8mr14837724wrg.47.1591973471769; Fri, 12 Jun 2020 07:51:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy76c6Ne74nOLVQbXVFmcp2t3L7o1MCqmYO2aHq9hdwhZFlOBOOwTZYcXhTGdwNv/JfmmXgZQ== X-Received: by 2002:adf:bac8:: with SMTP id w8mr14837703wrg.47.1591973471542; Fri, 12 Jun 2020 07:51:11 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:09 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 04/58] tests/acpi: update expected SRAT files Message-ID: <20200612141917.9446-5-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 09:30:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Igor Mammedov , Vishal Verma Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vishal Verma Update expected SRAT files for the change to account for NVDIMM NUMA nodes in the SRAT. AML diffs: tests/data/acpi/pc/SRAT.dimmpxm: Message-Id: <20200606000911.9896-4-vishal.l.verma@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 3 --- tests/data/acpi/pc/SRAT.dimmpxm | Bin 392 -> 392 bytes tests/data/acpi/q35/SRAT.dimmpxm | Bin 392 -> 392 bytes tests/data/acpi/virt/SRAT.memhp | Bin 186 -> 226 bytes 4 files changed, 3 deletions(-) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index e8f2766a63..dfb8523c8b 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1,4 +1 @@ /* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/pc/SRAT.dimmpxm", -"tests/data/acpi/q35/SRAT.dimmpxm", -"tests/data/acpi/virt/SRAT.memhp", diff --git a/tests/data/acpi/pc/SRAT.dimmpxm b/tests/data/acpi/pc/SRAT.dimm= pxm index f5c0267ea24bb404b6b4e687390140378fbdc3f1..5a13c61b9041c6045c29643bf93= a111fb1c0c76a 100644 GIT binary patch delta 51 scmeBR?qKE$4ss0XU}Rum%-G0fz$nec00kUCF%aN@Pz(&LlS3Je0lmQmhyVZp delta 51 icmeBR?qKE$4ss0XU}RumY}m+Uz$ndt8%z#mGzI{_tp$hx diff --git a/tests/data/acpi/q35/SRAT.dimmpxm b/tests/data/acpi/q35/SRAT.di= mmpxm index f5c0267ea24bb404b6b4e687390140378fbdc3f1..5a13c61b9041c6045c29643bf93= a111fb1c0c76a 100644 GIT binary patch delta 51 scmeBR?qKE$4ss0XU}Rum%-G0fz$nec00kUCF%aN@Pz(&LlS3Je0lmQmhyVZp delta 51 icmeBR?qKE$4ss0XU}RumY}m+Uz$ndt8%z#mGzI{_tp$hx diff --git a/tests/data/acpi/virt/SRAT.memhp b/tests/data/acpi/virt/SRAT.me= mhp index 1b57db2072e7f7e2085c4a427aa31c7383851b71..9a35adb40c6f7cd822e5af37abb= a8aad033617cb 100644 GIT binary patch delta 43 rcmdnR_=3Du4!ILI;N5d#AQbIe4p$wD1K76@=3DaC (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 1591974944808142.56337430798624; Fri, 12 Jun 2020 08:15:44 -0700 (PDT) Received: from localhost ([::1]:43196 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlPD-0000rK-Ij for importer@patchew.org; Fri, 12 Jun 2020 11:15:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl4I-0002xn-Np for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:54:07 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:32691 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl4F-0001py-NI for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:54:06 -0400 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-27-YUStj6CnPRSp-2TUeGzKGA-1; Fri, 12 Jun 2020 10:51:14 -0400 Received: by mail-wr1-f70.google.com with SMTP id c14so3978826wrm.15 for ; Fri, 12 Jun 2020 07:51:14 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id t8sm10258545wro.56.2020.06.12.07.51.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973642; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tIipyy3cxji7TSg5TkYgKmMY4wP6xoAvP6GDwENCxXs=; b=c4Wxb/5Ev93T2kLX21g9WVOgG4fm96vJnFh/rQ/dUjvh/UPwKPjrg/d9AR8FlunmybgtGy Bkq+dG4rvBJbG0vZrkr7FBjwfwAW9DcDzSLZSEhoqpgQPhGVjYaT5dcrC5dDnOoASZf+B3 ZlS5NhpqFX5SH3xKIPmzXSk1qa+ziPQ= X-MC-Unique: YUStj6CnPRSp-2TUeGzKGA-1 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=tIipyy3cxji7TSg5TkYgKmMY4wP6xoAvP6GDwENCxXs=; b=e4jO4Q7/XpDqzc1XMYoV1CqzUqseZuEW/WV1D9Tp9WmGhcQIb2QXaTxaXv1ayeZHXl FoL6E+YEFapmZwMY1ho1tuvlKVG9wm8cROEy8UU4XRbo+ivcf5SRSE0Q90wp0bAXsXGl iqpZjqRVSibZ0B5p00l+soXVGZhPBdpghTJd9dpZUBd66q29JSkcaSa8lSdLqEC43/r5 x3VLxeF51aMkgIuebkfVGIWqYDjOjWPrHbBVHgLluM7bP3Tzm7hq+R10Nbg6tAg00Tj5 byoWRza2uAbQrrFLwxDIQTJFcFjaTsPXkSaJVq9pKAbcOEEL6VVizpZKb60kmls9sqZL aAtw== X-Gm-Message-State: AOAM530bXIppnNp0Us4Y7u7G2b6ERpCDxSmOTMCIX6sC1t39IykLzLiN liIn+NY8EvT1T8mk/3iq5nblH5eNXpaK85iYxPcLTgLoj81S9lgHQ6X1nNDSI3a6z0xRGq8tq8u thpo0G/8x9X5LMUA= X-Received: by 2002:a7b:cc94:: with SMTP id p20mr13538854wma.148.1591973473709; Fri, 12 Jun 2020 07:51:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsNBee+a5+YUd9sncbeMD/ln4kObwJNlMCXBD/kzA2ThtEmhJSdZ7ydbXYrwMMdhMor3ncHA== X-Received: by 2002:a7b:cc94:: with SMTP id p20mr13538847wma.148.1591973473563; Fri, 12 Jun 2020 07:51:13 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:11 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 05/58] qtest: allow DSDT acpi table changes Message-ID: <20200612141917.9446-6-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:17 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Gerd Hoffmann Signed-off-by: Gerd Hoffmann Message-Id: <20200515150421.25479-2-kraxel@redhat.com> --- tests/qtest/bios-tables-test-allowed-diff.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index dfb8523c8b..6a052c5044 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,18 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/pc/DSDT", +"tests/data/acpi/pc/DSDT.acpihmat", +"tests/data/acpi/pc/DSDT.bridge", +"tests/data/acpi/pc/DSDT.cphp", +"tests/data/acpi/pc/DSDT.dimmpxm", +"tests/data/acpi/pc/DSDT.ipmikcs", +"tests/data/acpi/pc/DSDT.memhp", +"tests/data/acpi/pc/DSDT.numamem", +"tests/data/acpi/q35/DSDT", +"tests/data/acpi/q35/DSDT.acpihmat", +"tests/data/acpi/q35/DSDT.bridge", +"tests/data/acpi/q35/DSDT.cphp", +"tests/data/acpi/q35/DSDT.dimmpxm", +"tests/data/acpi/q35/DSDT.ipmibt", +"tests/data/acpi/q35/DSDT.memhp", +"tests/data/acpi/q35/DSDT.mmio64", +"tests/data/acpi/q35/DSDT.numamem", --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591973574; cv=none; d=zohomail.com; s=zohoarc; b=Y8oOOavySaWUWuQhixucAEiPgWHHWuWy07C3CNDG4oIsYof6e+dw6jAcvNN56le7GxuGOsG5bq440vwWw/LRZQ4Tz8oTI0mCrcbRsM3MxNx40yZterLXs3lsUAfZvCKqdTzhZLz6aRz1DSQbB9gZv3DY/CgEEtpJ1EbObO+EF/0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591973574; 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=vySMNxAYh/bFwZPNm+lRlFJjyR1SjtCLydsHIq5v2R0=; b=UMcdqPrXbUHFLV21p2/sIlpKC/3OVENriOvgArxv6swCNjsaHIuCd+bgGmMGm4jPfwnb1rYjqOfrfTEiruBoAfaqOD7t2tGZz0xGP4LYUrupXkK4rkdAzkNWO4JQ5hw28GebFGPys5EOCQO5tX98aL8Wdyjk0elGFe+29rgsoLk= 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 159197357422367.18257158980168; Fri, 12 Jun 2020 07:52:54 -0700 (PDT) Received: from localhost ([::1]:38612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjl36-0007cV-NG for importer@patchew.org; Fri, 12 Jun 2020 10:52:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49650) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl1i-0005Wz-VL for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:26 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:32828 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl1h-0001Nb-75 for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:26 -0400 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-423-lLw3uXEWOta8h33wK7k8Uw-1; Fri, 12 Jun 2020 10:51:17 -0400 Received: by mail-wr1-f72.google.com with SMTP id n6so3998433wrv.6 for ; Fri, 12 Jun 2020 07:51:17 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id a15sm10543636wra.86.2020.06.12.07.51.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973484; 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=vySMNxAYh/bFwZPNm+lRlFJjyR1SjtCLydsHIq5v2R0=; b=Bt9SnhG8H6UrzrFq8MMRseDs0Iq+DrO91VPhR7EfEdHPlXmK++W4Z/pDsYESStGnPi5ER3 8CSsGPMPZN6xxHvvhH0D4sIU9UQFQ4tqrx0h8xGEkcHv9aTjsZ9gwEIzxzymB0/9LebhZV 7KQCSGuQVerzmyi0wtqwqog1Z4gWLj8= X-MC-Unique: lLw3uXEWOta8h33wK7k8Uw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=vySMNxAYh/bFwZPNm+lRlFJjyR1SjtCLydsHIq5v2R0=; b=BKE5MJ8nZuH70Au1CdQFBe91GmP3ebj2aaqC36XovtTcSVAduRX/rGd9jsYiLms3uu tHmlKGDVj6QwjmiQMhBbcNW03T/M++do464lPqqWWqxLvd9QUp5a1Y/7DyRUX7qT56Xn /IcMUsOv/wkoHDn1aPOxy+7PRaGa1kdAx9t43bcGqNfCBoVGlNRQGNreIiCiDO1gT+Id 7Fkj/IX/c83B7f5xVdvvcISvOgyf1NjFcFCCPJW62ouy1ent3GaTLaXNTVKHka6USC97 vucmUz50LVlBIb/dLZkGkPqQz1Ry/0DxAiNGm5grgCl9WCOrZibJQnb9tmWYDPx07nFu uKHQ== X-Gm-Message-State: AOAM530uiK4SXgsljwMCNlpDnZKgjn2r9tq4ZRo3eCsOfEaKqODO7QqP I3QnsrQH3Xf0sXv8aSZcp/sQ7yBV9UcKFdInu34z/gEsEAOHacfljRS7G9bg/YXaLowyVhZyxpF ue2OYQzyQwyliKyE= X-Received: by 2002:adf:f790:: with SMTP id q16mr15843848wrp.399.1591973476276; Fri, 12 Jun 2020 07:51:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvyDX/B16JEHAUaYQdKHcuaA0SphYb2Tpn+5XP9Gz3TiR+MMSmqhZgHKkNrp/VN5xFuOks5A== X-Received: by 2002:adf:f790:: with SMTP id q16mr15843822wrp.399.1591973476051; Fri, 12 Jun 2020 07:51:16 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:13 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 06/58] acpi: move aml builder code for rtc device Message-ID: <20200612141917.9446-7-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , Gerd Hoffmann , Igor Mammedov , Paolo Bonzini , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Gerd Hoffmann Signed-off-by: Gerd Hoffmann Reviewed-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200515150421.25479-3-kraxel@redhat.com> --- hw/i386/acpi-build.c | 17 ----------------- hw/rtc/mc146818rtc.c | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index d996525e2c..df5417c75f 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1137,22 +1137,6 @@ static Aml *build_fdc_device_aml(ISADevice *fdc) return dev; } =20 -static Aml *build_rtc_device_aml(void) -{ - Aml *dev; - Aml *crs; - - dev =3D aml_device("RTC"); - aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0B00"))); - crs =3D aml_resource_template(); - aml_append(crs, aml_io(AML_DECODE16, 0x0070, 0x0070, 0x10, 0x02)); - aml_append(crs, aml_irq_no_flags(8)); - aml_append(crs, aml_io(AML_DECODE16, 0x0072, 0x0072, 0x02, 0x06)); - aml_append(dev, aml_name_decl("_CRS", crs)); - - return dev; -} - static Aml *build_kbd_device_aml(void) { Aml *dev; @@ -1278,7 +1262,6 @@ static void build_isa_devices_aml(Aml *table) Aml *scope =3D aml_scope("_SB.PCI0.ISA"); Object *obj =3D object_resolve_path_type("", TYPE_ISA_BUS, &ambiguous); =20 - aml_append(scope, build_rtc_device_aml()); aml_append(scope, build_kbd_device_aml()); aml_append(scope, build_mouse_device_aml()); if (fdc) { diff --git a/hw/rtc/mc146818rtc.c b/hw/rtc/mc146818rtc.c index 9c30cbdcd7..fe05a4488e 100644 --- a/hw/rtc/mc146818rtc.c +++ b/hw/rtc/mc146818rtc.c @@ -27,6 +27,7 @@ #include "qemu/cutils.h" #include "qemu/module.h" #include "qemu/bcd.h" +#include "hw/acpi/aml-build.h" #include "hw/irq.h" #include "hw/qdev-properties.h" #include "qemu/timer.h" @@ -1007,13 +1008,34 @@ static void rtc_resetdev(DeviceState *d) } } =20 +static void rtc_build_aml(ISADevice *isadev, Aml *scope) +{ + Aml *dev; + Aml *crs; + + crs =3D aml_resource_template(); + aml_append(crs, aml_io(AML_DECODE16, RTC_ISA_BASE, RTC_ISA_BASE, + 0x10, 0x02)); + aml_append(crs, aml_irq_no_flags(RTC_ISA_IRQ)); + aml_append(crs, aml_io(AML_DECODE16, RTC_ISA_BASE + 2, RTC_ISA_BASE + = 2, + 0x02, 0x06)); + + dev =3D aml_device("RTC"); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0B00"))); + aml_append(dev, aml_name_decl("_CRS", crs)); + + aml_append(scope, dev); +} + static void rtc_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); + ISADeviceClass *isa =3D ISA_DEVICE_CLASS(klass); =20 dc->realize =3D rtc_realizefn; dc->reset =3D rtc_resetdev; dc->vmsd =3D &vmstate_rtc; + isa->build_aml =3D rtc_build_aml; device_class_set_props(dc, mc146818rtc_properties); } =20 --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591973567; cv=none; d=zohomail.com; s=zohoarc; b=Pnq9SpK1ByxxHeohDu0eB6vGW8XZT+sQf6GHIDw8PsvEwMpfIzPA36JRGYFY9SM423rVcaf8ceL7QG9hA/PxBie7WjFozme3nzmldXNastqczIEAkdvSfa9ABZ3w9NZAloekFbtlOuPcxwOePYGntHC4ynBy0R4bxsvlySpk6Xg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591973567; h=Content-Type: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=Yihp2yFMcguSy9jFeXkGeBwz3LCEihh+GUUxuBuxjO0=; b=gSdtbNsS5paCbeknlZx/VFNlRMlX+1YjERSJZlz8kQ7kN59+wu+A7SiGN9AQV+Bfr9dfLewlFEoUjz4bOY08dBUVZ5TXSVTjwmpOn2rMwE2rC1t62YdKyczkJq0W7DMf0gJ5CCyAGOs0+cEOatOln/VzelYZh0wK0ct7BsPGwtk= 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 1591973567379483.2862133764222; Fri, 12 Jun 2020 07:52:47 -0700 (PDT) Received: from localhost ([::1]:38400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjl30-0007Vi-1D for importer@patchew.org; Fri, 12 Jun 2020 10:52:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49588) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl1f-0005Qq-Up for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:23 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:57750 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl1e-0001NE-AC for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:23 -0400 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-141-mTwvBnoSNEWTO6LHipy8hg-1; Fri, 12 Jun 2020 10:51:19 -0400 Received: by mail-wm1-f69.google.com with SMTP id q7so2034106wmj.9 for ; Fri, 12 Jun 2020 07:51:19 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id f9sm10134022wre.65.2020.06.12.07.51.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973481; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Yihp2yFMcguSy9jFeXkGeBwz3LCEihh+GUUxuBuxjO0=; b=hRsrgQquDmSV1GRkEXYNz1GPnaFH6U+Ggbgpr4Br62uJj6iv6TlxY1wYx1NyFO5LqQYxPd 9OKCSep1H9JqI2RuciELYzXwKp731eesoS/3nGwR57Ht52RcGf4MFZfSB4zd/ag/1qNqEJ hHv6804l53PfqJ5/cNYMZo5y7GV7q80= X-MC-Unique: mTwvBnoSNEWTO6LHipy8hg-1 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=Yihp2yFMcguSy9jFeXkGeBwz3LCEihh+GUUxuBuxjO0=; b=f9SlLKSPFXMlYt38yshq6OT4KQPdWeoxVWUOjQoa+tl4JUy6KSczR5qthME/V5zrh/ ibccx1axjjne6OJCPG4S2USghs9WxXq51lplZGjU8KEX20tYAbgDKiYRO1FYeKLp60Px KNXMgijpa7/kF7zqc3rK20dO/U5fgSOeRkfYPYNO6ym3FOgytjHl/LgS+llqjIMQlf+T e9iPR4QWqrmuwon65n2l6HgzVS7I3FdCoUwpgy8lugGik5kc146LUH2su0mJXUNg2lR9 rIhBYLPtCOpROx4+9WhoZeK2H1MFXJnEmPmCgQPPvyNoRTlTnWSsYKUVihxFN/g8sYD3 UkZA== X-Gm-Message-State: AOAM531vFeFMiV0+uLbzzv7SLrTSYN0+dX+xQEhL6CfuVngF2lPtWKGq J1hT4V9i/91Gvh/+G5Vrpu1Qt/ize7WhOREUVKCJSzq5+Wc3IuGjfXNv49MbyzPrZU1wNMRg2d7 PyGdL4bky0iy3XC8= X-Received: by 2002:a7b:c1ce:: with SMTP id a14mr14333526wmj.144.1591973478207; Fri, 12 Jun 2020 07:51:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyI2MR9iN3aR/RD9EO4Em5OmMWD1qY8IFsKnkP4tibDnLG5SaU96a7YSvkwWFVBSQyDOawX0g== X-Received: by 2002:a7b:c1ce:: with SMTP id a14mr14333508wmj.144.1591973478048; Fri, 12 Jun 2020 07:51:18 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:16 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 07/58] acpi: rtc: use a single crs range Message-ID: <20200612141917.9446-8-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:17 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Paolo Bonzini , Gerd Hoffmann , 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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Gerd Hoffmann Use a single io range for _CRS instead of two, following what real hardware does. Signed-off-by: Gerd Hoffmann Reviewed-by: Igor Mammedov Message-Id: <20200515150421.25479-4-kraxel@redhat.com> --- hw/rtc/mc146818rtc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/rtc/mc146818rtc.c b/hw/rtc/mc146818rtc.c index fe05a4488e..1e9fa0f33f 100644 --- a/hw/rtc/mc146818rtc.c +++ b/hw/rtc/mc146818rtc.c @@ -1013,12 +1013,14 @@ static void rtc_build_aml(ISADevice *isadev, Aml *s= cope) Aml *dev; Aml *crs; =20 + /* + * Reserving 8 io ports here, following what physical hardware + * does, even though qemu only responds to the first two ports. + */ crs =3D aml_resource_template(); aml_append(crs, aml_io(AML_DECODE16, RTC_ISA_BASE, RTC_ISA_BASE, - 0x10, 0x02)); + 0x01, 0x08)); aml_append(crs, aml_irq_no_flags(RTC_ISA_IRQ)); - aml_append(crs, aml_io(AML_DECODE16, RTC_ISA_BASE + 2, RTC_ISA_BASE + = 2, - 0x02, 0x06)); =20 dev =3D aml_device("RTC"); aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0B00"))); --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591973694; cv=none; d=zohomail.com; s=zohoarc; b=gGpcLrRTbn/HtmP7b3gZrhS8DgRdcqh6K5ionI7rQduYS+m8xM+dPFDJko4qLLK1f8JsjNWsqz5sLys7Gd6nBzts439OePIzQ8JZKCgW9NMEkKKbBi9OHyzdwCnv/SfaIwAccHFNUR2IA9OqH0aLbdNcFzQzq3M7lMEv1fxd008= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591973694; 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=3luZdMVyzlQigwCf25ntlxiRwHdihmch0JzTpvPMHt4=; b=CZsPCg5BWYsQT5lmlaz0mrqbQXhTN/L5+RKUI/i1K3GUp+CRCS5vNdoIaKUn9dkeFGutgaUhGclDC8urBfxDTc1FGXpwb6FOtWVGlij2zJQ7L10/DZOLJQID2sgTaW9iJ1fkoVAT/2X+gaRWcf4iu2PLgop9baXg7yjzJyFN+GY= 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 15919736942551004.3733903942648; Fri, 12 Jun 2020 07:54:54 -0700 (PDT) Received: from localhost ([::1]:46866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjl52-0003MA-WE for importer@patchew.org; Fri, 12 Jun 2020 10:54:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl1i-0005Vc-7d for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:26 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:36041 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl1g-0001NQ-Ea for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:25 -0400 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-364-HR-c2yN5NZOIurtpgBMqbQ-1; Fri, 12 Jun 2020 10:51:21 -0400 Received: by mail-wr1-f71.google.com with SMTP id l1so3984112wrc.8 for ; Fri, 12 Jun 2020 07:51:21 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id y80sm9200104wmc.34.2020.06.12.07.51.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973483; 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=3luZdMVyzlQigwCf25ntlxiRwHdihmch0JzTpvPMHt4=; b=JGl8VLRv7QXkYXr5xpub/QzDsgZy+YBF/gc/QZHL7b9fyXHAdfwp33mn+Xp5Gz/4/u6P4R 4YnEo3jtFPS+Qqr0hi8NEcWWkM84QentJS2/uApxkEpwEJDczOsW+hH/Ds+/1x6xoQ8wL3 5UZr10uQik0cd4QCpc5+Uak6vUh+2Fo= X-MC-Unique: HR-c2yN5NZOIurtpgBMqbQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=3luZdMVyzlQigwCf25ntlxiRwHdihmch0JzTpvPMHt4=; b=s1HzD0g1AkkO+HZvqEmsoA17XqAa2jorAzH1NMOBuqlU9bVPY9cn2NSKXVDzAcsrPo mKRjrTGu3tpcg730v9SaZ/O+4Ou3XE++Ym55ysFae7LBNWAWu4DooFw50nlAH3CaBS0i 2FlJWVmkAyDya7IcD57kNOsiQB1pCkIxHUPW9o4ti9Wh2zooVJsq0ooam3CghkAkQrdJ VXHkaMxRs9jp/rpHYVKauQXUACQME0lOJ1v/unN2Mihnx/tAa3IzVaNgj4qrgbwCEjFd iyN31qVCaXiJbV2iVs9zg1hu+CZor5TA/264O4WictrBWNgJz7bDHpFmxwlTlK+lN41a FGAA== X-Gm-Message-State: AOAM533H3IMU+UyqTMvQwB6YySY4P06luAX1nIhZ1X+dpqwIeQ4VgsLh 93yd0p3cUDnry+kj1unRiB5yi3MG+rGWwi7javRCP+LMRTId6FmXLJMfVEx6fGPp1+8liyrr3kJ S1iqIHhQmc1/H+IM= X-Received: by 2002:a1c:9896:: with SMTP id a144mr13548287wme.75.1591973480541; Fri, 12 Jun 2020 07:51:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDToCNur4o9tcugHwWj9jToyFrRqE9wWkqek/dvAyQU2moUF2aO3prp+Yb6Q7iz5BawZAAqg== X-Received: by 2002:a1c:9896:: with SMTP id a144mr13548277wme.75.1591973480358; Fri, 12 Jun 2020 07:51:20 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:18 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 08/58] acpi: serial: don't use _STA method Message-ID: <20200612141917.9446-9-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 09:30:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , Gerd Hoffmann , Igor Mammedov , Paolo Bonzini , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Gerd Hoffmann The _STA method dates back to the days where we had a static DSDT. The device is listed in the DSDT table unconditionally and the _STA method checks a bit in the isa bridge pci config space to figure whenever a given is isa device is present or not, then evaluates to 0x0f (present) or 0x00 (absent). These days the DSDT is generated by qemu anyway, so if a device is not present we can simply drop it from the DSDT instead. Signed-off-by: Gerd Hoffmann Reviewed-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200515150421.25479-5-kraxel@redhat.com> --- hw/i386/acpi-build.c | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index df5417c75f..cb22cb0fe6 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1208,50 +1208,34 @@ static Aml *build_lpt_device_aml(void) return dev; } =20 -static Aml *build_com_device_aml(uint8_t uid) +static void build_com_device_aml(Aml *scope, uint8_t uid) { Aml *dev; Aml *crs; - Aml *method; - Aml *if_ctx; - Aml *else_ctx; - Aml *zero =3D aml_int(0); - Aml *is_present =3D aml_local(0); - const char *enabled_field =3D "CAEN"; uint8_t irq =3D 4; uint16_t io_port =3D 0x03F8; =20 assert(uid =3D=3D 1 || uid =3D=3D 2); if (uid =3D=3D 2) { - enabled_field =3D "CBEN"; irq =3D 3; io_port =3D 0x02F8; } + if (!memory_region_present(get_system_io(), io_port)) { + return; + } =20 dev =3D aml_device("COM%d", uid); aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0501"))); aml_append(dev, aml_name_decl("_UID", aml_int(uid))); =20 - method =3D aml_method("_STA", 0, AML_NOTSERIALIZED); - aml_append(method, aml_store(aml_name("%s", enabled_field), is_present= )); - if_ctx =3D aml_if(aml_equal(is_present, zero)); - { - aml_append(if_ctx, aml_return(aml_int(0x00))); - } - aml_append(method, if_ctx); - else_ctx =3D aml_else(); - { - aml_append(else_ctx, aml_return(aml_int(0x0f))); - } - aml_append(method, else_ctx); - aml_append(dev, method); + aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); =20 crs =3D aml_resource_template(); aml_append(crs, aml_io(AML_DECODE16, io_port, io_port, 0x00, 0x08)); aml_append(crs, aml_irq_no_flags(irq)); aml_append(dev, aml_name_decl("_CRS", crs)); =20 - return dev; + aml_append(scope, dev); } =20 static void build_isa_devices_aml(Aml *table) @@ -1268,8 +1252,8 @@ static void build_isa_devices_aml(Aml *table) aml_append(scope, build_fdc_device_aml(fdc)); } aml_append(scope, build_lpt_device_aml()); - aml_append(scope, build_com_device_aml(1)); - aml_append(scope, build_com_device_aml(2)); + build_com_device_aml(scope, 1); + build_com_device_aml(scope, 2); =20 if (ambiguous) { error_report("Multiple ISA busses, unable to define IPMI ACPI data= "); --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591973690; cv=none; d=zohomail.com; s=zohoarc; b=gbtC/lSTQcWErAqfDIpFaJEdEnXOXavtFNx2L/re5Pi+d0EqM45BKuvO//aj1kJZuwMOdCGaEDvRg10/TwKuF/clmz89Spl08B1BcfBSYRQSrBICIFPLBrSfBnO8Mg3hqGIGkhd50lgER8rPEDDHOmU5gr8a3WT/E3ray52Quxg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591973690; 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=loh3X3+SXpnVYZPqqNYKR+1uymLr/TH131RlRRt7Mrw=; b=drHL7UocqrIP0+we25wMWR2AEDdbDU1Cysr0izgMm2Jb+jEuWt3uwALY7SSqRGQlVnIkPCf1sczpkRrFx/RJ8pLEWsvgtfJcxoCInzaFquXD+4i0lYzlSWSJDvj7DfTI7fgvJnDxP+zo6sOwgAfylbqw516rw+o2JCiDVCTajd0= 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 1591973690025215.88216341714758; Fri, 12 Jun 2020 07:54:50 -0700 (PDT) Received: from localhost ([::1]:46466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjl4y-0003CI-P0 for importer@patchew.org; Fri, 12 Jun 2020 10:54:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49698) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl1n-0005ik-NB for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:31 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:41392 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl1l-0001O8-SJ for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:31 -0400 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-68-KCQ7P_SPMbyMKq7NmMBxUQ-1; Fri, 12 Jun 2020 10:51:27 -0400 Received: by mail-wm1-f69.google.com with SMTP id u15so2034421wmm.5 for ; Fri, 12 Jun 2020 07:51:27 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id 40sm11158791wrc.15.2020.06.12.07.51.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973489; 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=loh3X3+SXpnVYZPqqNYKR+1uymLr/TH131RlRRt7Mrw=; b=eQgKiJafPq6N17SWuWDcXhUstVcPgRuwQ6c0bt2EiUaQ2vPVKyFULB/kZpV4yo+mAVJD2m aGOsQ/onvYl/eKIN2LHWxsb7PalCb0b5PYHHXoRmT1Ry40B+bgeIonGFmnzcOZ4Dpo7cZ0 BF/Vl9V491yTHD/axSlVG4j2bOX8rLo= X-MC-Unique: KCQ7P_SPMbyMKq7NmMBxUQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=loh3X3+SXpnVYZPqqNYKR+1uymLr/TH131RlRRt7Mrw=; b=AOif7dkIkQXWj0064n6p5ClGJBXXNzMuN0licIHQ4vIIBiJxALkp4pTXq3+SUbNsU2 OmiBgPsLxXUpr8nReef9EbZg0Rxnb3dyruZKZWC0mx4KrOoiTOgSlZvfsYjVsA2ohm7q adCCYpOT8mQKaP3Q9kj5dSATK0WwQWVPHFi3KeEPGFJHJ3dZuJI+TdHC4nT6fex/5gGl ui/J3nI8jaW6wiBK1ttnlIuJwIoUwqzk8T4kxieO1yKhiR6OIeYamNu13WSt9htl0QWj F7obIAwfk/hRwqbMaiDZzig1AYedUizrZuqNQ/+mXJMmOkvsB9O0SsAcXg2QJRyqLPV+ CH7Q== X-Gm-Message-State: AOAM533NUM3KkSTKHvV5txTMOFr9nbpB+e1Vvqggke/Xu3QowcNx8nOA xHbN7yxf2FmeqtYJ2epwot8lbUcXagrcK+E6ai3FRTccQIDLGIh7mcZ/muVcjQPk2TL60qRakpU 6XjZljTW0HI5PAe8= X-Received: by 2002:a1c:7206:: with SMTP id n6mr14233883wmc.4.1591973483207; Fri, 12 Jun 2020 07:51:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2wIMdcECWDx1W9/F27uwoiq2hrAbmk1LTDZI64gJdWi8mhBBqiCuYhMZYQmVg78U43XpbqQ== X-Received: by 2002:a1c:7206:: with SMTP id n6mr14233867wmc.4.1591973483018; Fri, 12 Jun 2020 07:51:23 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:20 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 09/58] acpi: move aml builder code for serial device Message-ID: <20200612141917.9446-10-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 09:30:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , Igor Mammedov , Gerd Hoffmann , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Paolo Bonzini , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Gerd Hoffmann The code uses the isa_serial_io array to figure what the device uid is. Side effect is that acpi antries are not limited to port 1+2 any more, we'll also get entries for ports 3+4. Signed-off-by: Gerd Hoffmann Reviewed-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200515150421.25479-6-kraxel@redhat.com> --- hw/char/serial-isa.c | 22 ++++++++++++++++++++++ hw/i386/acpi-build.c | 32 -------------------------------- 2 files changed, 22 insertions(+), 32 deletions(-) diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c index f9b6eed783..165e320e65 100644 --- a/hw/char/serial-isa.c +++ b/hw/char/serial-isa.c @@ -27,6 +27,7 @@ #include "qapi/error.h" #include "qemu/module.h" #include "sysemu/sysemu.h" +#include "hw/acpi/aml-build.h" #include "hw/char/serial.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" @@ -81,6 +82,25 @@ static void serial_isa_realizefn(DeviceState *dev, Error= **errp) isa_register_ioport(isadev, &s->io, isa->iobase); } =20 +static void serial_isa_build_aml(ISADevice *isadev, Aml *scope) +{ + ISASerialState *isa =3D ISA_SERIAL(isadev); + Aml *dev; + Aml *crs; + + crs =3D aml_resource_template(); + aml_append(crs, aml_io(AML_DECODE16, isa->iobase, isa->iobase, 0x00, 0= x08)); + aml_append(crs, aml_irq_no_flags(isa->isairq)); + + dev =3D aml_device("COM%d", isa->index + 1); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0501"))); + aml_append(dev, aml_name_decl("_UID", aml_int(isa->index + 1))); + aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); + aml_append(dev, aml_name_decl("_CRS", crs)); + + aml_append(scope, dev); +} + static const VMStateDescription vmstate_isa_serial =3D { .name =3D "serial", .version_id =3D 3, @@ -103,9 +123,11 @@ static Property serial_isa_properties[] =3D { static void serial_isa_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); + ISADeviceClass *isa =3D ISA_DEVICE_CLASS(klass); =20 dc->realize =3D serial_isa_realizefn; dc->vmsd =3D &vmstate_isa_serial; + isa->build_aml =3D serial_isa_build_aml; device_class_set_props(dc, serial_isa_properties); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index cb22cb0fe6..6de25f6484 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1208,36 +1208,6 @@ static Aml *build_lpt_device_aml(void) return dev; } =20 -static void build_com_device_aml(Aml *scope, uint8_t uid) -{ - Aml *dev; - Aml *crs; - uint8_t irq =3D 4; - uint16_t io_port =3D 0x03F8; - - assert(uid =3D=3D 1 || uid =3D=3D 2); - if (uid =3D=3D 2) { - irq =3D 3; - io_port =3D 0x02F8; - } - if (!memory_region_present(get_system_io(), io_port)) { - return; - } - - dev =3D aml_device("COM%d", uid); - aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0501"))); - aml_append(dev, aml_name_decl("_UID", aml_int(uid))); - - aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); - - crs =3D aml_resource_template(); - aml_append(crs, aml_io(AML_DECODE16, io_port, io_port, 0x00, 0x08)); - aml_append(crs, aml_irq_no_flags(irq)); - aml_append(dev, aml_name_decl("_CRS", crs)); - - aml_append(scope, dev); -} - static void build_isa_devices_aml(Aml *table) { ISADevice *fdc =3D pc_find_fdc0(); @@ -1252,8 +1222,6 @@ static void build_isa_devices_aml(Aml *table) aml_append(scope, build_fdc_device_aml(fdc)); } aml_append(scope, build_lpt_device_aml()); - build_com_device_aml(scope, 1); - build_com_device_aml(scope, 2); =20 if (ambiguous) { error_report("Multiple ISA busses, unable to define IPMI ACPI data= "); --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591973794; cv=none; d=zohomail.com; s=zohoarc; b=J6E05DjlyOnvWC6HRvrogjQGjF4fcEZ7w/TbCowceWfw+G43P4FBoB+Qbf42e5+ylWk7woMUtTMfa0mVmTgBsy718SK6S/NC8IXtqIHKiXtDfrxcS6vZkvWH1raKANLlWWOtPgfvyCK4fFvlAhBxMTaUVcQieYkqmM7n0M3NqSs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591973794; h=Content-Type: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=eElz0rYHeKUNjkzhwC6MFQcNn/IDvjC4Rb+mBNhdY5E=; b=SXZy2WW8yqJUNK6A3Np5IuKrK/BC8mOTMW+Kml1V+pANgRELeIIaxf99jRH86dM1fnRmy0z3s0pZj7UnHJhChlZU2Jg7WRTLCdzccVY7AgTMys5ly8JsfnKVcd3BV/H7ePdDYmVQ3LtL9xKESrLiccPQRW/jtcySkjBRBQ30ZrQ= 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 1591973794155257.2772784812955; Fri, 12 Jun 2020 07:56:34 -0700 (PDT) Received: from localhost ([::1]:54314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjl6e-0006Z8-T8 for importer@patchew.org; Fri, 12 Jun 2020 10:56:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49694) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl1n-0005hJ-2R for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:31 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:29730 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl1l-0001O2-CE for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:30 -0400 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-487--Zh3xB-UP0myQ8nuMJHo3g-1; Fri, 12 Jun 2020 10:51:26 -0400 Received: by mail-wm1-f70.google.com with SMTP id p24so2034505wma.4 for ; Fri, 12 Jun 2020 07:51:26 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id 88sm11327904wre.45.2020.06.12.07.51.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973488; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=eElz0rYHeKUNjkzhwC6MFQcNn/IDvjC4Rb+mBNhdY5E=; b=RT3V9VC9o+Vsf98pqeXklh4zw1xFMXrSxXGyvacytp2ZD4euS8Nz7+k5zZIPt3anEce34Y X+V1yLahQuinOS2sWnlTtFhgYJWq6Iev8KwUpJ9ibTiVILXJD2b/CO4J3PQtnoc9QybK9K 9C/YlnUiPPq2yUx2Krc0GdbqJJzEPho= X-MC-Unique: -Zh3xB-UP0myQ8nuMJHo3g-1 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=eElz0rYHeKUNjkzhwC6MFQcNn/IDvjC4Rb+mBNhdY5E=; b=ZfzWY1yLbklLPtIeQlA/0Tov2Btl3XhPVPvqXtkQpMu3/oRB0fpPTR0beQianxLgEu wZ94s5FPmN5YHaOZQYUrjX1EUhQ+uoRAXahzfmgLstUg0P7H9NdV/S/8qj5FnTHJOpl6 HweIFyLHYoevCj9hHUyE16uJ6Gw/2tmswJNQch8VwOEyHNbp56+OxRAhUNXgRKPQS3nZ l+WcHmy94J8j1TIbE1QfUKly3XEym6i1qj0trQa3Za+2MNWEk0Acs+HimQBcBWRwB+DF o9gpv2IdlwuzLyMiiWOY3BXs4Qzi9Ku64PPzlNDHZ9m6St++xew7fLPcsVdLTXfJqDmb x4hg== X-Gm-Message-State: AOAM530WedUJoKr9FfRbbiT6cV6A2jFzjpeLItxPEX0qRwX0kZtA419F v3yXXX5vPN+NMLa6nxLHDTNKReeVowPjI2fU2kKbgIwiCnDQA1fDVvN/f5h28gUneKxU8qxubcn TvdzcYKYZvnCygU8= X-Received: by 2002:adf:a18b:: with SMTP id u11mr15250682wru.102.1591973485467; Fri, 12 Jun 2020 07:51:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlegNpe6tsxrdR/sdAWfEXbFwlkS2Pz4v7NRMTJq4RF5jPAhrC7VNd/2w46+/o/xO8jkai3A== X-Received: by 2002:adf:a18b:: with SMTP id u11mr15250657wru.102.1591973485236; Fri, 12 Jun 2020 07:51:25 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:23 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 10/58] acpi: parallel: don't use _STA method Message-ID: <20200612141917.9446-11-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , Gerd Hoffmann , Igor Mammedov , Paolo Bonzini , 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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Gerd Hoffmann The _STA method dates back to the days where we had a static DSDT. The device is listed in the DSDT table unconditionally and the _STA method checks a bit in the isa bridge pci config space to figure whenever a given is isa device is present or not, then evaluates to 0x0f (present) or 0x00 (absent). These days the DSDT is generated by qemu anyway, so if a device is not present we can simply drop it from the DSDT instead. Signed-off-by: Gerd Hoffmann Reviewed-by: Igor Mammedov Message-Id: <20200515150421.25479-7-kraxel@redhat.com> --- hw/i386/acpi-build.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 6de25f6484..2cafad03e2 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1173,39 +1173,26 @@ static Aml *build_mouse_device_aml(void) return dev; } =20 -static Aml *build_lpt_device_aml(void) +static void build_lpt_device_aml(Aml *scope) { Aml *dev; Aml *crs; - Aml *method; - Aml *if_ctx; - Aml *else_ctx; - Aml *zero =3D aml_int(0); - Aml *is_present =3D aml_local(0); + + if (!memory_region_present(get_system_io(), 0x0378)) { + return; + } =20 dev =3D aml_device("LPT"); aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0400"))); =20 - method =3D aml_method("_STA", 0, AML_NOTSERIALIZED); - aml_append(method, aml_store(aml_name("LPEN"), is_present)); - if_ctx =3D aml_if(aml_equal(is_present, zero)); - { - aml_append(if_ctx, aml_return(aml_int(0x00))); - } - aml_append(method, if_ctx); - else_ctx =3D aml_else(); - { - aml_append(else_ctx, aml_return(aml_int(0x0f))); - } - aml_append(method, else_ctx); - aml_append(dev, method); + aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); =20 crs =3D aml_resource_template(); aml_append(crs, aml_io(AML_DECODE16, 0x0378, 0x0378, 0x08, 0x08)); aml_append(crs, aml_irq_no_flags(7)); aml_append(dev, aml_name_decl("_CRS", crs)); =20 - return dev; + aml_append(scope, dev); } =20 static void build_isa_devices_aml(Aml *table) @@ -1221,7 +1208,7 @@ static void build_isa_devices_aml(Aml *table) if (fdc) { aml_append(scope, build_fdc_device_aml(fdc)); } - aml_append(scope, build_lpt_device_aml()); + build_lpt_device_aml(scope); =20 if (ambiguous) { error_report("Multiple ISA busses, unable to define IPMI ACPI data= "); --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591973916; cv=none; d=zohomail.com; s=zohoarc; b=ifDTsEvOO4Rm38mbHO6pKHHbIeBURTkG5UXNiaUxs3e8ChWDbtrmSfh2B6GhiU1b8v91qO/fEhwfGV2PKfmy0j1UBO31bCJRhwnRpXQOWEbkB7Mcm/gvrL35dOaPQED0IpsgdCXH7ZM7WvHEDN4+P0yzceU4Pr7pHJczW6Vke6E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591973916; 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=KpsP6snzFwXir/Xzc+9Qv0RUmc46Jj6u+9GlR3QS4bo=; b=W1a1evDwkNd0bbhJZ7W4VuCojd2+JwAyB/J/qyS09d4giwvLMMN6f+Lje6nDuVWI3TFdjTjwUM0oIwYsxsoV0lI6AWo7OiSEbgOXZQgpsgi7GUrm1Hf6VUqav9J5Ud/ps1uKA8nlwjlkmeATEiOf/SXyWWiu9V0pOEq8ywUkVcc= 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 1591973916273123.06719425081951; Fri, 12 Jun 2020 07:58:36 -0700 (PDT) Received: from localhost ([::1]:34660 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjl8c-00023W-Ci for importer@patchew.org; Fri, 12 Jun 2020 10:58:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl1p-0005oE-Ox for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:33 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:54386 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl1n-0001OR-Tu for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:33 -0400 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-317-T1IOaocINeyIfa33qLyWMQ-1; Fri, 12 Jun 2020 10:51:29 -0400 Received: by mail-wr1-f70.google.com with SMTP id c14so3961574wrw.11 for ; Fri, 12 Jun 2020 07:51:29 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id x18sm8853389wmi.35.2020.06.12.07.51.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973491; 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=KpsP6snzFwXir/Xzc+9Qv0RUmc46Jj6u+9GlR3QS4bo=; b=Iag6ZhhP1jMPgMJlwvD/q5HIre97nOgUsVZN+Gr1rwBtmh7ssoIw7EWW6ipJQEobWEIX36 69E0vQrqb3yWq0tTEujyfDCt1AUWec4/BLygO1NhcS0uaWawZoHBLn6BALTsMwiWrcUa9i H8S4VNylv9YpuF/qzv/2PRBlSSLPPqo= X-MC-Unique: T1IOaocINeyIfa33qLyWMQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=KpsP6snzFwXir/Xzc+9Qv0RUmc46Jj6u+9GlR3QS4bo=; b=jpZRCfeIJg/S2Np+Mhb98xs4ExECfzCrVXaX/m388DVjt3+yeej64KeK5cB89TFDkG qrN8LmY9Z9DBmHKpqnKgBEyaLp4Y2u16QJBlRDSeDu1FC3dDO8avgZqDZ33mlvLUyrdy snmYnbUwMB9eYrFsdty8L9c6B+BvVN7PjiVqjWeVKyVx07+hDRyZltDrT7W5U4PtClkf nuWsltyNfvhH3+I/+3I1+We0JKJxtYSPEJ5vh627eVFie2Hy/3mHRaN+R0KPcwrK/wAw StbrJeOklE7BzciKhfY1YlTYh8WgQo6BnGyzSJ2mUSd+vEutpOksXlrCQSKFsC2CuLeY iydw== X-Gm-Message-State: AOAM530b/25DePiEhU3WaR/wCf/v2NN0HqWA2dduTtDFrPO0rTiWIr2l qzeU83DnyVgcOwxdIk0Nhgh18mWEBa2fV4eKIrlfnNDrNCrCG0CtST86u1loyScBmruh7/662cV ZvtmpEDomcrq0oP4= X-Received: by 2002:a5d:5704:: with SMTP id a4mr15280569wrv.389.1591973488111; Fri, 12 Jun 2020 07:51:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8xJDnl0b3jVB+hsMKJucrZNmC19qNHHbLXV7tqtyW/zHJTYVWw/AyvpbR8PnZJTsMmU1gSQ== X-Received: by 2002:a5d:5704:: with SMTP id a4mr15280547wrv.389.1591973487935; Fri, 12 Jun 2020 07:51:27 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:25 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 11/58] acpi: move aml builder code for parallel device Message-ID: <20200612141917.9446-12-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:17 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , Igor Mammedov , Gerd Hoffmann , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Paolo Bonzini , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Gerd Hoffmann Also adds support for multiple LPT devices. Signed-off-by: Gerd Hoffmann Reviewed-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200515150421.25479-8-kraxel@redhat.com> --- hw/char/parallel.c | 22 ++++++++++++++++++++++ hw/i386/acpi-build.c | 23 ----------------------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/hw/char/parallel.c b/hw/char/parallel.c index 8dd67d1375..c0f34bf924 100644 --- a/hw/char/parallel.c +++ b/hw/char/parallel.c @@ -28,6 +28,7 @@ #include "qemu/module.h" #include "chardev/char-parallel.h" #include "chardev/char-fe.h" +#include "hw/acpi/aml-build.h" #include "hw/irq.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" @@ -568,6 +569,25 @@ static void parallel_isa_realizefn(DeviceState *dev, E= rror **errp) s, "parallel"); } =20 +static void parallel_isa_build_aml(ISADevice *isadev, Aml *scope) +{ + ISAParallelState *isa =3D ISA_PARALLEL(isadev); + Aml *dev; + Aml *crs; + + crs =3D aml_resource_template(); + aml_append(crs, aml_io(AML_DECODE16, isa->iobase, isa->iobase, 0x08, 0= x08)); + aml_append(crs, aml_irq_no_flags(isa->isairq)); + + dev =3D aml_device("LPT%d", isa->index + 1); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0400"))); + aml_append(dev, aml_name_decl("_UID", aml_int(isa->index + 1))); + aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); + aml_append(dev, aml_name_decl("_CRS", crs)); + + aml_append(scope, dev); +} + /* Memory mapped interface */ static uint64_t parallel_mm_readfn(void *opaque, hwaddr addr, unsigned siz= e) { @@ -624,9 +644,11 @@ static Property parallel_isa_properties[] =3D { static void parallel_isa_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); + ISADeviceClass *isa =3D ISA_DEVICE_CLASS(klass); =20 dc->realize =3D parallel_isa_realizefn; dc->vmsd =3D &vmstate_parallel_isa; + isa->build_aml =3D parallel_isa_build_aml; device_class_set_props(dc, parallel_isa_properties); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 2cafad03e2..58fe505fb6 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1173,28 +1173,6 @@ static Aml *build_mouse_device_aml(void) return dev; } =20 -static void build_lpt_device_aml(Aml *scope) -{ - Aml *dev; - Aml *crs; - - if (!memory_region_present(get_system_io(), 0x0378)) { - return; - } - - dev =3D aml_device("LPT"); - aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0400"))); - - aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); - - crs =3D aml_resource_template(); - aml_append(crs, aml_io(AML_DECODE16, 0x0378, 0x0378, 0x08, 0x08)); - aml_append(crs, aml_irq_no_flags(7)); - aml_append(dev, aml_name_decl("_CRS", crs)); - - aml_append(scope, dev); -} - static void build_isa_devices_aml(Aml *table) { ISADevice *fdc =3D pc_find_fdc0(); @@ -1208,7 +1186,6 @@ static void build_isa_devices_aml(Aml *table) if (fdc) { aml_append(scope, build_fdc_device_aml(fdc)); } - build_lpt_device_aml(scope); =20 if (ambiguous) { error_report("Multiple ISA busses, unable to define IPMI ACPI data= "); --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.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=1591973949; cv=none; d=zohomail.com; s=zohoarc; b=fc/5h45pUpT6RdsL7lwZSGB65q/VpVEUCl5wKLsXWRcFM0GB8ftrtA9MPdiw7MXKmtECwD8sWfZkWMmIEVJKNISCCouavjPaIlsv2wTVOjUrzNLwjOeeq9AM95LZAmrZyRlM/iww3/xOIQ3Ulic+JaMhVvLCmD5QpmCnrhMRItY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591973949; h=Content-Type: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=X1RKlsb6AEJshxT1rDVPojn/FQXyVSb9E/OqRamo79c=; b=CkVh5yKjPgp5ghIPLDUrYWoHJ848NctIFwYuNdOCqDkWYzhLz/1Rp6ZRMh8CJk/YSj+5UWyTFzXuxO8JULU3ksklAOzcSjL/twmYP2EVG/1ZOMS1AgH7etI7o+HM75MPnVMz5QgnTHUepKMCA42MFXssUSf2E5tMbLelg4VuRmQ= 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 1591973949743834.4742937755889; Fri, 12 Jun 2020 07:59:09 -0700 (PDT) Received: from localhost ([::1]:36028 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjl9A-0002cW-GW for importer@patchew.org; Fri, 12 Jun 2020 10:59:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl26-0006OX-6T for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:50 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:29763 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl23-0001QB-JS for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:49 -0400 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-444-WC_ANEcwONmI6U3QtUtVlw-1; Fri, 12 Jun 2020 10:51:34 -0400 Received: by mail-wm1-f70.google.com with SMTP id t145so2545435wmt.2 for ; Fri, 12 Jun 2020 07:51:34 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id e5sm10537132wrw.19.2020.06.12.07.51.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973506; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=X1RKlsb6AEJshxT1rDVPojn/FQXyVSb9E/OqRamo79c=; b=PCVeM/m/dUxwpINXCzqFPyuyeD/styw4yPQf32Pl1R2QGOlfcyB/HFsrNd7vic8ppODrVr YTwZH6hbhaIVKgiWG4oG1vqHhqlRFduPgSP3Xb+myRa1TeagOmIWGfk2MvKo8Qq9sri0Jw EYfUyDBpWhaVc49ieUjirGyYjLtPGZ4= X-MC-Unique: WC_ANEcwONmI6U3QtUtVlw-1 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=X1RKlsb6AEJshxT1rDVPojn/FQXyVSb9E/OqRamo79c=; b=Ho7/+argHs0bB3d1vJmH+TAxsBf4YAJ7Cax4la9OvPUh9UMVt0Bzh5XVMrN9lx3oz+ tYKMjNA/WcvCaF0Uz1zzeEieKd2paLQRCjOWKArvluLiRRGltk7g3q8H5SmaiFBexS+7 VWrgoR0dAEXYWYhRHbegbxcVI8vexJ2sJZ3ScE7305mMXYhmcNT7JqueQYusT+WTE0lu QQ67JFLz/bobc8nJ+Y1+GxxBNzY4pbag8KzpRbW3MST4xEeAX2KL/DyYyYzyAaH6OCnc VTfmu0LvF+rSUsIETQ2H96kmjhYQ8oH68bVlvB+LnFRzvwkr4vhkZq0a0uNJPQYdngC2 UP2A== X-Gm-Message-State: AOAM531XpD5dYqCCj+lU7yrHoAMDt9VOv4epDK7andpw/ICinwoaSXzO 6blzXyvIHmPy3Njoz6YBuwKpGYjr5K1IGyNuXH2TibKkQm2w+rIZQ2TuDjBq8qgeVuOmD+JqIOo PvXoKP5QJsNWDkl8= X-Received: by 2002:a1c:e914:: with SMTP id q20mr13296044wmc.145.1591973490348; Fri, 12 Jun 2020 07:51:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpEV7mw9eW5VND3Cq6U+llMbivAejNXShEB85antiQW2bB907UGn6JGkPM706E9SPvui6KUA== X-Received: by 2002:a1c:e914:: with SMTP id q20mr13296013wmc.145.1591973489954; Fri, 12 Jun 2020 07:51:29 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:28 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 12/58] tests/acpi: update DSDT expected files Message-ID: <20200612141917.9446-13-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 09:30:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Update DSDT after CRS changes and _STA methods dropped. Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 17 ----------------- tests/data/acpi/pc/DSDT | Bin 5125 -> 5014 bytes tests/data/acpi/pc/DSDT.acpihmat | Bin 6449 -> 6338 bytes tests/data/acpi/pc/DSDT.bridge | Bin 6984 -> 6873 bytes tests/data/acpi/pc/DSDT.cphp | Bin 5588 -> 5477 bytes tests/data/acpi/pc/DSDT.dimmpxm | Bin 6778 -> 6667 bytes tests/data/acpi/pc/DSDT.ipmikcs | Bin 5197 -> 5086 bytes tests/data/acpi/pc/DSDT.memhp | Bin 6484 -> 6373 bytes tests/data/acpi/pc/DSDT.numamem | Bin 5131 -> 5020 bytes tests/data/acpi/q35/DSDT | Bin 7863 -> 7752 bytes tests/data/acpi/q35/DSDT.acpihmat | Bin 9187 -> 9076 bytes tests/data/acpi/q35/DSDT.bridge | Bin 7880 -> 7769 bytes tests/data/acpi/q35/DSDT.cphp | Bin 8326 -> 8215 bytes tests/data/acpi/q35/DSDT.dimmpxm | Bin 9516 -> 9405 bytes tests/data/acpi/q35/DSDT.ipmibt | Bin 7938 -> 7827 bytes tests/data/acpi/q35/DSDT.memhp | Bin 9222 -> 9111 bytes tests/data/acpi/q35/DSDT.mmio64 | Bin 8993 -> 8882 bytes tests/data/acpi/q35/DSDT.numamem | Bin 7869 -> 7758 bytes 18 files changed, 17 deletions(-) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index 6a052c5044..dfb8523c8b 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1,18 +1 @@ /* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/pc/DSDT", -"tests/data/acpi/pc/DSDT.acpihmat", -"tests/data/acpi/pc/DSDT.bridge", -"tests/data/acpi/pc/DSDT.cphp", -"tests/data/acpi/pc/DSDT.dimmpxm", -"tests/data/acpi/pc/DSDT.ipmikcs", -"tests/data/acpi/pc/DSDT.memhp", -"tests/data/acpi/pc/DSDT.numamem", -"tests/data/acpi/q35/DSDT", -"tests/data/acpi/q35/DSDT.acpihmat", -"tests/data/acpi/q35/DSDT.bridge", -"tests/data/acpi/q35/DSDT.cphp", -"tests/data/acpi/q35/DSDT.dimmpxm", -"tests/data/acpi/q35/DSDT.ipmibt", -"tests/data/acpi/q35/DSDT.memhp", -"tests/data/acpi/q35/DSDT.mmio64", -"tests/data/acpi/q35/DSDT.numamem", diff --git a/tests/data/acpi/pc/DSDT b/tests/data/acpi/pc/DSDT index ad4b2d46cc7865e8bafcca2e4e888a03cc5483b5..384a82dbb3cb0e9f47db6f4d089= 45631c2b72b56 100644 GIT binary patch delta 164 zcmZqGn5NF<66_K(O_+g!v27z)FQb5;xIS}yuv2`1v!{V)uw(q>Ym5)2jC=3Dw@3_0RG zJY9GkFR(Ch#D{viFml8Phd55Y%On+UYPPMU;J z0)_$x0VX8|Mt8;{h9U+gwn~P{%NZZm+xY~9#B;=3DZc)IX7USMGmk%$itabzg)32^mG zSim+pfnf>5LY5_5{2cMlLBWCoT)gg#70eaP92`mw43!MgO|C4?{=3DSAV16Ub3;zK=3DM z7-7aZJK{Fx2lEeR1|JS30kAo4Aajh+%;5sM9^xKnCp-o*{a|9?P~u?NEX>?2004S} BL(TvI diff --git a/tests/data/acpi/pc/DSDT.acpihmat b/tests/data/acpi/pc/DSDT.acp= ihmat index eff7aadfabe431c3ac2d28e0c6721eb6e322af66..47ddfdb027b06dc2daa46be711c= 3f4640ce68320 100644 GIT binary patch delta 164 zcmdmJbjXm)CDXE}*eV$&FK2vMZ|4&b63-Fu;pxKTc!7mML?S*o#F3%EC&1M& zVFBCZ1coIH3t5(M@pHsG2L%fXaPhh`RxnpEb8sj%FjO)`H@UJn`}-Qg3}9vCh!6F2 zVT2ju?13KkUL;&o^I!Tf`n nfkR1vp^_oGNi`_MIUZ&tH_%A9vI2$z21X7g2FA@z%*Vt5d=3Dn{- delta 282 zcmcab|o6X5EX zuz+oH0>cu9g)B?B_&MU8gMtMGxOm+eE0`;oIXILW7%CZ}n_O9({e2B#2Cy=3D6#D{vi zFv5&+cEoMW59S}t3_cu60$_98K;{^snZpHiJ;XiEPIwGr`oYA&p~S(kS(y2lH~`2b BMNI$z diff --git a/tests/data/acpi/pc/DSDT.cphp b/tests/data/acpi/pc/DSDT.cphp index f3572358510f3fbb3d966047274f7aa7835e7bef..54f481faf1e336c0bbf5e774cd6= 7220fe06e951b 100644 GIT binary patch delta 164 zcmcbj{Zxy~CD>tYEHS=3DHO6jV5nq>ZgORD_V+b}8NkZO5g+R5 z!U!|Q*%7xfKbU_oGx%^Q34qOU1DRulW)2t7^$_Ym5)2jC=3Dw@3_0RG zJY9GkFR(Ch#D{viFml8Phd55Y%On+UYPPMU;J z0)_$x0VX8|Mt8;{h9U+gwn~P{%NZZm+xY~9#B;=3DZc)IX7USMGmk%$itabzg)32^mG zSim+pfnf>5LY5_5{2cMlLBWCoT)gg#70eaP92`mw43!MgO|C4?{=3DSAV16Ub3;zK=3DM z7-7aZJK{Fx2lEeR1|JS30kAo4Aajh+%;5sM9^xKnCp-o*{a|9?P~u?NEX@2v3;^?H BMW_G( diff --git a/tests/data/acpi/pc/DSDT.ipmikcs b/tests/data/acpi/pc/DSDT.ipmi= kcs index 469d13e1f6b873bb9cfa0b3af32d1a3bc58e8f77..57b78358744a5bb13639ccddb88= 7be2721240807 100644 GIT binary patch delta 172 zcmX@BaZjDgCDjc!oU$9>gmGB5g#1lIQcGUHE!Nn_l delta 259 zcmcboepZ9aCDCqao0w!UPgOYWqs!OV5j&1XHNsqV8{6ACf%SA=3DXj2I4^I~! z#|zvH9P!RU!GaQ8qV9|Z3tJCJk%$it zabzg)32^mGSim+pfnf>5LY5_yUolDPy0SR?`x?SbXJzDw5A}3mgz0d0MAae3EamD3 t(qV+AgNq5S#R)|V7eBb|o6X5EX zuz+oH0>cu9g)B?B_&MU8gMtMGxOm+eE0`;oIXILW7%CZ}n_O9({e2B#2Cy=3D6#D{vi zFv5&+cEoMW59S}t3_cu60$_98K;{^snZpHiJ;XiEPIwGr`oYA&p~S(kS(y2fC;*9S BMH&DA diff --git a/tests/data/acpi/pc/DSDT.numamem b/tests/data/acpi/pc/DSDT.numa= mem index 9a747f6f08f61c73b891d8f91db01521e635f811..f194bc639482eb839a875d49385= 7526f85f1a9e0 100644 GIT binary patch delta 164 zcmeCyn4`|+66_K(N0@Ym5)2jC=3Dw@3_0RG zJY9GkFR(Ch#D{viFml8Phd55Y%On+Ub|o6X5EX zuz+oH0>cu9g)B?B_&MU8gMtMGxOm+eE0`;oIXILW7%CZ}n_O9({e2B#2Cy=3D6#D{vi zFv5&+cEoMW59S}t3_cu60$_98K;{^snZpHiJ;XiEPIwGr`oYA&p~S(kS(v#~002NJ BM34Xg diff --git a/tests/data/acpi/q35/DSDT b/tests/data/acpi/q35/DSDT index 9fa4d5a405c2bcd9313b13894917622bf156013e..6a5e4dd85a7d9a95f7ad0fb95e6= a4fa7a8d91adb 100644 GIT binary patch delta 164 zcmdmPd%}jxCDXE}*eV$&Yca*u+xY~9#B;=3DZc)IX7USMGmk%$itabzg)32^mG zSim+pfnf>5LY5_5{2cMlLBWCoT)gg#70eaP92`mw43!MgO|C4?{=3DSAV16Ub3;zK=3DM z7-7aZJK{Fx2lEeR1|JS30kAo4Aajh+%;5sM9^xKnCp-o*{a|9?P~u?NEX-^w4FJ*) BL!JNt diff --git a/tests/data/acpi/q35/DSDT.acpihmat b/tests/data/acpi/q35/DSDT.a= cpihmat index 2d834a854ccddc17afd0bc4b4a9e0886feff8e65..c1dd7773f3386a946fcb4a9a3bf= 9ad3a33ddbbe9 100644 GIT binary patch delta 164 zcmaFt{>6>UCDXE}*eV$&Yca*u+xY~9#B;=3DZc)IX7USMGmk%$itabzg)32^mG zSim+pfnf>5LY5_5{2cMlLBWCoT)gg#70eaP92`mw43!MgO|C4?{=3DSAV16Ub3;zK=3DM z7-7aZJK{Fx2lEeR1|JS30kAo4Aajh+%;5sM9^xKnCp-o*{a|9?P~u?NEXzdmz(uv2`1v!{V)uw(q>NTxU`BcFf}LymY4 zPZu7?3oHyA@u8kBj2!X7A&!&pGD(FSIs5y?REWIH4xP delta 282 zcmcaXE}*eV$&Yca*u+xY~9#B;=3DZc)IX7USMGmk%$itabzg)32^mG zSim+pfnf>5LY5_5{2cMlLBWCoT)gg#70eaP92`mw43!MgO|C4?{=3DSAV16Ub3;zK=3DM z7-7aZJK{Fx2lEeR1|JS30kAo4Aajh+%;5sM9^xKnCp-o*{a|9?P~u?NEX?dC4FIJi BLxKPR diff --git a/tests/data/acpi/q35/DSDT.cphp b/tests/data/acpi/q35/DSDT.cphp index c59c19ff46b9bb4fa3e06e9ffbcbeba308a80cd0..74e86176e5fec46e660c567acf8= fbcf08a14bdfb 100644 GIT binary patch delta 164 zcmZp3obJHo66_KpuE4;+=3D(~|ifJwlcU!OTX*eO21+0(!?*fD-`BvYJ}kxxK~AxFH2 zrwfnc1r`R5_)t$5MvnO45XZ@PnWVyvoc(>_(yTxUxHK0(N4#@Tu%G}JuRG%p<{!)q n97+NVl?>5MszD*n@h~H~fkwiW6)+SqFmfm{Fm7&QW|0K|t9T`# delta 282 zcmbR4(B{bH66_Mvroh0!_--SY0F$tnm_BoSuv2`1v!{V)uw#65lkVh?Od=3D8zT%zub z1q=3DlY0!&H_jP8s@3`Gn~Y?Ta?wV2}S?R)}4;yL0yJY9GkFR(C(NW=3D$+I5HIY1i1Po zEMS|Qz_5g2AXE}*eV$&Yca*u+xY~9#B;=3DZc)IX7USMGmk%$itabzg)32^mG zSim+pfnf>5LY5_5{2cMlLBWCoT)gg#70eaP92`mw43!MgO|C4?{=3DSAV16Ub3;zK=3DM z7-7aZJK{Fx2lEeR1|JS30kAo4Aajh+%;5sM9^xKnCp-o*{a|9?P~u?NEX=3D%05de>t BL)!oV diff --git a/tests/data/acpi/q35/DSDT.ipmibt b/tests/data/acpi/q35/DSDT.ipm= ibt index 3910e9b767808962b46501da51945229359e3d1d..38723daef80421ea528b2ad2d41= 1e7357df43956 100644 GIT binary patch delta 172 zcmZp&n{3PF66_K(S&o5$kz*s50F!{5h(2?Cuv2`1v!{V)uw(q>NT#^SZOooB(M?7^ z0U?GQ@gANoJdPJw7&ziXJzW?%;)6pRC*Ng~iZpWe_k~Nd0wv(mT>KpI&OyO~0$jZA uj6axvFf(u{2{2SLL^r7hg*eB+c9V`qY67j(y zjtm7p0j_=3Dt3)m(nFf3tM$g*VeTP7)8R~Bb~UqhJbtc)D-p`I>`Fdfd0s5%sxrCi)V rI*ibCa52HPIH73a;)l3bfQ#3i@dwinCI${A4u;7sOum~Fn2n_Y$^<{r diff --git a/tests/data/acpi/q35/DSDT.memhp b/tests/data/acpi/q35/DSDT.memhp index 8461e984c965da916d828884f6629422e83e429c..98328d1c4197ab19a71de7f3f18= e2985f4910f45 100644 GIT binary patch delta 164 zcmZqknC{Ny66_K(U73M_@z_Q#0VV-&etqWnV5j&1XHNsqV8{5$kxX$?Mm_-{h8*!8 zo-RC&7g!iL;zK=3DM7&+pDLmVgHWs(Xva`yLyOS1wc;L=3D?D9P!RU!GZ!@yzY!Yn13)c na3~2dR5C<2sRo5O$HR=3D|1{w)hR=3D`lez{sJ*z__`IxkUj0OPVJw delta 282 zcmbR4-sZvO66_MfrozC$n6{BifJxX(OrJSE*eO21+0(!?*fBo3Nq6!`CJ_kU;J z0)_$x0VX8|Mt8;{h9U+gwn~P{T1;{Ec0K_i@f`6Uo-RC&7g!iXB;tcZ92p9H0$lwP z7O+iDU|7PikYx!MKS#WCP_Uo?7q2^G1#<;62ZvGvLnT9WlPim}zpo+809Hnh_)t$5 zMwl_qj<}8a!Tf`n!G}Xh0BnvM$Q&aybGU%6hq%Yt36DWcKbROelsFhR3p2MU006lR BLhJwl diff --git a/tests/data/acpi/q35/DSDT.mmio64 b/tests/data/acpi/q35/DSDT.mmi= o64 index fc0cc096baf8aedc0a526978ff796025d7380453..5916c0e9ce0a9607c6230f9dfeb= e2c1be70b2495 100644 GIT binary patch delta 164 zcmZ4Jw#k*tCDXVQ;;W5 delta 282 zcmdnwy3mcwCDzdmz(uv2`1v!{V)uw(q>NTxU`BcFf}LymY4 zPZu7?3oHyA@u8kBj2!X7A&!&pGD(FSIs5yXE}*eV$&Yca*u+xY~9#B;=3DZc)IX7USMGmk%$itabzg)32^mG zSim+pfnf>5LY5_5{2cMlLBWCoT)gg#70eaP92`mw43!MgO|C4?{=3DSAV16Ub3;zK=3DM z7-7aZJK{Fx2lEeR1|JS30kAo4Aajh+%;5sM9^xKnCp-o*{a|9?P~u?NEX-^z4FHR! BLtp>^ --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591973696; cv=none; d=zohomail.com; s=zohoarc; b=Uxd5yKuSbqXKsqJCVCnSvmXvlTvTZE/TIt4OV9FAt6urqdOQAGvAABFhC9y02NfhK4Y52oc4BNs8tTtSdbHtxaD0ylpnb2cMm1ZDCxaCm5Cj4Ib9EwiIvr0k5O0H9rJumyWYa0riaCAFK5WNhWv9qm/CNjmuYLmdabXZgJCxRBo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591973696; 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=LZsBbdZ3FM++Eh4KOihw4hI5M2LDwhoU63KzZvHgyWU=; b=arHehmqcnizcJfldcA44DMWZ16zBFX7/BATo+uJjJygSFJKsfTs8vrAF4isTyqW7PO/1kgisBPrPQjtZOoPQR70NkIcrak+vAaDqpkZ4NZF3z0hPtXeSch6XVh392JT/Y/BxdsTO+TdPOlBCtZnIEQhqgWpq3g4CVdMu1Xc8ENc= 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 1591973696205652.9877875584377; Fri, 12 Jun 2020 07:54:56 -0700 (PDT) Received: from localhost ([::1]:47152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjl54-0003TN-Sq for importer@patchew.org; Fri, 12 Jun 2020 10:54:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49770) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl1v-00061O-NX for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:39 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:32849 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl1u-0001Ox-4B for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:39 -0400 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-139-RTP9jgd4MaSBaAgGJ5f84w-1; Fri, 12 Jun 2020 10:51:33 -0400 Received: by mail-wm1-f70.google.com with SMTP id c4so2548715wmd.0 for ; Fri, 12 Jun 2020 07:51:33 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id 5sm14505674wrr.5.2020.06.12.07.51.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973497; 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=LZsBbdZ3FM++Eh4KOihw4hI5M2LDwhoU63KzZvHgyWU=; b=D5UOCnd5KDF5UFYQcOf9a0JxrRa3+TF4vRAwL/U2QxhezZdMNeEQfsZfA4Tj+1JiveLLxg p/2UqpK3Mf3a31Rrc2S+b8zL7UN3vEgayE/vxR0hcqcPk4ddDaKJcQTX87ZpDDxHq8uTIe AUAkxYwa33DTWZGUSF8RHKrfz8WgQ+E= X-MC-Unique: RTP9jgd4MaSBaAgGJ5f84w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=LZsBbdZ3FM++Eh4KOihw4hI5M2LDwhoU63KzZvHgyWU=; b=Ahs+1lncXupVYb4g2IQd8LfQKByYQeV8JNSsvPu/9OpozCuCJsWCkKAjcXEjJxCw3d 4h0VwLs7d1eiVEWtnCuBE95jUci4Q8akTnXEiq1bo2qsxXHd35VnGmWc49ox3GfUl4un uh7WP59mnOMwXzJODbdeviAbWOo9H+m/mWKQ3oDnGMxwnzjb6jfkqA4Sk/TKo/UnM4n5 GmNaeiTlrAXowoINhslPT1nZgWImlmQdeJ+26diYBJ8JBXSTsPaaYLMtOtw3JL3mjDJJ sr33iXZ40U/aX53Zd4TbblDu43dqHK/OnoRqBnzw2GOAA6bmKj+IzUmz5Yv7JVHPW1h5 oaLA== X-Gm-Message-State: AOAM53392tMh5d0p7K3j/bSTz6IkBmvMs67zTZF4kJep5ZrK3sJOz+0V nuMZSRnFe4B9GGxiq/i61M9mGw0cqKMPz3BxmcS+g03oFCfVrJtjmvR1SRbU3d2DvMzF/ijyjaN 6kPpvlGvmZaJCYCE= X-Received: by 2002:a5d:69cb:: with SMTP id s11mr15425455wrw.91.1591973492609; Fri, 12 Jun 2020 07:51:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhpm394v3qWQw4mdSZH0or5bYqEM71sOnl57tqiKvKkSzAP209Eca/wNAzDdljcLABG6TH9A== X-Received: by 2002:a5d:69cb:: with SMTP id s11mr15425433wrw.91.1591973492392; Fri, 12 Jun 2020 07:51:32 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:30 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 13/58] acpi: tpm: Do not build TCPA table for TPM 2 Message-ID: <20200612141917.9446-14-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:17 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Eric Auger , Paolo Bonzini , Igor Mammedov , Richard Henderson , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Stefan Berger Do not build a TCPA table for TPM 2 anymore but create the log area when building the TPM2 table. The TCPA table is only needed for TPM 1.2. Signed-off-by: Stefan Berger Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Eric Auger Reviewed-by: Igor Mammedov Signed-off-by: Michael S. Tsirkin Reviewed-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 58fe505fb6..d05d010f77 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2216,6 +2216,10 @@ build_tpm2(GArray *table_data, BIOSLinker *linker, G= Array *tcpalog) tpm2_ptr->log_area_minimum_length =3D cpu_to_le32(TPM_LOG_AREA_MINIMUM_SIZE); =20 + acpi_data_push(tcpalog, le32_to_cpu(tpm2_ptr->log_area_minimum_length)= ); + bios_linker_loader_alloc(linker, ACPI_BUILD_TPMLOG_FILE, tcpalog, 1, + false); + /* log area start address to be filled by Guest linker */ bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE, log_addr_offset, log_addr_size, @@ -2752,10 +2756,10 @@ void acpi_build(AcpiBuildTables *tables, MachineSta= te *machine) build_hpet(tables_blob, tables->linker); } if (misc.tpm_version !=3D TPM_VERSION_UNSPEC) { - acpi_add_table(table_offsets, tables_blob); - build_tpm_tcpa(tables_blob, tables->linker, tables->tcpalog); - - if (misc.tpm_version =3D=3D TPM_VERSION_2_0) { + if (misc.tpm_version =3D=3D TPM_VERSION_1_2) { + acpi_add_table(table_offsets, tables_blob); + build_tpm_tcpa(tables_blob, tables->linker, tables->tcpalog); + } else { /* TPM_VERSION_2_0 */ acpi_add_table(table_offsets, tables_blob); build_tpm2(tables_blob, tables->linker, tables->tcpalog); } --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591975112; cv=none; d=zohomail.com; s=zohoarc; b=S0LoptbxwDvoqMjRZw3OaYuzqBwq16+GqUejra5GhxQF9JxFxu0CguiJrJroG++zMUhA3NcFjUGuYtzxYss81ZCuQP0F7q1MNn1VAgM+HFuM1DUH5Ysa01CB0T8MChHTvWF3XnSBv1F2pwevVX3GqBzEEFn25OpHGLS+TKH8QUA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591975112; h=Content-Type: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=wz4LYmJYkwD0FRusftg9gxDl1X3bD+K8dONSs5X0hnA=; b=d38l+dxI8VzmpHDCi4Fb2TjZc0kzS8prjSPPUaCIpninIr1wagTQRN9sHfnslx7UzJleY/zABoiSgKAOGRHpSuMcX4pdvhdFQaeg+qo1Bs3CMZl+ZDD9aTohK/7bK//Ezp2X34mHrRbI1MfCW1r5gFCkwI7ltrl0OzYcLMHUd+w= 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 1591975112140195.42358365189625; Fri, 12 Jun 2020 08:18:32 -0700 (PDT) Received: from localhost ([::1]:52624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlRu-00059L-RH for importer@patchew.org; Fri, 12 Jun 2020 11:18:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51666) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl5M-0004mJ-5o for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:55:12 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:26887 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl5K-00024e-7t for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:55:11 -0400 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-151-gSN03lqiOw-5IBA1fUHXyg-1; Fri, 12 Jun 2020 10:51:36 -0400 Received: by mail-wr1-f69.google.com with SMTP id t5so3974008wro.20 for ; Fri, 12 Jun 2020 07:51:36 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id s72sm8916007wme.35.2020.06.12.07.51.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973709; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wz4LYmJYkwD0FRusftg9gxDl1X3bD+K8dONSs5X0hnA=; b=jFzDa4h44CmSMJlaEX1daVQPaI2ZSsFwrKYS4kptmvFvVil5pG1M4mcu20phZIitnVcQwH 5rSZIWBQ53fGeBh0Nff3+x7Gf7EnXmCUEvJny4JuAXT1f+aX/nIrN2Sw8rGBoV1q/O/lj4 OvY/KVxzrdvd1booNpF1l4rP5ALd7tg= X-MC-Unique: gSN03lqiOw-5IBA1fUHXyg-1 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=wz4LYmJYkwD0FRusftg9gxDl1X3bD+K8dONSs5X0hnA=; b=aaPAOvQarcSlAcz+Sk59rjMSK1db6L+QJuD3HZw0m4aopWvhRpH1PkQ+QrszsFh0C0 F0BJ6k4VsZjnSzmKgnMVSmEdtP3015ica8uPirgO6PSkmRlu62RW56q+tJYlBEuSyIzV SNBBNjiO5Pz68U73qCJYsAwBSive8mQRKXkU5MS4GURcrbP/iogg3VJOdYx5Xj0696u0 ai1b2iy8eFg9YLV1nnM/CIvd8uvCdZAyts5y3psRgENNjBZK/w873Nq7OTlHrDc/DqOe b5EtfVKPv1gMsMKrk7wpdUw34pALOxGqAKJc5ZlsMnhvJsfXPshO2MPRRipTqPa3PA/y OCVw== X-Gm-Message-State: AOAM532rkCJPUCMZcKzNdU6xVkgupoMnXz6AYHHWTO2cqVfd2gJgOOor 3CiouJe+RKMB6TJ+IPoG4QJ5zKe/O2JHLWAb27yiHsFLYxMqzkVcze44tsfOCBlOgdM1SvCWJZ1 iWKd3ak6KFnsOMFg= X-Received: by 2002:adf:dec5:: with SMTP id i5mr16213545wrn.16.1591973495028; Fri, 12 Jun 2020 07:51:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrq48yz7GKmE8biEtjLjKte04AD/V185NMosqi+HXXu1HIpVy8uQ1w6+MVMJsd+zzNXqKLTA== X-Received: by 2002:adf:dec5:: with SMTP id i5mr16213512wrn.16.1591973494718; Fri, 12 Jun 2020 07:51:34 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:32 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 14/58] acpi: Convert build_tpm2() to build_append* API Message-ID: <20200612141917.9446-15-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 09:30:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , Eric Auger , 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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric Auger In preparation of its move to the generic acpi code, let's convert build_tpm2() to use build_append API. This latter now is prefered in place of direct ACPI struct field settings with manual endianness conversion. Signed-off-by: Eric Auger Message-Id: <20200601095737.32671-2-eric.auger@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index d05d010f77..8d93a2d339 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2197,30 +2197,40 @@ build_tpm_tcpa(GArray *table_data, BIOSLinker *link= er, GArray *tcpalog) static void build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog) { - Acpi20TPM2 *tpm2_ptr =3D acpi_data_push(table_data, sizeof *tpm2_ptr); + Acpi20TPM2 *tpm2_ptr =3D acpi_data_push(table_data, sizeof(AcpiTableHe= ader)); unsigned log_addr_size =3D sizeof(tpm2_ptr->log_area_start_address); unsigned log_addr_offset =3D (char *)&tpm2_ptr->log_area_start_address - table_data->data; + uint8_t start_method_params[12] =3D {}; =20 - tpm2_ptr->platform_class =3D cpu_to_le16(TPM2_ACPI_CLASS_CLIENT); + /* platform class */ + build_append_int_noprefix(table_data, TPM2_ACPI_CLASS_CLIENT, 2); + /* reserved */ + build_append_int_noprefix(table_data, 0, 2); if (TPM_IS_TIS_ISA(tpm_find())) { - tpm2_ptr->control_area_address =3D cpu_to_le64(0); - tpm2_ptr->start_method =3D cpu_to_le32(TPM2_START_METHOD_MMIO); + /* address of control area */ + build_append_int_noprefix(table_data, 0, 8); + /* start method */ + build_append_int_noprefix(table_data, TPM2_START_METHOD_MMIO, 4); } else if (TPM_IS_CRB(tpm_find())) { - tpm2_ptr->control_area_address =3D cpu_to_le64(TPM_CRB_ADDR_CTRL); - tpm2_ptr->start_method =3D cpu_to_le32(TPM2_START_METHOD_CRB); + build_append_int_noprefix(table_data, TPM_CRB_ADDR_CTRL, 8); + build_append_int_noprefix(table_data, TPM2_START_METHOD_CRB, 4); } else { g_warn_if_reached(); } =20 - tpm2_ptr->log_area_minimum_length =3D - cpu_to_le32(TPM_LOG_AREA_MINIMUM_SIZE); + /* platform specific parameters */ + g_array_append_vals(table_data, &start_method_params, 12); =20 - acpi_data_push(tcpalog, le32_to_cpu(tpm2_ptr->log_area_minimum_length)= ); + /* log area minimum length */ + build_append_int_noprefix(table_data, TPM_LOG_AREA_MINIMUM_SIZE, 4); + + acpi_data_push(tcpalog, TPM_LOG_AREA_MINIMUM_SIZE); bios_linker_loader_alloc(linker, ACPI_BUILD_TPMLOG_FILE, tcpalog, 1, false); =20 /* log area start address to be filled by Guest linker */ + build_append_int_noprefix(table_data, 0, 8); bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE, log_addr_offset, log_addr_size, ACPI_BUILD_TPMLOG_FILE, 0); --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974103; cv=none; d=zohomail.com; s=zohoarc; b=IJ5WPMJ9+1uBccgv0E3F4aHgfr+t/mp9T3RZGcRSl4IDLE+LfKoamtXvu/cMJU0xuCo1mLRj/bFiqrvFKcXHD/Eq13U2RYVge9xuI+JQFfjzV8p4odWj9OtjCygCCOTHIaoAKvg8ae1xAxUyLw2RIwSxJ7iTTIT07IenYJYDM8c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974103; h=Content-Type: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=0ulyJw62AwRxsch849W7FmGdBygZ/68I8k1w2QUFSjE=; b=AK6+SOkjCHQFIkhQUMOtFm/himuaqssEY47e9RsKbt18YtSYDhvzFPm7cKddqn009X3Xsv57dPhsQ8QLm5wCM++sZWAw3rJIr8BcLxiOtF/MT3KWxkC2f/tyExBgokvCvyqVKzrxfnKbPR3kixA61XM2CFbFC5J/eu5W653GlXk= 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 1591974103113557.0464250684931; Fri, 12 Jun 2020 08:01:43 -0700 (PDT) Received: from localhost ([::1]:43138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlBd-0006Tv-Pg for importer@patchew.org; Fri, 12 Jun 2020 11:01:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49828) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl1z-0006AH-CP for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:43 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:27002 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl1x-0001PK-Iy for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:43 -0400 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-456-P2qesqbcMXiDGN_hLhMHqQ-1; Fri, 12 Jun 2020 10:51:38 -0400 Received: by mail-wm1-f71.google.com with SMTP id k185so2032801wme.8 for ; Fri, 12 Jun 2020 07:51:38 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id j5sm10806252wrm.57.2020.06.12.07.51.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973500; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0ulyJw62AwRxsch849W7FmGdBygZ/68I8k1w2QUFSjE=; b=M3FRfJJ5qvJWEJ3jcmLHRX0wwUKF4NArovtrZJonKBm4RQ57iBeh0J1g5RPrIUTwa7Bu8Z Qa0ooKYKfXXO9oohle3UUgc4RqQi8eSpU4acvNROeqG9q2ZrkreIeGQP3rg7HnEGfQ4Vgp SYBjECFfg4qJ3A24S+SYFr0VdJuSs4I= X-MC-Unique: P2qesqbcMXiDGN_hLhMHqQ-1 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=0ulyJw62AwRxsch849W7FmGdBygZ/68I8k1w2QUFSjE=; b=nZeIEV7Q6x9cMPoqYe3utRxmaUO9OH9iso9HNFJQJD8E/vEQ7DKKiHARZPhCRUtiTr Zw/MWFkTbQrxxMBLdHnBFnA1hcOMSct8oyiLBkTWKV+KD9D07tS6gekDvN4UO8t2Xv50 vsuYtRxaP7RtB8brzd1K/DHtHZLq05fzANyaEX6ZjAThywJbDby3qk/oIcdgaSHiw7vK 6+/Ejd+gYoSzRIkXljIUJg/UpR8/444TFTfvlvVPlB+/bCNwAzJglvZiZXG2GgcRahko HCsdoATunGLaCeq1w+9ecz9mVADdByxmDvUWTb5yYLRaSuOPiolxNxxYb13VWS5eb6Je cFsg== X-Gm-Message-State: AOAM532QWWragMqz3PeI+ss19hR+dlrA+q/2brH75T4nJGtXQO7pprpX +DMUDzW5+pA+Rlj7EW2+ZOXUJXRgErV/dhjde+fd87aVIzCjhW6Nf0DN8R48vKsddjxOIP0+8T2 Etnw6p2GfljKykRA= X-Received: by 2002:a7b:c249:: with SMTP id b9mr12879258wmj.143.1591973497171; Fri, 12 Jun 2020 07:51:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4wVUFmwddd7D6Rd3u1AM2TgAl6djaNmKqlO3avddnj0DCrRcehX2zUu1BN6Sn+fV2qYfJOg== X-Received: by 2002:a7b:c249:: with SMTP id b9mr12879242wmj.143.1591973496975; Fri, 12 Jun 2020 07:51:36 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:35 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 15/58] acpi: Move build_tpm2() in the generic part Message-ID: <20200612141917.9446-16-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:00:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , Eric Auger , 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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric Auger We plan to build the TPM2 table on ARM too. In order to reuse the generation code, let's move build_tpm2() to aml-build.c. No change in the implementation. Signed-off-by: Eric Auger Message-Id: <20200601095737.32671-3-eric.auger@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/aml-build.h | 2 ++ hw/acpi/aml-build.c | 44 +++++++++++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 44 ------------------------------------- 3 files changed, 46 insertions(+), 44 deletions(-) diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index ed7c89309e..d27da03d64 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -437,4 +437,6 @@ void build_slit(GArray *table_data, BIOSLinker *linker,= MachineState *ms); =20 void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f, const char *oem_id, const char *oem_table_id); + +void build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog); #endif diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 3681ec6e3d..b37052c1b4 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -26,6 +26,7 @@ #include "qemu/bitops.h" #include "sysemu/numa.h" #include "hw/boards.h" +#include "hw/acpi/tpm.h" =20 static GArray *build_alloc_array(void) { @@ -1877,6 +1878,49 @@ build_hdr: "FACP", tbl->len - fadt_start, f->rev, oem_id, oem_table_= id); } =20 +void build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog) +{ + Acpi20TPM2 *tpm2_ptr =3D acpi_data_push(table_data, sizeof(AcpiTableHe= ader)); + unsigned log_addr_size =3D sizeof(tpm2_ptr->log_area_start_address); + unsigned log_addr_offset =3D + (char *)&tpm2_ptr->log_area_start_address - table_data->data; + uint8_t start_method_params[12] =3D {}; + + /* platform class */ + build_append_int_noprefix(table_data, TPM2_ACPI_CLASS_CLIENT, 2); + /* reserved */ + build_append_int_noprefix(table_data, 0, 2); + if (TPM_IS_TIS_ISA(tpm_find())) { + /* address of control area */ + build_append_int_noprefix(table_data, 0, 8); + /* start method */ + build_append_int_noprefix(table_data, TPM2_START_METHOD_MMIO, 4); + } else if (TPM_IS_CRB(tpm_find())) { + build_append_int_noprefix(table_data, TPM_CRB_ADDR_CTRL, 8); + build_append_int_noprefix(table_data, TPM2_START_METHOD_CRB, 4); + } else { + g_warn_if_reached(); + } + + /* platform specific parameters */ + g_array_append_vals(table_data, &start_method_params, 12); + + /* log area minimum length */ + build_append_int_noprefix(table_data, TPM_LOG_AREA_MINIMUM_SIZE, 4); + + acpi_data_push(tcpalog, TPM_LOG_AREA_MINIMUM_SIZE); + bios_linker_loader_alloc(linker, ACPI_BUILD_TPMLOG_FILE, tcpalog, 1, + false); + + /* log area start address to be filled by Guest linker */ + build_append_int_noprefix(table_data, 0, 8); + bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE, + log_addr_offset, log_addr_size, + ACPI_BUILD_TPMLOG_FILE, 0); + build_header(linker, table_data, + (void *)tpm2_ptr, "TPM2", sizeof(*tpm2_ptr), 4, NULL, NUL= L); +} + /* ACPI 5.0: 6.4.3.8.2 Serial Bus Connection Descriptors */ static Aml *aml_serial_bus_device(uint8_t serial_bus_type, uint8_t flags, uint16_t type_flags, diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 8d93a2d339..1ecb68f45f 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2194,50 +2194,6 @@ build_tpm_tcpa(GArray *table_data, BIOSLinker *linke= r, GArray *tcpalog) (void *)tcpa, "TCPA", sizeof(*tcpa), 2, NULL, NULL); } =20 -static void -build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog) -{ - Acpi20TPM2 *tpm2_ptr =3D acpi_data_push(table_data, sizeof(AcpiTableHe= ader)); - unsigned log_addr_size =3D sizeof(tpm2_ptr->log_area_start_address); - unsigned log_addr_offset =3D - (char *)&tpm2_ptr->log_area_start_address - table_data->data; - uint8_t start_method_params[12] =3D {}; - - /* platform class */ - build_append_int_noprefix(table_data, TPM2_ACPI_CLASS_CLIENT, 2); - /* reserved */ - build_append_int_noprefix(table_data, 0, 2); - if (TPM_IS_TIS_ISA(tpm_find())) { - /* address of control area */ - build_append_int_noprefix(table_data, 0, 8); - /* start method */ - build_append_int_noprefix(table_data, TPM2_START_METHOD_MMIO, 4); - } else if (TPM_IS_CRB(tpm_find())) { - build_append_int_noprefix(table_data, TPM_CRB_ADDR_CTRL, 8); - build_append_int_noprefix(table_data, TPM2_START_METHOD_CRB, 4); - } else { - g_warn_if_reached(); - } - - /* platform specific parameters */ - g_array_append_vals(table_data, &start_method_params, 12); - - /* log area minimum length */ - build_append_int_noprefix(table_data, TPM_LOG_AREA_MINIMUM_SIZE, 4); - - acpi_data_push(tcpalog, TPM_LOG_AREA_MINIMUM_SIZE); - bios_linker_loader_alloc(linker, ACPI_BUILD_TPMLOG_FILE, tcpalog, 1, - false); - - /* log area start address to be filled by Guest linker */ - build_append_int_noprefix(table_data, 0, 8); - bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE, - log_addr_offset, log_addr_size, - ACPI_BUILD_TPMLOG_FILE, 0); - build_header(linker, table_data, - (void *)tpm2_ptr, "TPM2", sizeof(*tpm2_ptr), 4, NULL, NUL= L); -} - #define HOLE_640K_START (640 * KiB) #define HOLE_640K_END (1 * MiB) =20 --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591973810; cv=none; d=zohomail.com; s=zohoarc; b=iNAceN3tNPBcoFvLGEu4J/x1K+W93cW0xhLM322U8x+MePkcRFIcfKKddCOxRO82falQHhyVnXMy6e4E5v+1Cjp+EyT6TThOAl0BijiW6ursYWhhbqS13XzJQ0j06ba+YN/8pCEYZAJXiZ7/8pFlmiVHCsKWhmQ2qhmIR01w7lE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591973810; h=Content-Type: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=zGOoHYc7BnEUE5/Tw0vbz2Gw05a97G6XRUJWvEWyGjA=; b=gGUUi5Sd/r1FElUMVtvBy9Wx/NRUKUoJQFY6/GHNDq3qHhkqmbwd022pGXp2gnp2rhFTBPpFncJL7lmSebl61WgVnhg+Yqb+oH8KT1Qk0XV8KC3YxbWMb+eYuF4QHXAUbmS2pe7xCZ8vSw988Pwb/iIkNUgzeFyvD2lmWySsWKU= 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 159197381067820.595429642679846; Fri, 12 Jun 2020 07:56:50 -0700 (PDT) Received: from localhost ([::1]:55660 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjl6v-0007Zo-Eo for importer@patchew.org; Fri, 12 Jun 2020 10:56:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49876) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl22-0006Er-Ar for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:46 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:59103 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl1z-0001PX-Ga for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:45 -0400 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-8-hm62ABFKNDOEeEtNpnHoOA-1; Fri, 12 Jun 2020 10:51:40 -0400 Received: by mail-wr1-f71.google.com with SMTP id r5so4002236wrt.9 for ; Fri, 12 Jun 2020 07:51:40 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id y37sm11339873wrd.55.2020.06.12.07.51.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973502; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zGOoHYc7BnEUE5/Tw0vbz2Gw05a97G6XRUJWvEWyGjA=; b=BVrGgP9KPFaPBV/tSHHr+jE7nLX1k3ymHzRriBrIjR2ETM5ICJQGXQKO5aYjEQQfgaPl0K +PZZEfRBr1eXUpHMdoD1iu+Jc1vOevp2Zi9D7zlgM2z0z6EmApCeOnZe8/INRtYZF6ni+p Vx8+6Z1oCyd1Be4f3DBmko/Avb1zljQ= X-MC-Unique: hm62ABFKNDOEeEtNpnHoOA-1 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=zGOoHYc7BnEUE5/Tw0vbz2Gw05a97G6XRUJWvEWyGjA=; b=qZKvsNleKPXXC4D1dAziC+h56+Onq5O2pv51KQxi+mw6z03nnMjrNWoNVsBVYxKb0r HoW1pnE0g5v5tEYvNNfEvpTTD01JsUI7zi1lBGUyim/QM5nmI6kT+Wyrdxo32I0Yx6Wr 65WuKZqCjGeab6Y7JpaGe20Z/bLNMnNv9x3ujR20Pjg0sytGw3LyLa0gyCKJVFrnfBdE OL+liJ0IP9dDQLkKhdVYkxdVpHwrcXSNfrzPaSWSnC6jsshOgHTffwb28F1G8CIAw8s1 l/DonX7rbg4QMzB/aCS8NxRNGgEuEGK2aOTdmmv8eRO0wo/TZidHXBJTZthyhYpP2HUJ +Ejg== X-Gm-Message-State: AOAM531Cem4kVZImjtiTD4AyUgXGnIhJ6Ifbk797yFWvKbfTBhKZyORb NC7/HgiedXfzJITDUlTNHSTpWW3nAb3hjBHhpIPxrB1/A68jWs74UhQ/Wo8aPFx45DW3WokAwwG QGu3+dAeTbPhPdVs= X-Received: by 2002:a1c:7903:: with SMTP id l3mr13483925wme.50.1591973499328; Fri, 12 Jun 2020 07:51:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyR4D2VtuT67U58RnzCGHC3lbDYP+TWdHWYomPasF6q6FgznRdyNmRy7Qs1NVFk1eh3mF6kBQ== X-Received: by 2002:a1c:7903:: with SMTP id l3mr13483903wme.50.1591973499160; Fri, 12 Jun 2020 07:51:39 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:37 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 16/58] arm/acpi: TPM2 ACPI table support Message-ID: <20200612141917.9446-17-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:00:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eric Auger , Shannon Zhao , qemu-arm@nongnu.org, Igor Mammedov , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric Auger Add a TPM2 ACPI table if a TPM2.0 sysbus device has been dynamically instantiated. Signed-off-by: Eric Auger Message-Id: <20200601095737.32671-4-eric.auger@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/sysemu/tpm.h | 2 ++ hw/acpi/aml-build.c | 5 +++-- hw/arm/virt-acpi-build.c | 7 +++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/sysemu/tpm.h b/include/sysemu/tpm.h index f37851b1aa..03fb25941c 100644 --- a/include/sysemu/tpm.h +++ b/include/sysemu/tpm.h @@ -50,6 +50,8 @@ typedef struct TPMIfClass { =20 #define TPM_IS_TIS_ISA(chr) \ object_dynamic_cast(OBJECT(chr), TYPE_TPM_TIS_ISA) +#define TPM_IS_TIS_SYSBUS(chr) \ + object_dynamic_cast(OBJECT(chr), TYPE_TPM_TIS_SYSBUS) #define TPM_IS_CRB(chr) \ object_dynamic_cast(OBJECT(chr), TYPE_TPM_CRB) #define TPM_IS_SPAPR(chr) \ diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index b37052c1b4..d24e9e6c3a 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1885,17 +1885,18 @@ void build_tpm2(GArray *table_data, BIOSLinker *lin= ker, GArray *tcpalog) unsigned log_addr_offset =3D (char *)&tpm2_ptr->log_area_start_address - table_data->data; uint8_t start_method_params[12] =3D {}; + TPMIf *tpmif =3D tpm_find(); =20 /* platform class */ build_append_int_noprefix(table_data, TPM2_ACPI_CLASS_CLIENT, 2); /* reserved */ build_append_int_noprefix(table_data, 0, 2); - if (TPM_IS_TIS_ISA(tpm_find())) { + if (TPM_IS_TIS_ISA(tpmif) || TPM_IS_TIS_SYSBUS(tpmif)) { /* address of control area */ build_append_int_noprefix(table_data, 0, 8); /* start method */ build_append_int_noprefix(table_data, TPM2_START_METHOD_MMIO, 4); - } else if (TPM_IS_CRB(tpm_find())) { + } else if (TPM_IS_CRB(tpmif)) { build_append_int_noprefix(table_data, TPM_CRB_ADDR_CTRL, 8); build_append_int_noprefix(table_data, TPM2_START_METHOD_CRB, 4); } else { diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 2cbccd5fe2..ca31f70f7f 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -41,12 +41,14 @@ #include "hw/acpi/pci.h" #include "hw/acpi/memory_hotplug.h" #include "hw/acpi/generic_event_device.h" +#include "hw/acpi/tpm.h" #include "hw/pci/pcie_host.h" #include "hw/pci/pci.h" #include "hw/arm/virt.h" #include "hw/mem/nvdimm.h" #include "sysemu/numa.h" #include "sysemu/reset.h" +#include "sysemu/tpm.h" #include "kvm_arm.h" #include "migration/vmstate.h" #include "hw/acpi/ghes.h" @@ -848,6 +850,11 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildT= ables *tables) build_iort(tables_blob, tables->linker, vms); } =20 + if (tpm_get_version(tpm_find()) =3D=3D TPM_VERSION_2_0) { + acpi_add_table(table_offsets, tables_blob); + build_tpm2(tables_blob, tables->linker, tables->tcpalog); + } + /* XSDT is pointed to by RSDP */ xsdt =3D tables_blob->len; build_xsdt(tables_blob, tables->linker, table_offsets, NULL, NULL); --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591975426; cv=none; d=zohomail.com; s=zohoarc; b=I9wG2+co+E4APwl2JbiU4mkSheQmhEyAPjJoE31zPHJO0DWKIvXHEDp9icbzhiaObFhgdUrrJhROEWMZ6cB+1x3LeZVn562WC3Sw+cNfCo792j8OUvAfle4Q7Z7PjhsmDSsUVdDCVZkrl7BDEog//3/NKmYfE8bsDAu5gNPiF8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591975426; h=Content-Type: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=m70XDKVx5FpSNAmS9FGjLCI+V05BcMupEqmlBSYDPOk=; b=XK9cHi74z+m9E7Gxte93EZtAa4iDc9ERfO4NJjvNTfQbVZNc68mKN+uK8223J94QdUNlCoGf1bSnUGkGMPkSBZnGRgOZ1oA/ETd4WXMotb8CFnvpzYpyitOmCXAHkV3VMIEQ2zdBwQ4APURg2K8HbC/XrBQAo3rgurwhHTGr/Ps= 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 1591975426546435.33273512314474; Fri, 12 Jun 2020 08:23:46 -0700 (PDT) Received: from localhost ([::1]:48200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlWz-0006fQ-Bc for importer@patchew.org; Fri, 12 Jun 2020 11:23:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl5Q-0004vp-DA for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:55:16 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:60541 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl5O-00028k-NL for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:55:16 -0400 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-227-Vtqtt5jeNAqx1Z82JIupxQ-1; Fri, 12 Jun 2020 10:51:42 -0400 Received: by mail-wm1-f71.google.com with SMTP id t145so2545589wmt.2 for ; Fri, 12 Jun 2020 07:51:42 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id g187sm9833498wma.17.2020.06.12.07.51.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973714; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=m70XDKVx5FpSNAmS9FGjLCI+V05BcMupEqmlBSYDPOk=; b=NDCepfP0ROoV/mXfUeJQC7HVb7wya67D4bYZqLU2WmZK8uXd080R9vKz8o1UFoSl0zCcW2 E49JGXw1goyEnwN2pFnG3XcPrDUfw/vv49XFOSyZawQ8YTvSnMrgUNd+2g7E563NyzrF7U ZCsIthSzPryS40ykBjffqaaM5J0CPVM= X-MC-Unique: Vtqtt5jeNAqx1Z82JIupxQ-1 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=m70XDKVx5FpSNAmS9FGjLCI+V05BcMupEqmlBSYDPOk=; b=Nk5tBCrAS4Jckq2UoQ2dreUyZhwvw8oicqtXK0DIyM1FeXVs00Wpm2OVE1f3nvJXgv WUXygn0Rav4qkJUd4lHlF2sKoBzRtLLMgF6YbMRtcClj0eyV8Bj5rup0FZcneUZOazUR V6+3y/ofoZ1mR8pD6vyd6yza7K7sjFBQIq/xUt/cFN35Z+uPYXDqsyIqUo0gZVUu6If9 4fdB+ExI3T6DaqgtMeFAI+5u78Tohs/mZnIsGGnjxBrtOrFUaGfLYK8glZ8SMVDF3nqV mZJ8sQosz2qY4RFPGb/yVuS3v1eJT3mA/xiW6VdhYwNVx5ik5vJQqMB2BvtqvNVrr0G7 sv7w== X-Gm-Message-State: AOAM5323A3oejSvoKqZWc2I4RJr9AMeeNIDKh43xHP9DYI4TWCZnzyb5 hHYW93AGMSQ/8iR23CQJECuOKrPJ4hwyWlHf07OmjkzHR9WCeVsoGY2/o8rix6ebVQG+jeF2OSO hBh6bm0IbGw9I3Ko= X-Received: by 2002:a5d:4490:: with SMTP id j16mr16683019wrq.276.1591973501698; Fri, 12 Jun 2020 07:51:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx231ZEhbrTsyz0l2P+lW3nSQj/sZnaC/ZBlLB/1jvAXnpEnzsMOpmRrYAMXbDKg1z7QngRtw== X-Received: by 2002:a5d:4490:: with SMTP id j16mr16682996wrq.276.1591973501496; Fri, 12 Jun 2020 07:51:41 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:39 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 17/58] test/tpm-emu: include sockets and channel headers in tpm-emu header Message-ID: <20200612141917.9446-18-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Eric Auger , Paolo Bonzini , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric Auger Include sockets and channel headers to that the header is self-contained. Signed-off-by: Eric Auger Reviewed-by: Stefan Berger Message-Id: <20200609125409.24179-2-eric.auger@redhat.com> --- tests/qtest/tpm-emu.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/qtest/tpm-emu.h b/tests/qtest/tpm-emu.h index a4f1d64226..73f3bed0c4 100644 --- a/tests/qtest/tpm-emu.h +++ b/tests/qtest/tpm-emu.h @@ -16,6 +16,9 @@ #define TPM_RC_FAILURE 0x101 #define TPM2_ST_NO_SESSIONS 0x8001 =20 +#include "qemu/sockets.h" +#include "io/channel.h" + struct tpm_hdr { uint16_t tag; uint32_t len; --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591975298; cv=none; d=zohomail.com; s=zohoarc; b=WPugire1uxPnEjC97kUqvP2BdTEX4XcjireHC1c9xGk+HwCGhuDSL5KJsiqoc+XdQ9g7nFSYcHwso58s7AEkcp/XObKGjXGYk2cxfBtq3WL5nJscEOUJlIJtwTQAvRDJNOt640RBTY7+qrERbJjccY0td/EMkI0FFoe7zkQhz5I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591975298; h=Content-Type: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=/K+BMGp/Z1Mf6jaoeVGFnEXmqbuskYzi+ydMa9DJuV0=; b=bdhFc+E6wJWnYK4OmF9VcfP6YmMbnIz76soOrH9XdqTrtFkgaBVN0MjwaUVX56HnXpB+7w+2LaODsp4NCcuPKsAvVUeS4DD2mrrzPg85qWvtAPmvsglJe70sINxsg6BOf7Yj5CLvkXSJPKvQPwGthK/z0i3ND9QeJeU+HM9k3uI= 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 1591975298377685.6971718088056; Fri, 12 Jun 2020 08:21:38 -0700 (PDT) Received: from localhost ([::1]:40526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlUv-0003RF-2x for importer@patchew.org; Fri, 12 Jun 2020 11:21:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51622) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl5I-0004eQ-Mr for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:55:08 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:23394 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl5D-00020w-Fx for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:55:08 -0400 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-423-ZFTMeIxGNTSWS03sAW8ftA-1; Fri, 12 Jun 2020 10:51:45 -0400 Received: by mail-wm1-f69.google.com with SMTP id j128so2546124wmj.6 for ; Fri, 12 Jun 2020 07:51:44 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id b201sm9004424wmb.36.2020.06.12.07.51.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973702; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/K+BMGp/Z1Mf6jaoeVGFnEXmqbuskYzi+ydMa9DJuV0=; b=P3m1zRuqsX3CMTZpWRu8biragqinceCzNWZKJF0EFXmFN2zlTAAO8ZVvRUY7T0d+9o1mG2 wFer3e4zr0yW0MJOdCOX830tJOKiS6c89+Uaq+ogqbKZbJxFvol757e8/0D3/rpDAEiHlL r58SFMr2wO2S3Zitwe9DfHqtNW8swQs= X-MC-Unique: ZFTMeIxGNTSWS03sAW8ftA-1 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=/K+BMGp/Z1Mf6jaoeVGFnEXmqbuskYzi+ydMa9DJuV0=; b=tu5JFRgnX2Ds0CZbLIMitI+hXoiBVgaCMYBKKg0JZ/nYetGaV4CpnoGmOfz6r2Lhnv aayrmA0GeMCQfDtkNt6See/WZA61sX0lmP8YKpNyoiN4y1m9puTqhaxu66wQezRGkdXa /m8xjPZoR+KpbQa7ICDOHZBTq0I6xvdAQrScugGvSdagAzEjvO71EFAwvnnbAHGkVhjJ Hy3+vZHgfxIxTN/YOEOGYU4CqjKRUSVyyMDC7TszdJeORueQOpYRK5sR94pssIAY1cSs XIdRJtlxhPUIXVi0o+ILKkmqezuQqjtOm0ntnDS7tszf4Oh/0HlDOEbH95Z5UhMsDEvW Vz0A== X-Gm-Message-State: AOAM532F0UCHdeGN2avefJccuQ21tBlilexz2HI9FEBwWHvQu4XBVPMY a8Gicy7r8ekpx4xI8gAxPu7R/Lh7IQEBZIkugn7j88eKPcHH+c4V3wNxoM1DrXLKybhHpImbjJm VhP3yDf/kpWKujrE= X-Received: by 2002:a5d:52c6:: with SMTP id r6mr15035364wrv.74.1591973503830; Fri, 12 Jun 2020 07:51:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7pp74lkH56Ds7sode03UAtMq11m8YKrtc5MkzNWuHu7qWDgs5qCKoyQ0P7V5jDThZnoiVkA== X-Received: by 2002:a5d:52c6:: with SMTP id r6mr15035345wrv.74.1591973503624; Fri, 12 Jun 2020 07:51:43 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:41 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 18/58] tests/acpi: Add void tables for Q35/TPM-TIS bios-tables-test Message-ID: <20200612141917.9446-19-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Igor Mammedov , Stefan Berger , Eric Auger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric Auger Add placeholders for TPM and DSDT reference tables for Q35 TPM-TIS tests and ignore them for the time being. Signed-off-by: Eric Auger Reviewed-by: Stefan Berger Reviewed-by: Igor Mammedov Message-Id: <20200609125409.24179-3-eric.auger@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 2 ++ tests/data/acpi/q35/DSDT.tis | 0 tests/data/acpi/q35/TPM2.tis | 0 3 files changed, 2 insertions(+) create mode 100644 tests/data/acpi/q35/DSDT.tis create mode 100644 tests/data/acpi/q35/TPM2.tis diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index dfb8523c8b..a2a45d1d31 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,3 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/q35/DSDT.tis", +"tests/data/acpi/q35/TPM2.tis", diff --git a/tests/data/acpi/q35/DSDT.tis b/tests/data/acpi/q35/DSDT.tis new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/q35/TPM2.tis b/tests/data/acpi/q35/TPM2.tis new file mode 100644 index 0000000000..e69de29bb2 --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591973821; cv=none; d=zohomail.com; s=zohoarc; b=b8umdMryzohIekmw8iNnNMgi10E6VyjYkh0YC7x0OaIbR6WOEHRq6rh5V9Mf4Wbv+6pl67P/a6Z4Z/deuE4nJR2rfOHuIe6BWPSbHP4gMUeTqlrrT/XjikJmBI+NPwz3SP64/YtuKlHDUhjkw4eYZ01n6QFtUf//VxGL2qvV8JA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591973821; h=Content-Type: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=i525bms7gqVVwpF2fPgVg2EaF8HaC1eOaVMCjQtCrsc=; b=AiHTUvgeW29zKkgDPQCiBYdpoXsa/fCaDmeXoRLZ+D6ay1sKb8oEMURyg6yK2HMQHiodwXDiBSWza7nmsMIGZGjPoIS75FDvWKLKjbh8lK8is2bhPFHOXTd/PdFarQZMO/z7VjKjudW7efCT7h6rQDbmIqpSZxB8r8cOp7buFsE= 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 1591973821846272.19735798239446; Fri, 12 Jun 2020 07:57:01 -0700 (PDT) Received: from localhost ([::1]:56408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjl76-0007s4-Jf for importer@patchew.org; Fri, 12 Jun 2020 10:57:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl27-0006Sc-TK for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:51 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:29416 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl26-0001QP-9H for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:51 -0400 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-189-zhmBKMwNN-aToIxBO1t0NQ-1; Fri, 12 Jun 2020 10:51:47 -0400 Received: by mail-wm1-f69.google.com with SMTP id 14so2515144wmi.8 for ; Fri, 12 Jun 2020 07:51:47 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id s5sm9019681wme.37.2020.06.12.07.51.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973509; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=i525bms7gqVVwpF2fPgVg2EaF8HaC1eOaVMCjQtCrsc=; b=VRUdgZ/S8+7Rc7+UPBpQFEJOtprDM25goi3eRRwbu2sw0Qc6lMHkweJ8QU+eELmsVyXakY AH8N4HL+bQ4k+RF7tnahfeK7Akk4LPh184l0Ujm4RnWgZulMmHf2M7OCdI6LuztNOJJI3j a9kJh+zF2g7AiEchUUvdlwYxXIkzxK4= X-MC-Unique: zhmBKMwNN-aToIxBO1t0NQ-1 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=i525bms7gqVVwpF2fPgVg2EaF8HaC1eOaVMCjQtCrsc=; b=JkJ/6a9E+x50SUWLr/x+1IW26lfAfoRZ6IRbUeQ6THY4+yoEcAiLxQAriURhYHw2KL O0XryidKGhoIWg/VtszcqOfdFn3TNA4UXa9mY0sE4ywqIbNu3FVm1JaVoevNvOMD2W+p BjVAUQb0/biXycONsyMsZSmeeSvvw3Mxnnh4dEfXsNxQyK/WL/bk6YKCeTty2e14QivH ML8DyoMRHDxb5ZJLj0lSGnNj6+gqmDVBv0xxGFMOBCrbwljvADKK9KUGYHVzR8SOKL2g F9sSjw437SbJK7gzvRLrPrWVJe96iGrNj0kqiYvYf0F8W5gnjFf8axIU3wBmNegVy13s UQXQ== X-Gm-Message-State: AOAM532+fFYqOxnhpyyrxqqRdEtf5bjOeLfH+2kkfbnUQbf19x3l/UhD sGOxvWUn0q8edBFfn0R+wsdmT9KZ2M5i2d4fH+um+AZJbbFpKeFCxlOnhNxDmQbSbgJjub6IOYL QWjs7XxnGUJBQVRc= X-Received: by 2002:adf:f30d:: with SMTP id i13mr14579521wro.146.1591973506546; Fri, 12 Jun 2020 07:51:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDFmlycbv7zP4AvmREggXcVcaIbtb3vGSvUl1amEK1TwlPCLglGdLKXIRdAKy/x7dnr0ggYg== X-Received: by 2002:adf:f30d:: with SMTP id i13mr14579509wro.146.1591973506376; Fri, 12 Jun 2020 07:51:46 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:44 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 19/58] tests: tpm-emu: Remove assert on TPM2_ST_NO_SESSIONS Message-ID: <20200612141917.9446-20-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Eric Auger , Paolo Bonzini , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric Auger bios-tables-test executes SeaBIOS. Indeed FW is needed to fetch tables from QEMU and put them into the guest RAM. Also the FW patches cross table pointers. At some point, SeaBIOS ends up calling the TPM2_CC_HierarchyControl command with TPM2_ST_SESSIONS tag, most probably steming from tpm_set_failure/tpm20_hierarchycontrol SeaBIOS call path. This causes an assert() in the qtest tpm emulation code. As the goal here is not to boot SeaBIOS completely but just let it grab the ACPI tables and consolidate them, let's just remove the assert(). Signed-off-by: Eric Auger Message-Id: <20200609125409.24179-4-eric.auger@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/tpm-emu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/qtest/tpm-emu.c b/tests/qtest/tpm-emu.c index c43ac4aef8..298d0eec74 100644 --- a/tests/qtest/tpm-emu.c +++ b/tests/qtest/tpm-emu.c @@ -49,7 +49,6 @@ static void *tpm_emu_tpm_thread(void *data) s->tpm_msg->tag =3D be16_to_cpu(s->tpm_msg->tag); s->tpm_msg->len =3D be32_to_cpu(s->tpm_msg->len); g_assert_cmpint(s->tpm_msg->len, >=3D, minhlen); - g_assert_cmpint(s->tpm_msg->tag, =3D=3D, TPM2_ST_NO_SESSIONS); =20 s->tpm_msg =3D g_realloc(s->tpm_msg, s->tpm_msg->len); qio_channel_read(ioc, (char *)&s->tpm_msg->code, --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974143; cv=none; d=zohomail.com; s=zohoarc; b=XbHWMOxhdBDhmQjMOJRKpfZcRN3G3pcSUlOTo2xbJguTcxiLJeWYd5RkO82PBQ+CJDKnWD9Md2/WbmhH0qA4xA8GXBN4VojG4C9XxUxTpXOd59A0XwbbSSJ6H9zf8nOChPfeiUgry34PA48rCZ+D4GEVhQoHZVRLs/KaQH1yiVM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974143; h=Content-Type: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=+G0ztL5ZOa2ltkVXVEVXOCaX0sVGPo+GC+RC0/cszug=; b=GJ3WGUfuU1jcbg1CVKpjOlTyENpxt5F6vKXhOn821ytee3rlEqequAmfJtBlBR9ITJrq2qJZbSlr94Kq7mu+abeNOm5m1kCx0xgyenBiSquAzqV+ORnwakc5FUO/5enkpXAv6yxZ2Jjzm0cKRiAJtBnKJV4vfimXjd+6h9KPDPk= 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 1591974143510269.58758721794175; Fri, 12 Jun 2020 08:02:23 -0700 (PDT) Received: from localhost ([::1]:44624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlCF-00075j-Sl for importer@patchew.org; Fri, 12 Jun 2020 11:02:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl2F-0006h6-B8 for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:59 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:31409 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl2D-0001Rv-Fb for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:59 -0400 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-265-YubPt45WNXS7Tw7jvoeqrA-1; Fri, 12 Jun 2020 10:51:52 -0400 Received: by mail-wr1-f69.google.com with SMTP id o1so3960655wrm.17 for ; Fri, 12 Jun 2020 07:51:52 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id z206sm9557291wmg.30.2020.06.12.07.51.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973514; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+G0ztL5ZOa2ltkVXVEVXOCaX0sVGPo+GC+RC0/cszug=; b=fEv91cuUkqr7K+NTwRlX8Qkz2e3gGTTCISyduoE/phOsjfJquT1CTApuzKxSHs21XLT/xT IbF3s2/xFooO54WCaBxdYxqHG6te5+GgngGeNXm/F85ugjtih7Vw7yYNPbe3MmmC7MSuUu EH1HsoCw8VZBfimI20TduA00gjRN99Y= X-MC-Unique: YubPt45WNXS7Tw7jvoeqrA-1 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=+G0ztL5ZOa2ltkVXVEVXOCaX0sVGPo+GC+RC0/cszug=; b=CCff2eEfwBlwT+mE5K33y690s74gqHWSdVqGgBGjJP720d5cYVjIwn7CBVy6XeLAdL W/PkgaPMDR3X+YX1flHH/uutxeoq5026r7/0BLX/kUffaR7MGf1Yy2cQ0AmLxbH6BpoK krsrJcmyrWMkl3Q1HvTo/HVB949NapHC5sRXPhQAj4Co3iQPHVFmd5s82KVzAz7bnTKx FmVmiz6Bzn5jiynNpTepC0bgnI7W4CZufGZTYwgjFmttvcNYrT/bzldn96Fo2qADpPYJ goIl2igyp4oq9U8fenX31Lvap8qdZg/ATjEJq3QY7T/XlqaFIdFHp8f42XJxR0dPT+kM PE/w== X-Gm-Message-State: AOAM533sVVTdW0Iw48LYOQrSE4QjrKunKGAyhrzldVxpqi/blkJu2EH4 CkGP/VaNj3wvkxA/0DgqQ5pHIlmEtY4H4X76uqejo9cAcyNmOi0s3B+6cFrATM+DwSByPMBFOD0 Cp5MBiYsW1B0cI0A= X-Received: by 2002:a05:6000:90:: with SMTP id m16mr15896951wrx.191.1591973508750; Fri, 12 Jun 2020 07:51:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIMx3ri4Z1ASPPfZghATkqTFJPaLuRgs0Y7/7C32K5//DWFaK0QxJsn+F/tKwbxKq4m6DM8Q== X-Received: by 2002:a05:6000:90:: with SMTP id m16mr15896926wrx.191.1591973508517; Fri, 12 Jun 2020 07:51:48 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:46 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 20/58] bios-tables-test: Add Q35/TPM-TIS test Message-ID: <20200612141917.9446-21-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Eric Auger , Igor Mammedov , 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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric Auger Test tables specific to the TPM-TIS instantiation. The TPM2 is added in the framework. Also the DSDT is updated with the TPM. The new function should be be usable for CRB as well, later one. Signed-off-by: Eric Auger Message-Id: <20200609125409.24179-5-eric.auger@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 58 ++++++++++++++++++++++++++++++++++ tests/qtest/Makefile.include | 1 + 2 files changed, 59 insertions(+) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index c9843829b3..53f104a9c5 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -57,6 +57,9 @@ #include "qemu/bitmap.h" #include "acpi-utils.h" #include "boot-sector.h" +#include "tpm-emu.h" +#include "hw/acpi/tpm.h" + =20 #define MACHINE_PC "pc" #define MACHINE_Q35 "q35" @@ -874,6 +877,60 @@ static void test_acpi_piix4_tcg_numamem(void) free_test_data(&data); } =20 +uint64_t tpm_tis_base_addr; + +static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if, + uint64_t base) +{ + gchar *tmp_dir_name =3D g_strdup_printf("qemu-test_acpi_%s_tcg_%s.XXXX= XX", + machine, tpm_if); + char *tmp_path =3D g_dir_make_tmp(tmp_dir_name, NULL); + TestState test; + test_data data; + GThread *thread; + char *args, *variant =3D g_strdup_printf(".%s", tpm_if); + + tpm_tis_base_addr =3D base; + + module_call_init(MODULE_INIT_QOM); + + test.addr =3D g_new0(SocketAddress, 1); + test.addr->type =3D SOCKET_ADDRESS_TYPE_UNIX; + test.addr->u.q_unix.path =3D g_build_filename(tmp_path, "sock", NULL); + g_mutex_init(&test.data_mutex); + g_cond_init(&test.data_cond); + test.data_cond_signal =3D false; + + thread =3D g_thread_new(NULL, tpm_emu_ctrl_thread, &test); + tpm_emu_test_wait_cond(&test); + + memset(&data, 0, sizeof(data)); + data.machine =3D machine; + data.variant =3D variant; + + args =3D g_strdup_printf( + " -chardev socket,id=3Dchr,path=3D%s" + " -tpmdev emulator,id=3Ddev,chardev=3Dchr" + " -device tpm-%s,tpmdev=3Ddev", + test.addr->u.q_unix.path, tpm_if); + + test_acpi_one(args, &data); + + g_thread_join(thread); + g_unlink(test.addr->u.q_unix.path); + qapi_free_SocketAddress(test.addr); + g_rmdir(tmp_path); + g_free(variant); + g_free(tmp_path); + g_free(tmp_dir_name); + free_test_data(&data); +} + +static void test_acpi_q35_tcg_tpm_tis(void) +{ + test_acpi_tcg_tpm("q35", "tis", 0xFED40000); +} + static void test_acpi_tcg_dimm_pxm(const char *machine) { test_data data; @@ -1037,6 +1094,7 @@ int main(int argc, char *argv[]) return ret; } =20 + qtest_add_func("acpi/q35/tpm-tis", test_acpi_q35_tcg_tpm_tis); qtest_add_func("acpi/piix4", test_acpi_piix4_tcg); qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge); qtest_add_func("acpi/q35", test_acpi_q35_tcg); diff --git a/tests/qtest/Makefile.include b/tests/qtest/Makefile.include index 9e5a51d033..5023fa413d 100644 --- a/tests/qtest/Makefile.include +++ b/tests/qtest/Makefile.include @@ -262,6 +262,7 @@ tests/qtest/hd-geo-test$(EXESUF): tests/qtest/hd-geo-te= st.o $(libqos-obj-y) tests/qtest/boot-order-test$(EXESUF): tests/qtest/boot-order-test.o $(libq= os-obj-y) tests/qtest/boot-serial-test$(EXESUF): tests/qtest/boot-serial-test.o $(li= bqos-obj-y) tests/qtest/bios-tables-test$(EXESUF): tests/qtest/bios-tables-test.o \ + tests/qtest/tpm-emu.o $(test-io-obj-y) \ tests/qtest/boot-sector.o tests/qtest/acpi-utils.o $(libqos-obj-y) tests/qtest/pxe-test$(EXESUF): tests/qtest/pxe-test.o tests/qtest/boot-sec= tor.o $(libqos-obj-y) tests/qtest/microbit-test$(EXESUF): tests/qtest/microbit-test.o --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591973960; cv=none; d=zohomail.com; s=zohoarc; b=CQVE+e7pqN85EYvxiJ9p51O9v0j8mMS0FXOPdXIhrnb/SOi5sRXvoHlzmpjW3PdwCxEQyfpg8kCNyCqU55yUuOVzY22EosJI0j1rzwy5rdunfs8lJEb6GLHBLtDuV74Pbfwi5MHRDXEVAudeSADIUzZCmfCRzwC11s1e3BVPldg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591973960; h=Content-Type: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=ZYtQ0BAbh8xOWcl7gyHIjsinn42K680FL50RdRd5Yvs=; b=f/z7vOrS2TP7FqlKkBDaigLWg420hDjBMdsXx91HIIb6A/QXv7qhHJJ/XUqMcqIPec74si9vLRRUFnH6YKotFuFM5VkMjPUpFMC9gZc5pFzoQR0WYJAKJBn0zZZc+2S0M2Dr9sRGfC7FK+OCsjnzGttilwY6Z1Uz02b/yUKbfNw= 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 1591973960291492.8591179262306; Fri, 12 Jun 2020 07:59:20 -0700 (PDT) Received: from localhost ([::1]:36770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjl9L-00032c-23 for importer@patchew.org; Fri, 12 Jun 2020 10:59:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49990) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl2F-0006iQ-P5 for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:00 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:53232 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl2D-0001Rz-HF for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:51:59 -0400 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-104--BxxY0QqN9yZXPqd1ND9qA-1; Fri, 12 Jun 2020 10:51:53 -0400 Received: by mail-wm1-f69.google.com with SMTP id q7so2034716wmj.9 for ; Fri, 12 Jun 2020 07:51:53 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id b8sm10737701wrs.36.2020.06.12.07.51.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973516; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ZYtQ0BAbh8xOWcl7gyHIjsinn42K680FL50RdRd5Yvs=; b=f4cNADIugyTYLpfD1M0bzCcQZTTSd8Yl15lpM2mEDwmtTnKsLTvAJzD3zmufSL+t/gxKs8 RMHk2CE2wrnk9aEPRR4C8ZeLZeywYjTPWsznBLLr2769LLCZ7rmpiA5A0DrWTJNyRjbkx2 jMXK+8zj/YUxUvCx7u+PlwKM8aGl9vM= X-MC-Unique: -BxxY0QqN9yZXPqd1ND9qA-1 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=ZYtQ0BAbh8xOWcl7gyHIjsinn42K680FL50RdRd5Yvs=; b=FS09SYbDoAAELOCpt1j0uEYsasTBIk2CdrKjrvqW5kfKH3eKNeu7zUwrC91hZkyr1l tQ7oi+4i7h2TABIPzHZO2qMJTsyJV4itP8WX8mfWNl3WRDTvv8YgNZhYWzuPTGZsJmZp HH4hK8DWqi0OiMRhGNb9Y8WPCfCjaKvcRmHIvgrcU52TFRY+ZNUGp9Pyg5Nqdy0aqhI7 yF01fciLD9HE5iemTt8UNTKUB6kXpJ57UPmlEcAvFOr1WitzlIPw34Gx3kHL/BNi/ct4 M6xKIcV5gKBGUkADbdxW4DUl22iG56dMNCn6c0gipBiPbnyRuiJMXEcpmbui8hEPUFE8 LbZg== X-Gm-Message-State: AOAM53297onmg3LGW3S8Pr9vPwqBNMJiG/9Waqd3VpkAORIlto/q2wsA Rmvz6VS71j12OmvcmkDKE58vJPAVLJ6PJQS1BoAwTM3m6eIsWlZImQ+CIuDkGahUx4aVpWTRDiA pTjQLdoVnNwOfnk0= X-Received: by 2002:a05:6000:12c4:: with SMTP id l4mr16210295wrx.128.1591973510890; Fri, 12 Jun 2020 07:51:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwE2oIL5ufdcWqhaGQ+l2MKYc12j1LNgLewHaz/ezwQ3QXmyXYIO+lliiKuLdRCh/u8SaIkBQ== X-Received: by 2002:a05:6000:12c4:: with SMTP id l4mr16210274wrx.128.1591973510636; Fri, 12 Jun 2020 07:51:50 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:48 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 21/58] bios-tables-test: Generate reference tables for Q35/TPM-TIS Message-ID: <20200612141917.9446-22-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:00:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, LOTS_OF_MONEY=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Igor Mammedov , Stefan Berger , Eric Auger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric Auger TPM2, DSDT tables were generated using tests/data/acpi/rebuild-expected-aml.sh Signed-off-by: Eric Auger Reviewed-by: Stefan Berger Message-Id: <20200609125409.24179-6-eric.auger@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 2 -- tests/data/acpi/q35/DSDT.tis | Bin 0 -> 8357 bytes tests/data/acpi/q35/TPM2.tis | Bin 0 -> 76 bytes 3 files changed, 2 deletions(-) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index a2a45d1d31..dfb8523c8b 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1,3 +1 @@ /* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/q35/DSDT.tis", -"tests/data/acpi/q35/TPM2.tis", diff --git a/tests/data/acpi/q35/DSDT.tis b/tests/data/acpi/q35/DSDT.tis index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..56b6fb0c3298517d080e38fea05= a748b9f1dba54 100644 GIT binary patch literal 8357 zcmb7JON=3DAM8Lskc+U@pC+vC|cthEqD1O%QLASe+DcDG-d@l21~y9B(Edp3~F?nc4_ zR)VaMW(JAJN{IpnluINpa-v+KTyhV}IR_3affVJCYouHfMXYjI=3DliQ%yH&PFVtr`$ zU;TamUtjg(>#p)czw_H7WBd=3D5ZLbj)D?bc8A8nj5M*H;dHWL?Fci*qndpr|M@a{oI z>|;~03Xl1f^L75~z37uDdi~vq@AlcHPu-6%?e^b(FS^7CbnQ~#wrR)RuzO*p*FE&? zz-yMQUZd$d<UnZ6ZuQE3n_0c{O`jJw7kb;Fm$-42dH(aO!>#0CFSl&F-PYgM zzdC#7xlf*dz5Lm;U;O08RXYK|8vZT(ulH#aU61Uu(a`;HaGAeFba8BTxcuQj9F}b^ z9qC8Za?_DblxlT!)ood_uT`rNR6DA#96dzeFdmJd(_#)|pWn%_MEAg@c=3Dp`9Df!3Z3Z1bCQ#LweMqPkpsLI(SGTxV!DchS#@$$YBCaY@weI1Q8x`Ma#8WrJne$#cvl)Ec_As&XeL z=3Dik7(cDBynh`$lHtaJM!^BNT0m1{6GAn3$HCAwX_~-pSirinmz-csG@1Nqz4ceU`zwz3BK9j(SWSd(XRVMd2_G>Kf zP`e#NP**`5L4)P931>XUeI;>|h*$tF%432Ds0xXR`~n*jOkgJwF%>k%1QSrfL`Y2Z zMquNDsd_+{g2*bMamfT!g~U`O4YSXVTD_6ifw8N~Y>OLS1Ld z(3uiU1x=3DYc5$ZY@44n&x&IMB^LS3h2=3D(G%-mZ=3Dk=3Dt`j$_HqvQBXWG<>P}gZ2I&DLz zZR$j*>&zHBGltHLsS}~D6AumTd^(0s$JB{X*O@hRW(}QLQzt@Q=3Dc1u=3D(a^bQ>O`pP zTrzYn89J9tod|WEuA$R4bh@Tagu2e0p)+Ub%$Yh7>N@j=3D&b*;BZ|X#->s&T;E*mu}HkhYP zCPJNg#$cW?m}g8TLY?`5!F<4AK43Bt>dXfPQ@PB8f~lVI4@#zba3dt9a+0$~&9g?$ zvt~_%vZe(CEo%l^51V%l6#FPVF;E03D}y)!RTKs)al(=3D~;}WPGGbW)bB&L!E1C>~1 zpc<46R6+%l3=3D|=3DHqYPAHClS?DUP}flp?3`wA-XQGFi?q|M8s5sO9m>Tf=3DLF7Q0at$ zN~~bQKs6{CsDuh887M-f69y`=3Df(ZlFpk$yDDwt%T2$fD4sKg2;3{-=3DXfl8=3Dgl7S*r zI$@v^E0{1)4N3+op@K;Uicsl$|V8TE(C>f}P z3MLsSLZuT1DzSnI1J$5ppb{#WWS|I@P8g`f3MLFxgOY(ts9=3D(TB2+qIpb{&XFi;Ij z1}dR~Nd}5g>4bqwtYE@GH7FUVgbF4ZC_<$Z1}d?F2?N!jWS|l%m}H;`l};F_#0n-1 zRD+U%N~mCxfg)5oVW1K#m@rTcN(L&Sf=3DLF7Q0at$N~~bQKs6{CsDuh887M-f69y`=3D zf(ZlFpk$yDDwt%T2$fD4sKg2;3{-=3DXfl8=3Dgl7S*rI$@v^E0{1)4N3+op@K;Uicsl< zfg;ij6p?PA2z3KRs2Qlngn?>IGEj|42C6Y(pc)efsxiqxH6|IT#)N@tOco$ zWS|-o2C6Y(pc<15RAZ8XYD^d?B6W6QponnB#9)$vBE)G>Au-k1!axzJv4w#mQe#U7 zicpO$87M-Z6;AbFp=3D{_3#K-E0K1gq-=3D&#&8_|6k?`bwqGcA6OAL3^hR$K9#W#-ojI zF-%kJRB69Pn>uY8R$;lh6L$D8ecj&Q!+b<~WM>LbHg~*s8h~~ww`gbHPq8%33*m$M z2DRBqY@7Y-d-f8eJ#?atNs7${yd#v=3DH@$urnaMwuq1S!gk1S>`nSW<*9vAy)soDa|BV5!EZ`pI*IEm|wlpJ#3M7Z>qW-yN~joR^Aiky{Yov5#_x}d4IY*W^BH;dS5H=3D zi}LORWXweodQzCKmHenk2DqdZ)oKkqI_ejeB+4n4U|vNqinjoE6b~g z2VN_1yUWQpv#pR4w>F}mAlTNmo>D<%W?D$gHs$gva>j+L9ljH6tX5!_d!^L}3+CjS-s;kt- z%?WSHdcpZ(1Gt`vuJo~Fnxe}-?x{d?l)(SY;KIALMus%?ynG^PK69}^A{S6 zUg&LEN6FyPr{&Bb;^=3DyxO((?&59^5;LE=3DncxTfJ4eBPhw8PI(m-P}kF8?&jz`JA81 zj?d--9J%HTZKb{Ku;Uyhbnf|@=3D`0lYFVE4{w`0?-1idodh#{EUyYAc1&{c(-4?kR> zxU#GfU0=3D8cTjfqJV_OWL`t%Z5Si}-tCqrV`-sLNW)3|)=3DLA6&ct>FZT6(qWp>8!d1 zIwEem$wggynz^l@A@%svgZ##G6 zELLF{`_H?0I>_VnVmThuizWSHOdJuftq860c>G6kfU(~jM?M>m|9nRt`Rsc)9=3D(@M zwow9b$53zlD8`B%4&S=3DN0(xj+l`a9fa*;C|Yz3t<&$r(99os8h_|*cT(AmjouIar9;QG1cn|YBBRr~caFxC4u;A96 zJvKqFa-VsD7*UjIvYMVxMIh!0)Ca@Nkx5$c5(Rnu8q015${Ln{!SnA z+AS;se;?rZa0Lt1eQJM?dcqlc)mj@qG`NgJs(GC=3D+HVnL9hU%M)`u4OiIE)x_=3D=3DtE z)7S`r1P8O=3D)Cl#eNuU>w>?6J`MR)BOfnDmH)@$l5`XyT+lPfJJk<>DijzpeOF3#ET qDLIV)>O|jO{_C~cug=3DsjeDUvFKN_aRFvfX&xQszm{D@BGi2Wba (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 159197380486544.966582881541854; Fri, 12 Jun 2020 07:56:44 -0700 (PDT) Received: from localhost ([::1]:55040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjl6p-00077V-JL for importer@patchew.org; Fri, 12 Jun 2020 10:56:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50014) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl2H-0006jt-Dn for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:02 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:57353 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl2D-0001S3-Il for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:01 -0400 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-322-wPwPLDA6MZ2vO67S_WECWg-1; Fri, 12 Jun 2020 10:51:54 -0400 Received: by mail-wr1-f72.google.com with SMTP id w16so3976208wru.18 for ; Fri, 12 Jun 2020 07:51:54 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id o18sm9407093wme.19.2020.06.12.07.51.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973516; 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=NgqF724ZlpYDgxpsvGgomKXglTKeYnsN1WEfd42scpg=; b=VNyOHpfAObih3Q60mgSthocDRqwfPocxyMOpRpiixxHq+7kXxX5AfbUpkjNsh0ft7YgqY/ lpULqZUwJdFItO9qVGbtvT1MqgM9wISJvZMvQptCpnCLyucP3gAqytKU1lt9Q+MWO9Y+F9 G/d+xNZcnLW+Pasjv5sJGWIgn2D1wjs= X-MC-Unique: wPwPLDA6MZ2vO67S_WECWg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=NgqF724ZlpYDgxpsvGgomKXglTKeYnsN1WEfd42scpg=; b=ojbUNp3/pPMXkDsSyV3xNMIskCNFsdZQ42SwTuLJ+at02IkEubvcSGiYmrq4YskQ05 6YVrXQk5I8vxd60BFe4wlgmH/vHT15+4OmPtwVLg80/kOdYj0JYrjYfjEF/VD2EVUmSl ws5jXuS9pFAWmBbdK0D5d/syOo/GUOCnL5JBgqwBirZc6TtRJHTElZVQqQZL1fTrH8Zb L1CiOjcHZT7Z+Jd1jFL7A3wHA8DWbe5Ow+1YZvDbkS5HWWwrWOUFgiAwJ/gKm3zyq++O Y0xgYJlGwZd1XkKqnyhd/0HYItXCZN1B6Hbj3sP/NnSRQRKKEF9EUw73Pcv8BSPIyp+L lgLw== X-Gm-Message-State: AOAM531Ee0m/IXV2gTdaFBXSwShTwmvFQepiUGRRyfaLTz6rEPQIR+mF lC3jGunMMIMmWyyVxFqk8Ve673pBXvE/l3StM4CsyBizqi76dCmkQV6KlN1Bep/ZjbsHJw5dcim VsPv6Wb0Jh8dbVZ8= X-Received: by 2002:a1c:c904:: with SMTP id f4mr13775290wmb.69.1591973513430; Fri, 12 Jun 2020 07:51:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKGK6kZ7bJZt+ZRB9Ra7NjW85+BqxOmHfzGKkZXtXQhVBBOpwtN7uQeoTnx6kp4Fdh7EABRA== X-Received: by 2002:a1c:c904:: with SMTP id f4mr13775267wmb.69.1591973513175; Fri, 12 Jun 2020 07:51:53 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:51 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 22/58] virtio-balloon: fix free page hinting without an iothread Message-ID: <20200612141917.9446-23-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:00:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , David Hildenbrand , qemu-stable@nongnu.org, Alexander Duyck , Alexander Bulekov , Wei Wang , Alexander Duyck , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: David Hildenbrand In case we don't have an iothread, we mark the feature as abscent but still add the queue. 'free_page_bh' remains set to NULL. qemu-system-i386 \ -M microvm \ -nographic \ -device virtio-balloon-device,free-page-hint=3Dtrue \ -nographic \ -display none \ -monitor none \ -serial none \ -qtest stdio Doing a "write 0xc0000e30 0x24 0x030000000300000003000000030000000300000003000000030000000300000003000000" We will trigger a SEGFAULT. Let's move the check and bail out. While at it, move the static initializations to instance_init(). free_page_report_status and block_iothread are implicitly set to the right values (0/false) already, so drop the initialization. Reviewed-by: Alexander Duyck Reviewed-by: Philippe Mathieu-Daud=C3=A9 Fixes: c13c4153f76d ("virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT") Reported-by: Alexander Bulekov Cc: qemu-stable@nongnu.org Cc: Wei Wang Cc: Michael S. Tsirkin Cc: Philippe Mathieu-Daud=C3=A9 Cc: Alexander Duyck Signed-off-by: David Hildenbrand Message-Id: <20200520100439.19872-2-david@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-balloon.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 065cd450f1..7ff6a7aa7c 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -789,6 +789,13 @@ static void virtio_balloon_device_realize(DeviceState = *dev, Error **errp) return; } =20 + if (virtio_has_feature(s->host_features, VIRTIO_BALLOON_F_FREE_PAGE_HI= NT) && + !s->iothread) { + error_setg(errp, "'free-page-hint' requires 'iothread' to be set"); + virtio_cleanup(vdev); + return; + } + s->ivq =3D virtio_add_queue(vdev, 128, virtio_balloon_handle_output); s->dvq =3D virtio_add_queue(vdev, 128, virtio_balloon_handle_output); s->svq =3D virtio_add_queue(vdev, 128, virtio_balloon_receive_stats); @@ -797,24 +804,11 @@ static void virtio_balloon_device_realize(DeviceState= *dev, Error **errp) VIRTIO_BALLOON_F_FREE_PAGE_HINT)) { s->free_page_vq =3D virtio_add_queue(vdev, VIRTQUEUE_MAX_SIZE, virtio_balloon_handle_free_page= _vq); - s->free_page_report_status =3D FREE_PAGE_REPORT_S_STOP; - s->free_page_report_cmd_id =3D - VIRTIO_BALLOON_FREE_PAGE_REPORT_CMD_ID_MIN; - s->free_page_report_notify.notify =3D - virtio_balloon_free_page_report_not= ify; precopy_add_notifier(&s->free_page_report_notify); - if (s->iothread) { - object_ref(OBJECT(s->iothread)); - s->free_page_bh =3D aio_bh_new(iothread_get_aio_context(s->iot= hread), - virtio_ballloon_get_free_page_hints= , s); - qemu_mutex_init(&s->free_page_lock); - qemu_cond_init(&s->free_page_cond); - s->block_iothread =3D false; - } else { - /* Simply disable this feature if the iothread wasn't created.= */ - s->host_features &=3D ~(1 << VIRTIO_BALLOON_F_FREE_PAGE_HINT); - virtio_error(vdev, "iothread is missing"); - } + + object_ref(OBJECT(s->iothread)); + s->free_page_bh =3D aio_bh_new(iothread_get_aio_context(s->iothrea= d), + virtio_ballloon_get_free_page_hints, = s); } reset_stats(s); } @@ -892,6 +886,11 @@ static void virtio_balloon_instance_init(Object *obj) { VirtIOBalloon *s =3D VIRTIO_BALLOON(obj); =20 + qemu_mutex_init(&s->free_page_lock); + qemu_cond_init(&s->free_page_cond); + s->free_page_report_cmd_id =3D VIRTIO_BALLOON_FREE_PAGE_REPORT_CMD_ID_= MIN; + s->free_page_report_notify.notify =3D virtio_balloon_free_page_report_= notify; + object_property_add(obj, "guest-stats", "guest statistics", balloon_stats_get_all, NULL, NULL, s); =20 --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591973956; cv=none; d=zohomail.com; s=zohoarc; b=GrMyrUZMTBPeEzWd9m9afpp5Ajh9GdoqiP+16RrPgQZPNUgZPkY9VFLyMzVRi1/IwViz8mCyYx3ol/IuXIC2jW59Sz1mpOJPRZuXkjpaCUzA0aWUDhpvpRoOuW3pmxZzjcgYGcvPXnh3YoQAEnxKJYazE3ksm27VSe5LDbFaOVM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591973956; 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=IWR60ercXQZVd22zZQp4vrHc0/weVq8wSWjY7Go6ogE=; b=O+BZJYg2AqSlH3EOI/ClqI6W8gtV8Yjk8XDiN4uIg6VboL1KLQKj3sZCUXK6+GD6UYTGhaSZnjCbKCOtTWi633rwzwQjs5dh3iL4D2Ek8py9yyUvsBtBUSrb2NWSLJc/VL1YPT5ngkxlUicU2vHHLWrO+Jgr6dcUdOfI1s1yvbM= 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 1591973956377137.76015418525913; Fri, 12 Jun 2020 07:59:16 -0700 (PDT) Received: from localhost ([::1]:36420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjl9H-0002qJ-30 for importer@patchew.org; Fri, 12 Jun 2020 10:59:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50062) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl2J-0006lM-7r for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:03 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:32829 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl2H-0001SZ-Lo for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:02 -0400 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-253-WGJQsmkFNrWpb-q3VnQyAg-1; Fri, 12 Jun 2020 10:51:57 -0400 Received: by mail-wr1-f70.google.com with SMTP id p9so3999992wrx.10 for ; Fri, 12 Jun 2020 07:51:56 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id a16sm10113673wrx.8.2020.06.12.07.51.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973521; 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=IWR60ercXQZVd22zZQp4vrHc0/weVq8wSWjY7Go6ogE=; b=HFluY8ZARDoMUe0RcVyzi/3zAerUygUtxyv4o5PmHTSZF4dzz2MbXzfI/3Ovl/eA1nBMpE vT4LxuUoHY0m739zy/UPXuX4A9xkUEEovf2yBFu2s7Db5xpow/qOanOIReMt05O5WDTPDo MD5nYPJVESLG3v+DcBTCaGrR0L+NlFY= X-MC-Unique: WGJQsmkFNrWpb-q3VnQyAg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=IWR60ercXQZVd22zZQp4vrHc0/weVq8wSWjY7Go6ogE=; b=akNU12vKYGVRMtoIesqmOrJJGrJ2uZaX0YWp293I2t8opLs5rhecKcmCAo0JMkaGed bhng+Zrp9v8l7amznsKI9yaIUe1J6fPzfXVQ6Ch21jiW7XLLjRuevfjIeGJDP1Oc4m6I EB/R6MxW+R+roF+1bC0YViheER2rh+RDnpmNAvR53VEFKFP28pl8myGxI6sQmd5ITcjM OsnwDRSpgt1Y9BoHSSi+s0ft/+rC3XjyoVkDs1wU80PJgptiWJ81a+X1iEvgrEqWXcWu h2hdswikfL3298VONHZfj3N9dWURoOYCdNO75JUHcHZzBuhMGPeWUTq1WOqxSj9B2lcB RmGw== X-Gm-Message-State: AOAM531cSDEZuamovin3a402ENdWJhPJ7A4tgMzC6cxczBFSX6TEegIx qhJAmgzm1OLkWdfTA2LL37pMFC8NPfl09uinafMoUmY1GrONw4cifP8rYnPWxG/SubYFBRAOcRI WxiqWnjhL43OXPCk= X-Received: by 2002:adf:f507:: with SMTP id q7mr15102989wro.353.1591973515954; Fri, 12 Jun 2020 07:51:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9aYbpLDGlpygvbyw4emBwQrJQ6UUxUvE8vn4WScLdcWYfa1YnBBAE0JoVm8dT86pZTFsegQ== X-Received: by 2002:adf:f507:: with SMTP id q7mr15102966wro.353.1591973515749; Fri, 12 Jun 2020 07:51:55 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:53 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 23/58] virtio-balloon: fix free page hinting check on unrealize Message-ID: <20200612141917.9446-24-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , David Hildenbrand , qemu-stable@nongnu.org, Alexander Duyck , Wei Wang , Alexander Duyck , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: David Hildenbrand Checking against guest features is wrong. We allocated data structures based on host features. We can rely on "free_page_bh" as an indicator whether to un-do stuff instead. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alexander Duyck Fixes: c13c4153f76d ("virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT") Cc: qemu-stable@nongnu.org Cc: Wei Wang Cc: Michael S. Tsirkin Cc: Philippe Mathieu-Daud=C3=A9 Cc: Alexander Duyck Signed-off-by: David Hildenbrand Message-Id: <20200520100439.19872-3-david@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-balloon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 7ff6a7aa7c..32e9fe3f64 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -818,7 +818,7 @@ static void virtio_balloon_device_unrealize(DeviceState= *dev) VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); VirtIOBalloon *s =3D VIRTIO_BALLOON(dev); =20 - if (virtio_balloon_free_page_support(s)) { + if (s->free_page_bh) { qemu_bh_delete(s->free_page_bh); virtio_balloon_free_page_stop(s); precopy_remove_notifier(&s->free_page_report_notify); --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974235; cv=none; d=zohomail.com; s=zohoarc; b=Gk5w19OazlqAGW7QLINC8g8xIRh20FNKrDemUCkov6EPHjBnnTUYr7fZyEuYKkLwSobZ1Zf6HqV/Zg1S6rlMXJUGK5SGOfm59aWEnnrTKbIietH6c7lI3Qkg0koO9tdScT15PHouwXf72iCl7UwUrR/0jkFg2mHi1Wx0OzblDFc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974235; 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=faqMeqxMHWHCdUO54aiSA0UglN7d7KGvOFdxDmBlKuk=; b=lStWsCzl9M4u883NwsVGwZBrk+7i2icT3yFlu9cMD8nqISQFjGnI6t4cPRY7R/REDZ8PYOU6vzmPn1s4RQmqnCL66UoK3CJn/WcrZCd6hkg7oDflul1JtLFl4IgP/6LlbFU7cf24rZYWHJWn5A9T53EOgFVKKL9YoDbvIYtK8TM= 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 1591974235686963.9477453732095; Fri, 12 Jun 2020 08:03:55 -0700 (PDT) Received: from localhost ([::1]:51548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlDm-0002DT-Kl for importer@patchew.org; Fri, 12 Jun 2020 11:03:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl2K-0006nU-4C for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:04 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:23708 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl2I-0001Sn-EF for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:03 -0400 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-460-exIWrETwNnC-0V7fNdvkYw-1; Fri, 12 Jun 2020 10:51:59 -0400 Received: by mail-wr1-f69.google.com with SMTP id d6so3993255wrn.1 for ; Fri, 12 Jun 2020 07:51:59 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id a81sm9680533wmd.25.2020.06.12.07.51.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973521; 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=faqMeqxMHWHCdUO54aiSA0UglN7d7KGvOFdxDmBlKuk=; b=hDHpqySq23pumRAtu1JeoaBuR1IvS7+heuA9Dao8jkLd3a0/YBc5R+HvJGnRwSAOyLQhSp z/+uY5jg8IaakS/v8GyMh7QFnNVj+Wqk4VvrCMrzOETVnEbyeLbZF/rbZvPpwhxGKV8Nbj nnYbSXoVipmrt33bEfVZV2qz0GQbAj4= X-MC-Unique: exIWrETwNnC-0V7fNdvkYw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=faqMeqxMHWHCdUO54aiSA0UglN7d7KGvOFdxDmBlKuk=; b=hFQnbCB7R+sYQLwhInoH70E2z9FJZMTdpJe7QmjRKI5yMuWy7hWXhG5drH8MA4SKqV U4EUosO3TD+hVswLvHFC3Wddy8rAGtBIE6TJD0EX12B42dXUxqWVbgOCIcO4VEgRh+K3 /xleadA2mik3GybNT7Z0+E/Oky6GKfgfeVooppndIZt3ZeQKL8GpyXFTEi7uP+tSTEAq Mq/WMcHpEUZmfgY0H5ZJ1gPBR7cSOTpRs1TlsmXrEl3DkL4Wi+KVOS3D9KNyRR77+NfJ zcUUTHjE83UjtoDTPSwWC39nfPTBymdANEMCI9d69RWMEXYMhUGYH2HEfXaGEyou1UeG yJtw== X-Gm-Message-State: AOAM5326eRN9VKrECqFSce+ROmEWmg8SENMcEjzwxVScJmU7cZVdyrG6 +6qNixuu0RaxnP/c0fqzTKus7Y9ANg0+9FlBSnO8Vggx2Ufr8kIpncEtrNrPnjoOFiB0VPczdGB MbixANyfkZN7LhAA= X-Received: by 2002:a1c:7215:: with SMTP id n21mr13603880wmc.10.1591973518220; Fri, 12 Jun 2020 07:51:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVFLJwVUoeZ8XIOe/8WuvCGQdcjHtYQxXhDGXB3x2E5rST23tp6VZWFukTGjlT81RLU+B/7w== X-Received: by 2002:a1c:7215:: with SMTP id n21mr13603862wmc.10.1591973518023; Fri, 12 Jun 2020 07:51:58 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:56 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 24/58] virtio-balloon: unref the iothread when unrealizing Message-ID: <20200612141917.9446-25-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 09:30:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , David Hildenbrand , qemu-stable@nongnu.org, Alexander Duyck , Wei Wang , Alexander Duyck , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: David Hildenbrand We took a reference when realizing, so let's drop that reference when unrealizing. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alexander Duyck Fixes: c13c4153f76d ("virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT") Cc: qemu-stable@nongnu.org Cc: Wei Wang Cc: Alexander Duyck Cc: Michael S. Tsirkin Cc: Philippe Mathieu-Daud=C3=A9 Signed-off-by: David Hildenbrand Message-Id: <20200520100439.19872-4-david@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-balloon.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 32e9fe3f64..cff8eab6a1 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -820,6 +820,7 @@ static void virtio_balloon_device_unrealize(DeviceState= *dev) =20 if (s->free_page_bh) { qemu_bh_delete(s->free_page_bh); + object_unref(OBJECT(s->iothread)); virtio_balloon_free_page_stop(s); precopy_remove_notifier(&s->free_page_report_notify); } --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591975392; cv=none; d=zohomail.com; s=zohoarc; b=W4oCNLggLoHlN9lU+3EQXuIrXQK6V/Vf1SRt8rzUs9EcL7OFyRTs4r+av5rZ227ahTqLcS+iwaJY4eLd3FkIRRjDuKdvvDjomS+QvnBtER6nTw4jPh2RnG/4sfLRNraPu9wx45/laTXL5C/LSw28DPtEvjve7UufOHY6cI4ryMw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591975392; h=Content-Type: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=aF0LKMRy71gHDwlhWXRGF209K2gRXN1ZQiFOzyLmj+Q=; b=BzXCQRAKxGWhtLmx3CXbLacr56wya9XN0i7SJGPbZyXE2mYnyzz9bV1tnhaUIA4iI69LO8qSJM7FCVc14apDb4hCnnzVsBvhsSgyg/0I0BzOsuuuZ1JqkqO4Gq0xY4iit/nVbtk8t/EjXlZT19Chz4v/0UQYk5dQ/vnfJAAnDK4= 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 1591975392383404.0171697359891; Fri, 12 Jun 2020 08:23:12 -0700 (PDT) Received: from localhost ([::1]:46408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlWQ-0005sb-Fh for importer@patchew.org; Fri, 12 Jun 2020 11:23:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51628) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl5J-0004h9-Su for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:55:09 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:38141 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl5D-00020x-Gi for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:55:09 -0400 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-415-f0AXP3KQNCe4uUaxMpLvIA-1; Fri, 12 Jun 2020 10:52:01 -0400 Received: by mail-wr1-f69.google.com with SMTP id d6so3993296wrn.1 for ; Fri, 12 Jun 2020 07:52:01 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id a126sm9421817wme.28.2020.06.12.07.51.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:51:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973702; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=aF0LKMRy71gHDwlhWXRGF209K2gRXN1ZQiFOzyLmj+Q=; b=X8JfqKCO6M6X3MMjABdX5AU5INAmT7PCzCvugT8ItlVSi14GIPAvUi3VydFJfHswhSsZXP wonITjS+/poqtDgzFJOx3Xlko3YKEkV8EBmPLBIOvG1m8hHQ0s9/ADVDfkGYamNDN6BZ0g Vi4UrEJpqQmaHcopX6mvdXSnUlws7wk= X-MC-Unique: f0AXP3KQNCe4uUaxMpLvIA-1 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=aF0LKMRy71gHDwlhWXRGF209K2gRXN1ZQiFOzyLmj+Q=; b=EgQbf4wMGEu3vPjrv8FBLFbLBY/yjJDiYtLhdUH8qwfrbnKN7w0SjKMYtnCjvs5ton MqqDf7vFv2ZSpj+uVsfp3/yV+mSk5a16FaLYmK7210s5ziKNyR6mEYzn7latXOnPMoDn SyN7hONqL+oAnVlDww6d96BeBKIQ8ZRnsF4zvfVurzAOO7gZqSGbGqM4LPiQQYITv0uW Ccj1K2oZLlM4ak8zelA3LPgSgRXX5mVWE4Tl74hsXyfEN8VkG5XJ/r3l/ndR/veejTet QH1u9RS3AV7q3emz1GVAFLpm76eP9zqOtfy82EzdmC9CPlkKMQEjdXUUa0K6jKNSOAyp xZmg== X-Gm-Message-State: AOAM531IcV/zMN/NYY8qQbb3LT0r7SVZCrhGGfZjpkNY3qDqV7y0K28B Z2hJ4RvwejomzDh21fDtQ8RNFLefAHoCMso1Kp8fdOf47vJ1Zvavo0nOeP6ZNNSmTig1Hv6hNhO xmQhxjr8laemeWWE= X-Received: by 2002:adf:d84c:: with SMTP id k12mr15372580wrl.265.1591973520425; Fri, 12 Jun 2020 07:52:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoIY7Enn3ocGeRITaSP9zfvJTJzpXFwEaPbNjtj2pmalStuT3J0EqTD9i/W8V4WFRESSGH1Q== X-Received: by 2002:adf:d84c:: with SMTP id k12mr15372559wrl.265.1591973520217; Fri, 12 Jun 2020 07:52:00 -0700 (PDT) Date: Fri, 12 Jun 2020 10:51:58 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 25/58] virtio-balloon: Implement support for page poison reporting feature Message-ID: <20200612141917.9446-26-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Alexander Duyck , Eduardo Habkost , David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Alexander Duyck We need to make certain to advertise support for page poison reporting if we want to actually get data on if the guest will be poisoning pages. Add a value for reporting the poison value being used if page poisoning is enabled in the guest. With this we can determine if we will need to skip free page reporting when it is enabled in the future. The value currently has no impact on existing balloon interfaces. In the case of existing balloon interfaces the onus is on the guest driver to reapply whatever poison is in place. When we add free page reporting the poison value is used to determine if we can perform in-place page reporting. The expectation is that a reported page will already contain the value specified by the poison, and the reporting of the page should not change that value. Acked-by: David Hildenbrand Signed-off-by: Alexander Duyck Message-Id: <20200527041400.12700.33251.stgit@localhost.localdomain> --- include/hw/virtio/virtio-balloon.h | 1 + hw/core/machine.c | 4 +++- hw/virtio/virtio-balloon.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/include/hw/virtio/virtio-balloon.h b/include/hw/virtio/virtio-= balloon.h index d1c968d237..7fe78e5c14 100644 --- a/include/hw/virtio/virtio-balloon.h +++ b/include/hw/virtio/virtio-balloon.h @@ -70,6 +70,7 @@ typedef struct VirtIOBalloon { uint32_t host_features; =20 bool qemu_4_0_config_size; + uint32_t poison_val; } VirtIOBalloon; =20 #endif diff --git a/hw/core/machine.c b/hw/core/machine.c index bb3a7b18b1..9eca7d8c9b 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -28,7 +28,9 @@ #include "hw/mem/nvdimm.h" #include "migration/vmstate.h" =20 -GlobalProperty hw_compat_5_0[] =3D {}; +GlobalProperty hw_compat_5_0[] =3D { + { "virtio-balloon-device", "page-poison", "false" }, +}; const size_t hw_compat_5_0_len =3D G_N_ELEMENTS(hw_compat_5_0); =20 GlobalProperty hw_compat_4_2[] =3D { diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index cff8eab6a1..31d3c88482 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -634,6 +634,7 @@ static void virtio_balloon_get_config(VirtIODevice *vde= v, uint8_t *config_data) =20 config.num_pages =3D cpu_to_le32(dev->num_pages); config.actual =3D cpu_to_le32(dev->actual); + config.poison_val =3D cpu_to_le32(dev->poison_val); =20 if (dev->free_page_report_status =3D=3D FREE_PAGE_REPORT_S_REQUESTED) { config.free_page_report_cmd_id =3D @@ -683,6 +684,14 @@ static ram_addr_t get_current_ram_size(void) return size; } =20 +static bool virtio_balloon_page_poison_support(void *opaque) +{ + VirtIOBalloon *s =3D opaque; + VirtIODevice *vdev =3D VIRTIO_DEVICE(s); + + return virtio_vdev_has_feature(vdev, VIRTIO_BALLOON_F_PAGE_POISON); +} + static void virtio_balloon_set_config(VirtIODevice *vdev, const uint8_t *config_data) { @@ -697,6 +706,10 @@ static void virtio_balloon_set_config(VirtIODevice *vd= ev, qapi_event_send_balloon_change(vm_ram_size - ((ram_addr_t) dev->actual << VIRTIO_BALLOON_PFN_SH= IFT)); } + dev->poison_val =3D 0; + if (virtio_balloon_page_poison_support(dev)) { + dev->poison_val =3D le32_to_cpu(config.poison_val); + } trace_virtio_balloon_set_config(dev->actual, oldactual); } =20 @@ -755,6 +768,17 @@ static const VMStateDescription vmstate_virtio_balloon= _free_page_report =3D { } }; =20 +static const VMStateDescription vmstate_virtio_balloon_page_poison =3D { + .name =3D "vitio-balloon-device/page-poison", + .version_id =3D 1, + .minimum_version_id =3D 1, + .needed =3D virtio_balloon_page_poison_support, + .fields =3D (VMStateField[]) { + VMSTATE_UINT32(poison_val, VirtIOBalloon), + VMSTATE_END_OF_LIST() + } +}; + static const VMStateDescription vmstate_virtio_balloon_device =3D { .name =3D "virtio-balloon-device", .version_id =3D 1, @@ -767,6 +791,7 @@ static const VMStateDescription vmstate_virtio_balloon_= device =3D { }, .subsections =3D (const VMStateDescription * []) { &vmstate_virtio_balloon_free_page_report, + &vmstate_virtio_balloon_page_poison, NULL } }; @@ -849,6 +874,8 @@ static void virtio_balloon_device_reset(VirtIODevice *v= dev) g_free(s->stats_vq_elem); s->stats_vq_elem =3D NULL; } + + s->poison_val =3D 0; } =20 static void virtio_balloon_set_status(VirtIODevice *vdev, uint8_t status) @@ -916,6 +943,8 @@ static Property virtio_balloon_properties[] =3D { VIRTIO_BALLOON_F_DEFLATE_ON_OOM, false), DEFINE_PROP_BIT("free-page-hint", VirtIOBalloon, host_features, VIRTIO_BALLOON_F_FREE_PAGE_HINT, false), + DEFINE_PROP_BIT("page-poison", VirtIOBalloon, host_features, + VIRTIO_BALLOON_F_PAGE_POISON, true), /* QEMU 4.0 accidentally changed the config size even when free-page-h= int * is disabled, resulting in QEMU 3.1 migration incompatibility. This * property retains this quirk for QEMU 4.1 machine types. --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.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=1591974391; cv=none; d=zohomail.com; s=zohoarc; b=bR/EU44oszOlsrO4+UBEV5yNdbk5jGz1duGpU/gAZTzStMMcV71Jn/X+O3gSuyqvWtOCj6TCYul2nmmXspZqjRYn+CD86zsjSc39reBzs6NU5U20YpNEmptqsPJFF3NGYewOV8aTVvAQHLf8eH+04oiyOuoVGN71LdtG8Dw99mU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974391; h=Content-Type: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=oiR6m9EPqvRwON04zA+EzVpgAt3vN6EqBTJGhjucyNs=; b=cah0yUNi7KraoLCmUe1i0QObiP8YRrlZorku4LQaARDSqqN1dCdBkwhT3L0y6azMHTg6mpD2f114wRLJeZVqPMxDDFl++aQgQn+3dgRCRCJlscYMYeLzWTTmlxJYab2C4fFOUty15fRjje+CBb3QX80WsslRzG9so0Skjim8FjY= 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 1591974391707319.084081050397; Fri, 12 Jun 2020 08:06:31 -0700 (PDT) Received: from localhost ([::1]:33688 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlGI-0007hz-QZ for importer@patchew.org; Fri, 12 Jun 2020 11:06:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl2Z-0007N5-AC for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:19 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:33606 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl2X-0001UW-EF for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:19 -0400 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-162-mFYc0c8nPcmKgJgqqU_lpQ-1; Fri, 12 Jun 2020 10:52:04 -0400 Received: by mail-wm1-f69.google.com with SMTP id y15so2035714wmi.0 for ; Fri, 12 Jun 2020 07:52:03 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id s2sm2848450wmh.15.2020.06.12.07.52.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973536; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oiR6m9EPqvRwON04zA+EzVpgAt3vN6EqBTJGhjucyNs=; b=EgL5e/S5q03wDoHGWCRz+V6up26Y2TJZu9MQ31c63spYkI4tm+/Xb6MJL+yxTsXdRulpMf cCM0N9FC0CFajN60WBZ7vt9bSztZF+tKZ+p6bhTC0SH67bgzWDMWGwI75OqDYwIhe1EYgx cpnXKG+LpcXkzv+kqqm2bVubh6IfzaY= X-MC-Unique: mFYc0c8nPcmKgJgqqU_lpQ-1 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=oiR6m9EPqvRwON04zA+EzVpgAt3vN6EqBTJGhjucyNs=; b=kGK54poU408CaL/Ve6p2jJJeiNh27IAuVsY0N9ExM4LwWtaW5SZkDLHUXc0Pln9RTF SqP0KdueICl1DJxy1W9kqZ5vvgzTVvOd0jnTla8T/Nq/DQqEST36L1SDCHtX2YSgG2CX 4rKcC4jwU2xoj89EnIzJI4ZHa+bTw+YtThY5SnlgDdn3lBXy0sZN6aYyV4gQWR1vQv6n k6kr2C0K45MivCNZgAN2EMBRla1jHoYB/cF0R5LzbscvF8JJsYLMzlivdgo1n0uFKaNQ mWTlQxv91Ud2Yh/G1eYfgMDYKUP2m9VUP3gm6kJH4qMdjqQLrVPeY7s+ozx/J2Q3CL0g JeEw== X-Gm-Message-State: AOAM531ijCe5koR25NVKZ+fZ/7sUw5lFzwHD4EJfUXhGP6gfUD79YXBa TcbEHYCaLIj+PqKAjj3PKMoi96jfgqUuhUSyek2ufUt6wJ6soT1dXsoToObAPmxgy3y3KzHY9C7 oHBGVb4dQXXztQJo= X-Received: by 2002:a5d:69cb:: with SMTP id s11mr15427387wrw.91.1591973522429; Fri, 12 Jun 2020 07:52:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzov7XLquS1rlXBvSllz4ZXl6iBj7WLdlSmtyXwQAG896WqEK8yaUMgX3cokOX7IKM1H++kyg== X-Received: by 2002:a5d:69cb:: with SMTP id s11mr15427367wrw.91.1591973522214; Fri, 12 Jun 2020 07:52:02 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:00 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 26/58] virtio-balloon: Provide an interface for free page reporting Message-ID: <20200612141917.9446-27-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:00:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Alexander Duyck , David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Alexander Duyck Add support for free page reporting. The idea is to function very similar to how the balloon works in that we basically end up madvising the page as not being used. However we don't really need to bother with any deflate type logic since the page will be faulted back into the guest when it is read or written to. This provides a new way of letting the guest proactively report free pages to the hypervisor, so the hypervisor can reuse them. In contrast to inflate/deflate that is triggered via the hypervisor explicitly. Acked-by: David Hildenbrand Signed-off-by: Alexander Duyck Message-Id: <20200527041407.12700.73735.stgit@localhost.localdomain> --- include/hw/virtio/virtio-balloon.h | 2 +- hw/virtio/virtio-balloon.c | 72 ++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/include/hw/virtio/virtio-balloon.h b/include/hw/virtio/virtio-= balloon.h index 7fe78e5c14..d49fef00ce 100644 --- a/include/hw/virtio/virtio-balloon.h +++ b/include/hw/virtio/virtio-balloon.h @@ -42,7 +42,7 @@ enum virtio_balloon_free_page_report_status { =20 typedef struct VirtIOBalloon { VirtIODevice parent_obj; - VirtQueue *ivq, *dvq, *svq, *free_page_vq; + VirtQueue *ivq, *dvq, *svq, *free_page_vq, *reporting_vq; uint32_t free_page_report_status; uint32_t num_pages; uint32_t actual; diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 31d3c88482..10507b2a43 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -321,6 +321,67 @@ static void balloon_stats_set_poll_interval(Object *ob= j, Visitor *v, balloon_stats_change_timer(s, 0); } =20 +static void virtio_balloon_handle_report(VirtIODevice *vdev, VirtQueue *vq) +{ + VirtIOBalloon *dev =3D VIRTIO_BALLOON(vdev); + VirtQueueElement *elem; + + while ((elem =3D virtqueue_pop(vq, sizeof(VirtQueueElement)))) { + unsigned int i; + + /* + * When we discard the page it has the effect of removing the page + * from the hypervisor itself and causing it to be zeroed when it + * is returned to us. So we must not discard the page if it is + * accessible by another device or process, or if the guest is + * expecting it to retain a non-zero value. + */ + if (qemu_balloon_is_inhibited() || dev->poison_val) { + goto skip_element; + } + + for (i =3D 0; i < elem->in_num; i++) { + void *addr =3D elem->in_sg[i].iov_base; + size_t size =3D elem->in_sg[i].iov_len; + ram_addr_t ram_offset; + RAMBlock *rb; + + /* + * There is no need to check the memory section to see if + * it is ram/readonly/romd like there is for handle_output + * below. If the region is not meant to be written to then + * address_space_map will have allocated a bounce buffer + * and it will be freed in address_space_unmap and trigger + * and unassigned_mem_write before failing to copy over the + * buffer. If more than one bad descriptor is provided it + * will return NULL after the first bounce buffer and fail + * to map any resources. + */ + rb =3D qemu_ram_block_from_host(addr, false, &ram_offset); + if (!rb) { + trace_virtio_balloon_bad_addr(elem->in_addr[i]); + continue; + } + + /* + * For now we will simply ignore unaligned memory regions, or + * regions that overrun the end of the RAMBlock. + */ + if (!QEMU_IS_ALIGNED(ram_offset | size, qemu_ram_pagesize(rb))= || + (ram_offset + size) > qemu_ram_get_used_length(rb)) { + continue; + } + + ram_block_discard_range(rb, ram_offset, size); + } + +skip_element: + virtqueue_push(vq, elem, 0); + virtio_notify(vdev, vq); + g_free(elem); + } +} + static void virtio_balloon_handle_output(VirtIODevice *vdev, VirtQueue *vq) { VirtIOBalloon *s =3D VIRTIO_BALLOON(vdev); @@ -835,6 +896,12 @@ static void virtio_balloon_device_realize(DeviceState = *dev, Error **errp) s->free_page_bh =3D aio_bh_new(iothread_get_aio_context(s->iothrea= d), virtio_ballloon_get_free_page_hints, = s); } + + if (virtio_has_feature(s->host_features, VIRTIO_BALLOON_F_REPORTING)) { + s->reporting_vq =3D virtio_add_queue(vdev, 32, + virtio_balloon_handle_report); + } + reset_stats(s); } =20 @@ -858,6 +925,9 @@ static void virtio_balloon_device_unrealize(DeviceState= *dev) if (s->free_page_vq) { virtio_delete_queue(s->free_page_vq); } + if (s->reporting_vq) { + virtio_delete_queue(s->reporting_vq); + } virtio_cleanup(vdev); } =20 @@ -945,6 +1015,8 @@ static Property virtio_balloon_properties[] =3D { VIRTIO_BALLOON_F_FREE_PAGE_HINT, false), DEFINE_PROP_BIT("page-poison", VirtIOBalloon, host_features, VIRTIO_BALLOON_F_PAGE_POISON, true), + DEFINE_PROP_BIT("free-page-reporting", VirtIOBalloon, host_features, + VIRTIO_BALLOON_F_REPORTING, false), /* QEMU 4.0 accidentally changed the config size even when free-page-h= int * is disabled, resulting in QEMU 3.1 migration incompatibility. This * property retains this quirk for QEMU 4.1 machine types. --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974189; cv=none; d=zohomail.com; s=zohoarc; b=X8q9Bn6smUjGP4RSIGNmo98ATKfOAk3YLwZYcyz4g0wJJmjVgnkzWZJX/Rc8s/WvyJXlTwgKxJBRtdqvbkXey5zz4zQIGt2NQNNamfWRZ283h1uLDEtFdpn9/rWTA16ElEXuEbzHHWNjo/q19F82K85j7mN8vjDI8/7rW4M5ahM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974189; 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=11YzbNhHFtGTHcpUmTTeopy8tsF4jxxnFLUzlloWLDM=; b=COyfl98CyWtUX684jXzCsgHyWnBCf4kYyxCKmgyDn2P4QGUf2q9rRmZn98AbhwX9H/FVF6Ie0wAqdKgF/6XINKsJHfD32D8L7/CIT4Se8iGj2Qm8WiDITu8NS/uxr6us1p2UeVrC57yMwUUXlHiaw+L5UuZFdDPCz8C36IbBg8w= 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 1591974189126632.6326560270775; Fri, 12 Jun 2020 08:03:09 -0700 (PDT) Received: from localhost ([::1]:46698 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlCd-00086I-R7 for importer@patchew.org; Fri, 12 Jun 2020 11:02:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50144) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl2T-00073q-W2 for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:14 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:49819 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl2S-0001Ti-7d for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:13 -0400 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-203-BpLEKCkiPayozaeyH8ru8A-1; Fri, 12 Jun 2020 10:52:05 -0400 Received: by mail-wm1-f71.google.com with SMTP id a7so2034761wmf.1 for ; Fri, 12 Jun 2020 07:52:05 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id d11sm10575623wrm.64.2020.06.12.07.52.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973529; 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=11YzbNhHFtGTHcpUmTTeopy8tsF4jxxnFLUzlloWLDM=; b=iz3whja/RtDc/qe5ayw67DKPd0i6Pmvb1Im+hiyIvQfo/IkvhjmjvmDof6aBQYwGeNJkgO pnWnqC//RWX1xFO4TrM1FSWqpWD3Rh1bIK1UtDttZRZcUuhM9FBT4sfpaqLxF+X/qmnlyO TYXo2gJxKUUrUf9RHoeOBonlAn6FJ6c= X-MC-Unique: BpLEKCkiPayozaeyH8ru8A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=11YzbNhHFtGTHcpUmTTeopy8tsF4jxxnFLUzlloWLDM=; b=mAhF7D/+7R4aTa9tAYv4OS7jwjeDUtYp9YB3rLP3WZO2MlYTRq7GsyR8MnRU0jExEb T095iay8fK4z5qqfxqvwU18goPXjNGPn8Ly/xR6CbOk3iSRt1lDKKDJOCKODOXjeS9li fDj8O1qRDYWyDGg2NEPhR8wvAhtNn2465NqNYDIUABdpyf8hExYuM4vVM6Ifgzuj6NeR tT2qeKIGnBk/b7M7hDPJLIpLldtY7LkHjEEK+gnow3h0JVA1HSIfM+hJ+E6mUkNS4KpN //3dZjcqJVn3HC3opRdTcUYj6G4kQ4rF3erlV0VIGrJEIEAmt1h4ELVvehviqNe8mfEh 89rw== X-Gm-Message-State: AOAM5301BFavkFqh37JfxFCVLCFX1PMUOki030ZZ6+l/XQ9hF8U9bxND cqAm7I9+4bbdCRK1jeK198J2B2XIm5O7OoY6Q4B8GKH6M3kWLmtI4IbZUEfhvvY3+ajv3Xj4dnE RSFAZuQz67Of0YPo= X-Received: by 2002:a5d:66c3:: with SMTP id k3mr15221178wrw.401.1591973524634; Fri, 12 Jun 2020 07:52:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxT2Y7OQZIcRitWMshLKHB1qOKOVgd6v7J65CqBD/QTZEX+y0tq0k4SIWxgwJp3KIMzEQ2+Ow== X-Received: by 2002:a5d:66c3:: with SMTP id k3mr15221159wrw.401.1591973524407; Fri, 12 Jun 2020 07:52:04 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:02 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 27/58] MAINTAINERS: Fix the classification of bios-tables-test-allowed-diff.h Message-ID: <20200612141917.9446-28-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:17 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , Laurent Vivier , Markus Armbruster , Aleksandar Markovic , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Thomas Huth The file tests/qtest/bios-tables-test-allowed-diff.h is currently only assigned to the qtest section according MAINTAINERS. However, this file normally only gets updated when the ACPI tables changed - something the qtest maintainers don't have much clue of. Thus this file should rather be assigned to the ACPI maintainers instead. Signed-off-by: Thomas Huth Message-Id: <20200607052022.12222-1-thuth@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 6e7890ce82..0c5ed09ad5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1531,7 +1531,7 @@ F: hw/acpi/* F: hw/smbios/* F: hw/i386/acpi-build.[hc] F: hw/arm/virt-acpi-build.c -F: tests/qtest/bios-tables-test.c +F: tests/qtest/bios-tables-test* F: tests/qtest/acpi-utils.[hc] F: tests/data/acpi/ =20 @@ -2321,6 +2321,7 @@ S: Maintained F: qtest.c F: accel/qtest.c F: tests/qtest/ +X: tests/qtest/bios-tables-test-allowed-diff.h =20 Device Fuzzing M: Alexander Bulekov --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974145; cv=none; d=zohomail.com; s=zohoarc; b=VgNXuokw1qodZjbm9oRyh3xIOXLr17HV3b/6+7O7xj2OvJN5BaH0lPy5yXSVYLW1IbUj1O4PCwQw4vO8Zfqt9nj434IDQhHwtnCpEoaGzFsvzoNrPHBO2LUNxztvCdag04CjFebKmKKn/t9yGYqwRmEm4Gyp7K2l/xPSqn1dBu8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974145; h=Content-Type: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=aqpkevWS1bn14Aqbrax5GGDgUtTsP9lYBB9gZceP86Y=; b=EUdXbkax3fFuvj4g3vwR7NxCCfNAWlI2WWp0lPGshHKycX1GjAXx9OPMDubSmMbCZIktoCBbSnkW1Je8/D9n7xqo2F+xYYDbPl/rMoEVfEnsm+sgpiTASywSeEeHOCSzKK4cGrZNGcoyRofisnb1VdYq8UtWTQe6PoefmpKSqmk= 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 1591974145610895.6476945117194; Fri, 12 Jun 2020 08:02:25 -0700 (PDT) Received: from localhost ([::1]:44928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlCJ-0007D9-2p for importer@patchew.org; Fri, 12 Jun 2020 11:02:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50162) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl2U-00076N-N0 for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:14 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:37339 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl2S-0001Tm-7o for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:14 -0400 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-141-kMF8hMYBO8CLDPfsb_Tk1w-1; Fri, 12 Jun 2020 10:52:08 -0400 Received: by mail-wm1-f71.google.com with SMTP id p24so2548146wmc.1 for ; Fri, 12 Jun 2020 07:52:08 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id b18sm10081990wrn.88.2020.06.12.07.52.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973530; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=aqpkevWS1bn14Aqbrax5GGDgUtTsP9lYBB9gZceP86Y=; b=CjPziS7prsAQ3SE52S6rvnBAY5fXZnSR5H+7CGJaRMUvu2FbnSiFl72pp9ztFK7lHopSFu 7xa3SdbeL7CN7yt9En19VKen1niBHyunkSxeY3EBwCwSNnUTPYpxj+URbpqsGhzQZUtoUU fgF3KYoVrOKzV6L/8SUX2w4Ptg2rlOM= X-MC-Unique: kMF8hMYBO8CLDPfsb_Tk1w-1 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=aqpkevWS1bn14Aqbrax5GGDgUtTsP9lYBB9gZceP86Y=; b=knUyygpqRQWF9+ZImlKxFoYs8NfzvdpNRiovDwymxD8+OtB/VG2cTgOcQpai0EplE5 3YK2xhN/+v1WRoDmLE/epiMPiIbmRVPeafgHjLIn/QD0JVuPTWbkkMeMfkS3W6ua3t7G AK4qp84NfR5Z4f3VjxLnGfSD2nAoITgtg7n+kqI87zc4i4VudURMegB1xChI8A5m/Vb5 7R6G/DPrYAvhwDMplHK15b0C2uIclP0fwE1Pl5JsHtm7ttF5D9IcjK2em6/P1N10MFzw k0qJFZlzmkjgirGj348qqw8SO8/H0lJlEuta5sucPdCEmZBXf1huSVgesBgOSGCXWDbr Y4Tw== X-Gm-Message-State: AOAM530qGuItfK22XLxfL8YZgv31Eh5hjYMF3XgLHLgjhqzUPnJAZMOx niVUVgAFFa6lAuIkrhRgImFxtWzbQK9UX0HOHyX6e7pCve6KzMKcpWohny/mdE9WXZQ+cnPEbe7 adZGqmwD4zn4AsZI= X-Received: by 2002:adf:dcd2:: with SMTP id x18mr15167147wrm.258.1591973527027; Fri, 12 Jun 2020 07:52:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykdR7oFAZ1wWvTIy3aU7Osf7Xyg0PSOb8SGp/5sYfY4BQx7yekOL9KF5wrltQF0j6REeOpmw== X-Received: by 2002:adf:dcd2:: with SMTP id x18mr15167137wrm.258.1591973526854; Fri, 12 Jun 2020 07:52:06 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:04 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 28/58] hw/pci/pcie: Move hot plug capability check to pre_plug callback Message-ID: <20200612141917.9446-29-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Julia Suvorova , 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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Julia Suvorova Check for hot plug capability earlier to avoid removing devices attached during the initialization process. Run qemu with an unattached drive: -drive file=3D$FILE,if=3Dnone,id=3Ddrive0 \ -device pcie-root-port,id=3Drp0,slot=3D3,bus=3Dpcie.0,hotplug=3Doff Hotplug a block device: device_add virtio-blk-pci,id=3Dblk0,drive=3Ddrive0,bus=3Drp0 If hotplug fails on plug_cb, drive0 will be deleted. Fixes: 0501e1aa1d32a6 ("hw/pci/pcie: Forbid hot-plug if it's disabled on th= e slot") Acked-by: Igor Mammedov Signed-off-by: Julia Suvorova Message-Id: <20200604125947.881210-1-jusual@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci/pcie.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index f50e10b8fb..5b9c022d91 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -407,6 +407,17 @@ static void pcie_cap_slot_plug_common(PCIDevice *hotpl= ug_dev, DeviceState *dev, void pcie_cap_slot_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *d= ev, Error **errp) { + PCIDevice *hotplug_pdev =3D PCI_DEVICE(hotplug_dev); + uint8_t *exp_cap =3D hotplug_pdev->config + hotplug_pdev->exp.exp_cap; + uint32_t sltcap =3D pci_get_word(exp_cap + PCI_EXP_SLTCAP); + + /* Check if hot-plug is disabled on the slot */ + if (dev->hotplugged && (sltcap & PCI_EXP_SLTCAP_HPC) =3D=3D 0) { + error_setg(errp, "Hot-plug failed: unsupported by the port device = '%s'", + DEVICE(hotplug_pdev)->id); + return; + } + pcie_cap_slot_plug_common(PCI_DEVICE(hotplug_dev), dev, errp); } =20 @@ -415,7 +426,6 @@ void pcie_cap_slot_plug_cb(HotplugHandler *hotplug_dev,= DeviceState *dev, { PCIDevice *hotplug_pdev =3D PCI_DEVICE(hotplug_dev); uint8_t *exp_cap =3D hotplug_pdev->config + hotplug_pdev->exp.exp_cap; - uint32_t sltcap =3D pci_get_word(exp_cap + PCI_EXP_SLTCAP); PCIDevice *pci_dev =3D PCI_DEVICE(dev); =20 /* Don't send event when device is enabled during qemu machine creatio= n: @@ -431,13 +441,6 @@ void pcie_cap_slot_plug_cb(HotplugHandler *hotplug_dev= , DeviceState *dev, return; } =20 - /* Check if hot-plug is disabled on the slot */ - if ((sltcap & PCI_EXP_SLTCAP_HPC) =3D=3D 0) { - error_setg(errp, "Hot-plug failed: unsupported by the port device = '%s'", - DEVICE(hotplug_pdev)->id); - return; - } - /* To enable multifunction hot-plug, we just ensure the function * 0 added last. When function 0 is added, we set the sltsta and * inform OS via event notification. --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974260; cv=none; d=zohomail.com; s=zohoarc; b=TS9fT3JPW4gVV+8fcB41TQg7PKxnlSqXktrQarW0Fk1HTMNnfF1yAVNExaHYzHwUjyDs9tw6GPcFU1X5za2zFXBns0N2mnynt75DBEK7wpREBADD88Uy06wIWdMsKxdD4SqQTxWnOWMcc3RMHW/HseXmkoRFFscV9ewqMe/W/+Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974260; 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=10332xG/Et6G9yDWYNuu/GUK5CzyCJzNTiI8MGCB5RE=; b=lsBSNcIkWP42SWfCKowGFw3P9d0tJ6zOdZqRml/6usDTiUObBAbNPJdSX9pK7mYWidhU8CdwCHYL4EUMT0bC9KQfqj4jNRk+sqwXnkfeM9XosK7JTChe/uMtH1zJ0WKTy1jVXD54H1RJ8aHRAbjSLPt7bierODtEf5XgoYJl9g8= 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 1591974260233241.6273911692905; Fri, 12 Jun 2020 08:04:20 -0700 (PDT) Received: from localhost ([::1]:53392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlEB-0002xg-7Z for importer@patchew.org; Fri, 12 Jun 2020 11:04:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50168) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl2V-00078V-9g for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:15 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:22910 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl2S-0001Tt-Mt for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:14 -0400 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-389-edYZCoFqO66yY9UrM4nMUg-1; Fri, 12 Jun 2020 10:52:10 -0400 Received: by mail-wr1-f70.google.com with SMTP id w16so3976492wru.18 for ; Fri, 12 Jun 2020 07:52:10 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id z25sm9103366wmf.10.2020.06.12.07.52.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973532; 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=10332xG/Et6G9yDWYNuu/GUK5CzyCJzNTiI8MGCB5RE=; b=ektoibFlcy/FaOaMp1GgnDNMvriAEwMO647p/m28Yc4Aps//eXCsNhoEaGqGAJUymX4Elg PLjbF0E1KviCFehYUZnF2xlxCsd2R7mmC8x+y0E0xzWKKnq1Z/yghdKK/8NLqUUbdFTznZ 8USVMkQ7PaaU5SoSvgMwdiDFe+pEK5w= X-MC-Unique: edYZCoFqO66yY9UrM4nMUg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=10332xG/Et6G9yDWYNuu/GUK5CzyCJzNTiI8MGCB5RE=; b=rcM6TmoYuhYlciHOxR+Q6INF3zzu0DsmSCYYk3zptdneorbSwacMJBs0EDCKe1LUWw 09M2UzgLM7VVXq7KWo5xHhq9M2ZLb/gHM4zum4HSha1iD7xbBWlrowR9SiXRVtW+TMCr Is+ZVWwDYpskT8C0gNBqRYQUQ9OQMv/11SGdBEnHpcozVgv6CuCdUENPj0sf9Vvmg7Jj Yn/n1c4oSzxfi3Ff8JWry2mnmqluoLgucl16TaxVSpFmXLoBYIBh8NU3WhbK/56JXTSp SZ22/cot+PzoWs8RJNbor0ktoLuUTK2iRzCTaQAAzUJU6EdI8gMGt7ZUOn+M9EOODpOX gj5g== X-Gm-Message-State: AOAM530fR2Cm3mc0JSaeioY/dKb8xXDequuIZUtYHi6Ni5BFQx04Dhk3 f7OtuQqZwC4u1QK1hCvOj1w7ir6o3HhKRTfQyx9cRo5516bFuVcO9py7edjJBnPuOc6gA8OyPAK dC5eVGj9JG3uIY0I= X-Received: by 2002:adf:fd4b:: with SMTP id h11mr14995190wrs.209.1591973529128; Fri, 12 Jun 2020 07:52:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpP8uo1RqI58tiTARxfnua1V7PbmukBMKys7UocvScr6yP2w3gQVW5S4VhSwBSepb8HqkngA== X-Received: by 2002:adf:fd4b:: with SMTP id h11mr14995175wrs.209.1591973528925; Fri, 12 Jun 2020 07:52:08 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:07 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 29/58] pci: assert configuration access is within bounds Message-ID: <20200612141917.9446-30-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:17 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Prasad J Pandit Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Prasad J Pandit While accessing PCI configuration bytes, assert that 'address + len' is within PCI configuration space. Generally it is within bounds. This is more of a defensive assert, in case a buggy device was to send 'address' which may go out of bounds. Suggested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Prasad J Pandit Message-Id: <20200604113525.58898-1-ppandit@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci/pci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 70c66965f5..7bf2ae6d92 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1381,6 +1381,8 @@ uint32_t pci_default_read_config(PCIDevice *d, { uint32_t val =3D 0; =20 + assert(address + len <=3D pci_config_size(d)); + if (pci_is_express_downstream_port(d) && ranges_overlap(address, len, d->exp.exp_cap + PCI_EXP_LNKSTA, 2)) { pcie_sync_bridge_lnk(d); @@ -1394,6 +1396,8 @@ void pci_default_write_config(PCIDevice *d, uint32_t = addr, uint32_t val_in, int int i, was_irq_disabled =3D pci_irq_disabled(d); uint32_t val =3D val_in; =20 + assert(addr + l <=3D pci_config_size(d)); + for (i =3D 0; i < l; val >>=3D 8, ++i) { uint8_t wmask =3D d->wmask[addr + i]; uint8_t w1cmask =3D d->w1cmask[addr + i]; --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591975615; cv=none; d=zohomail.com; s=zohoarc; b=KikJo2SQ1CiwwdCIpJDxCfQwnjeE0gT4lNxeyaa20T9R3a6JqQR+69chEGen5eBT/VAVvYoDKOJzcn05VVT2QRN1DPpkckrydI4WaPaLuuRRN0Mf6Rvy/mgzap93jcpzqgmf/uraw/OrL57xwyl1Et/H0OK0d71lmx2zfOGWzMs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591975615; 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=S8oMz8cU0uw+UrewEP7VqnSORJBEZFEU72TWJXbPFmA=; b=XWd0soLSVsZsuFMIxGPVf+SOIWHgAKP/xFuwlGUuvDJPAtccKrgBjcFhufj/y9ItCMpgtk2ecBvegjl3mcCa8DUmDkPAeAMQcUoC6SH/IKVz6JCLQ4I0RY0EmkFbXho8B502f/+faijagPM6ZIOTPDXRWM1dDw0AbwLeTpq0qwo= 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 159197561597812.768077507835528; Fri, 12 Jun 2020 08:26:55 -0700 (PDT) Received: from localhost ([::1]:57550 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjla2-0002yh-N9 for importer@patchew.org; Fri, 12 Jun 2020 11:26:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52020) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl6D-0006l8-Rn for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:56:09 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:37893 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl6B-0002LE-Dv for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:56:05 -0400 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-347-aYppKkerPOmpeohR7M90Mg-1; Fri, 12 Jun 2020 10:52:12 -0400 Received: by mail-wm1-f69.google.com with SMTP id v24so2549761wmh.3 for ; Fri, 12 Jun 2020 07:52:12 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id 23sm8894999wmg.10.2020.06.12.07.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973762; 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=S8oMz8cU0uw+UrewEP7VqnSORJBEZFEU72TWJXbPFmA=; b=WHEcXoVsLSbrN5mI2Xiz2JgBeynbGiffBbYHaa8FaiQWmyS9ku1b3Aa4wxXEYmK5JW3239 KNQ4lnDppsRXZO2hM0BOzEQaZaqA5s7clRKky9eStDI/aGHBLrft9XZRDj2r+6ffbD81/T cIR9YbsEYVuPcceeeWsQ/UgvrgmB5C4= X-MC-Unique: aYppKkerPOmpeohR7M90Mg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=S8oMz8cU0uw+UrewEP7VqnSORJBEZFEU72TWJXbPFmA=; b=CCDozYDFGCc7n0sqRCwu857CwN/AEBSLX+zragDx83YOdqLD2VHliorlbbdRDsJXCZ 43u4QG6Tk0X8sKyBJ5z4alUYaFDmIvbUzJX1JJe8Tks8QiNeomDaspOoPt6X3DSEAAK7 r0SaMUoJEP4+TVCQ2VjuCEcL+4pArFJhpxx6RsxNqhMlMjnmXpqhVbW9P4cV4NRqmzDL UEBQVmbWpqUu7A6R1bH4VG5fokUkn/ojiduUtRAC8Aazts37+J9CK0w2rrEn+zFffeWt sTssxiaRpNA115uFU8/AuCykm7lVe9XvfNcSs1vpUiS8XPPjzqgp78DWJplpYTBCcfTE kRMw== X-Gm-Message-State: AOAM531cUlAtEX3kGFKD41u3XrGee/fhmF5lgTx7n8Kz337Wpkjqyi8d kfjiBxGzd0rhY9dqoNZBVt1g6UDpOV3t8UXLcnBpJSARPsA2f5IAgp91RrwW/ZMuxtI/8ti+a8X C6PE5TMxqQuBo2gI= X-Received: by 2002:a5d:42cd:: with SMTP id t13mr15041002wrr.355.1591973531382; Fri, 12 Jun 2020 07:52:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+A6exq6OqvNGftTsJHxfMengL/267vt4ac+nV6JcfDe0KjnY4nnv/qDhYIJCOV4IDNHja5g== X-Received: by 2002:a5d:42cd:: with SMTP id t13mr15040986wrr.355.1591973531219; Fri, 12 Jun 2020 07:52:11 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:09 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 30/58] hw/pci-host/prep: Correct RAVEN bus bridge memory region size Message-ID: <20200612141917.9446-31-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, Peter Maydell , Richard Henderson , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , =?utf-8?B?SGVydsOp?= Poussineau Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 memory_region_set_size() handle the 16 Exabytes limit by special-casing the UINT64_MAX value. This is not a problem for the 32-bit maximum, 4 GiB. By using the UINT32_MAX value, the bm-raven MemoryRegion ends up missing 1 byte: $ qemu-system-ppc -M prep -S -monitor stdio -usb memory-region: bm-raven 0000000000000000-00000000fffffffe (prio 0, i/o): bm-raven 0000000000000000-000000003effffff (prio 0, i/o): alias bm-pci-memory = @pci-memory 0000000000000000-000000003effffff 0000000080000000-00000000ffffffff (prio 0, i/o): alias bm-system @sys= tem 0000000000000000-000000007fffffff Fix by using the correct value. We now have: memory-region: bm-raven 0000000000000000-00000000ffffffff (prio 0, i/o): bm-raven 0000000000000000-000000003effffff (prio 0, i/o): alias bm-pci-memory = @pci-memory 0000000000000000-000000003effffff 0000000080000000-00000000ffffffff (prio 0, i/o): alias bm-system @sys= tem 0000000000000000-000000007fffffff Reviewed-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200601142930.29408-3-f4bug@amsat.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Richard Henderson --- hw/pci-host/prep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c index 1a02e9a670..88e2fc66a9 100644 --- a/hw/pci-host/prep.c +++ b/hw/pci-host/prep.c @@ -294,7 +294,7 @@ static void raven_pcihost_initfn(Object *obj) &s->pci_memory, &s->pci_io, 0, TYPE_PCI_BUS); =20 /* Bus master address space */ - memory_region_init(&s->bm, obj, "bm-raven", UINT32_MAX); + memory_region_init(&s->bm, obj, "bm-raven", 4 * GiB); memory_region_init_alias(&s->bm_pci_memory_alias, obj, "bm-pci-memory", &s->pci_memory, 0, memory_region_size(&s->pci_memory)); --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974964; cv=none; d=zohomail.com; s=zohoarc; b=lxyxWEQ8bur4oAcaUGIabXQONzOlORxRsJD1lzRINMFdZteOxjDx5BIVIb/oCuhfIMPwkT24fjVFZfmV6c65nhYz2p5orL9YcI9X4FBLSHylgvwYDYeTOMEZjWw7OnqM9qxazwSfkiuz962EyFyDa5QwiAVtlYqZz7vOn7wcylo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974964; 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=rgenchyFDewl0zzAhVvbXUqfOzcRf49oDVzgaZXFxPI=; b=NvA1P/f+Y7gzzGXbYcgp2EgNqIPHRTulyALIVLBYk6UYPOTzbw721L4dvCsaxHbqRoqSOZrja1G7VBNCasTHJ0kqBDsTlaofgJsjsp+fambTk8Bn9VYvxxyP9jf3fz7i3/tVJok/2uPNkzc2JjDwUMuaTccvjhqZd2ZGeKcxfBg= 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 159197496450995.15660484185662; Fri, 12 Jun 2020 08:16:04 -0700 (PDT) Received: from localhost ([::1]:44154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlPX-0001NO-Jf for importer@patchew.org; Fri, 12 Jun 2020 11:16:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl45-0002nK-Oe for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:53:53 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:46009 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl44-0001o2-2q for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:53:53 -0400 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-361-hL0ah5JDOj2VicgLi6Km3A-1; Fri, 12 Jun 2020 10:52:41 -0400 Received: by mail-wm1-f71.google.com with SMTP id a7so2034924wmf.1 for ; Fri, 12 Jun 2020 07:52:19 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id p1sm10100562wrx.44.2020.06.12.07.52.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973631; 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=rgenchyFDewl0zzAhVvbXUqfOzcRf49oDVzgaZXFxPI=; b=ipgtZ51+bnUadDD/X334jzfsM60+nuooHUxDeRXBD81D1RtLMJ5XGzkmI6shdvOhwkDXIj DwOuE8rcx0DXqHyGBEZLPz0X1dZGgNz1gbmifmbiSOIIOG7KUvvdFQTGN7OgyLK1mpjOJp yQLsCQwgfngghqocflZnhD6ms8kapnI= X-MC-Unique: hL0ah5JDOj2VicgLi6Km3A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=rgenchyFDewl0zzAhVvbXUqfOzcRf49oDVzgaZXFxPI=; b=jiwoqAaysh3hA8rQACgb20YoDhKKH25hWl1V4QL/KN9X2lXQGiKNicRuE6pP71hmx7 a1W0B9u/ip7vE9wlkoUpfw1GGmknL0lvXaxu6EOHPfKzoxMqJJ9vdMGhWCAJQLVV0HC/ M8uwUTl6W0hfVrbfUvKltK+cIyuHd81kdyWWdG9AHb9FIxv7xmm4AeymxLNW3uWt1hKB UFneIejuQS30/2+SgCCrqcrIlig+zCumdORzrV06Qd8UBFZcTm2jy5XPaIOVLY3MToQB GT1YCkMSA4wQ/uFYLbWVpOY4lCxguk1IoqNayaBlvyYi7fevLyidNKnnmdfT//hwUTVx I9rw== X-Gm-Message-State: AOAM533FWGLA2cp0bFnkip2l3vcxzLSg9uiowV73LKuxi381CK9nXoN3 l5BDjsnkBMRzXGeEQgyc2NDSSCgjnIBu5beVdGSvQIQ/Dqk60OkMQ7N46XdPJcww4tQFgjcTbju d1MNRn0IzbdgxNFQ= X-Received: by 2002:a7b:c399:: with SMTP id s25mr14520430wmj.185.1591973533507; Fri, 12 Jun 2020 07:52:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcVSlQF2xcZ5MQrhUpr4XqDBYZpRWVrW8m3JuX22Cr7tZMbg4dgIV9kEa1JiwxmGB9pf19bQ== X-Received: by 2002:a7b:c399:: with SMTP id s25mr14520412wmj.185.1591973533322; Fri, 12 Jun 2020 07:52:13 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:11 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 31/58] hw/pci/pci_bridge: Correct pci_bridge_io memory region size Message-ID: <20200612141917.9446-32-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:17 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Richard Henderson , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 memory_region_set_size() handle the 16 Exabytes limit by special-casing the UINT64_MAX value. This is not a problem for the 32-bit maximum, 4 GiB. By using the UINT32_MAX value, the pci_bridge_io MemoryRegion ends up missing 1 byte: (qemu) info mtree memory-region: pci_bridge_io 0000000000000000-00000000fffffffe (prio 0, i/o): pci_bridge_io 0000000000000060-0000000000000060 (prio 0, i/o): i8042-data 0000000000000064-0000000000000064 (prio 0, i/o): i8042-cmd 00000000000001ce-00000000000001d1 (prio 0, i/o): vbe 0000000000000378-000000000000037f (prio 0, i/o): parallel 00000000000003b4-00000000000003b5 (prio 0, i/o): vga ... Fix by using the correct value. We now have: memory-region: pci_bridge_io 0000000000000000-00000000ffffffff (prio 0, i/o): pci_bridge_io 0000000000000060-0000000000000060 (prio 0, i/o): i8042-data 0000000000000064-0000000000000064 (prio 0, i/o): i8042-cmd ... Reviewed-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200601142930.29408-4-f4bug@amsat.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Richard Henderson --- hw/pci/pci_bridge.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c index 97967d12eb..3ba3203f72 100644 --- a/hw/pci/pci_bridge.c +++ b/hw/pci/pci_bridge.c @@ -30,6 +30,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/units.h" #include "hw/pci/pci_bridge.h" #include "hw/pci/pci_bus.h" #include "qemu/module.h" @@ -381,7 +382,7 @@ void pci_bridge_initfn(PCIDevice *dev, const char *type= name) memory_region_init(&br->address_space_mem, OBJECT(br), "pci_bridge_pci= ", UINT64_MAX); sec_bus->address_space_io =3D &br->address_space_io; memory_region_init(&br->address_space_io, OBJECT(br), "pci_bridge_io", - UINT32_MAX); + 4 * GiB); br->windows =3D pci_bridge_region_init(br); QLIST_INIT(&sec_bus->child); QLIST_INSERT_HEAD(&parent->child, sec_bus, sibling); --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591975490; cv=none; d=zohomail.com; s=zohoarc; b=XL582dNG3vQ9CElhDsdcHubMWGeqY8jQV8OA4Y/c7zw/2+PfssMVeM9pVmLKTTGh+CLpCZ9tEGriaNhm8djpnuzkjufHYzR25hfXcpGijBSLM5CBJa5C2frvI5163l5NhqPbDF1ZuYqmtumkUPfcDWsiyyAp0vgpNndyUlitc+M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591975490; 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=nvCRpjAXKNglq8ahDk7GnS4mPNv6Reg8kx+iDjbF7Mk=; b=g4qwlIWTIbRY+BLDMvaxT0+oJtytBhv8yLv2g0rFFTYjnsimPQotfxcKd7O7lTawJTkSCKkMfcKiJrY5LIX2GLio/5sD8yy5vn51uFcNqFEB2kRwpGc4Qjr8zvSq68KjZymu1Eyx2yMMjVJY3XsMdsN9DDvSL1PXLqYODmN4+4g= 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 1591975490276298.41353207524935; Fri, 12 Jun 2020 08:24:50 -0700 (PDT) Received: from localhost ([::1]:52298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlY0-0008P2-Nu for importer@patchew.org; Fri, 12 Jun 2020 11:24:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51664) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl5L-0004la-Qr for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:55:11 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:43024 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl5K-00024f-6W for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:55:11 -0400 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-197-Z6gOwRjLPk-jX-rQeytZCQ-1; Fri, 12 Jun 2020 10:52:16 -0400 Received: by mail-wm1-f71.google.com with SMTP id r1so2544768wmh.7 for ; Fri, 12 Jun 2020 07:52:16 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id j4sm10109783wma.7.2020.06.12.07.52.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973709; 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=nvCRpjAXKNglq8ahDk7GnS4mPNv6Reg8kx+iDjbF7Mk=; b=gi38VNZ2/YQUeZoTHd2Gq2dO2d5+3MjkVCNvc3/bZ+RxkT+7MniMTH0Qn4TO1c7OMn52YS qg277tLSZPSHwnIEzsibcH4WRxaceB5Mz6eXi6PEO+2SURMz2FiV6OX3coKtqGJulByvlw /Cnw9iQRzk/l6e+GsBgik47qEpFuRaE= X-MC-Unique: Z6gOwRjLPk-jX-rQeytZCQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=nvCRpjAXKNglq8ahDk7GnS4mPNv6Reg8kx+iDjbF7Mk=; b=mP4K8R4UC35TqqRsIIVOZwo1Jrk5RKlc5bUMWYLo0nSBDpMYqhMoZCq1cb4lV/upK9 7IJOA+DHCgOOZS3Ss7ZQIicB3f1kyFbgDk2utZbQr/yYwv9xcpo1PfMWKvCHV1Q8XJN4 nh8RPW6q2ZxCRoP7tCiurmo2pZTPCwLHgDOdmN40XxH1fcSy7vZ7YY32tJUi5O/6dGm5 UvLDnGk+yUnAMtItkuL1BQO4vmZeopU1MsKTjes/ZJqsc4l47p1MfAJmt/d6+wWqurIE A/zujTbtPnaxffMGoRRN/joshMHnjy+fRGYyTOZJZeyTt2/mONBJA9Ip49CFzpO8gqUF auGQ== X-Gm-Message-State: AOAM533+Nz5kB0mvds2nGLxG7smF8AkbfSohgajJU+ht/DqTxFh4B3wB Je3+SOpRwaIMF6Z9ybdUpCyLSjK5x29z/K4tYDrURiRN/f62vP+6lLhHVYotIbf/EKKOchBYI3Y JVRDX4XNO5Fokg7c= X-Received: by 2002:a05:6000:114e:: with SMTP id d14mr15050450wrx.110.1591973535485; Fri, 12 Jun 2020 07:52:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmtDwaN9rKU+LNvV0MzVfvIchwFtm/60SnVYrRVisFiJ+ASyKOW7oY3taajDa3CvXbkYkMuQ== X-Received: by 2002:a05:6000:114e:: with SMTP id d14mr15050442wrx.110.1591973535343; Fri, 12 Jun 2020 07:52:15 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:13 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 32/58] hw/pci/pci_bridge: Use the IEC binary prefix definitions Message-ID: <20200612141917.9446-33-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:00:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Richard Henderson , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 IEC binary prefixes ease code review: the unit is explicit. Reviewed-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200601142930.29408-5-f4bug@amsat.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Richard Henderson --- hw/pci/pci_bridge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c index 3ba3203f72..3789c17edc 100644 --- a/hw/pci/pci_bridge.c +++ b/hw/pci/pci_bridge.c @@ -423,14 +423,14 @@ int pci_bridge_qemu_reserve_cap_init(PCIDevice *dev, = int cap_offset, } =20 if (res_reserve.mem_non_pref !=3D (uint64_t)-1 && - res_reserve.mem_non_pref >=3D (1ULL << 32)) { + res_reserve.mem_non_pref >=3D 4 * GiB) { error_setg(errp, "PCI resource reserve cap: mem-reserve must be less tha= n 4G"); return -EINVAL; } =20 if (res_reserve.mem_pref_32 !=3D (uint64_t)-1 && - res_reserve.mem_pref_32 >=3D (1ULL << 32)) { + res_reserve.mem_pref_32 >=3D 4 * GiB) { error_setg(errp, "PCI resource reserve cap: pref32-reserve must be less= than 4G"); return -EINVAL; --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974334; cv=none; d=zohomail.com; s=zohoarc; b=hEilQwgDB3A7uSNCn3ojWx35grIoxXpet1BvRPMqn+f9wdmaq96pXjPYI++MlSemVDpk6uX+88CBITwP8if16Yg78CNo0UwxUIv8FVkJyZJgb6AkcGhnocExnYD7swyVkrFe1XCwgVU/lVwF7uKCv04CUGvuascFQH7z9WwzDbE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974334; 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=XYJWosKtNa0YrCdfi+nbmPQlsHhZsqpfDeFMOxFj1JA=; b=HsVVWfzo384FNVQpnyxW6G2E5a7D3JTAXqFkOEWGkCH/CxYcGjdt6oh1LJNRJUDTrTyxK/lal0yRkzFH34h+YRIZ9HNMsoamNtSeKamY16sjmzPpQ1JYp+R7NdANuZqGmUV9vbft8Mmm70v+8djuOBgrXbe32DZJi1YYpDxdZnI= 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 1591974334798423.82082021932047; Fri, 12 Jun 2020 08:05:34 -0700 (PDT) Received: from localhost ([::1]:57442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlFN-0005RN-Vm for importer@patchew.org; Fri, 12 Jun 2020 11:05:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl2d-0007Zz-BB for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:23 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:35597 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl2b-0001Um-IB for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:23 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-289-mWhjM3pVNrabT2no1CwXkQ-1; Fri, 12 Jun 2020 10:52:19 -0400 Received: by mail-wm1-f72.google.com with SMTP id t145so2546280wmt.2 for ; Fri, 12 Jun 2020 07:52:19 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id k64sm9481743wmf.34.2020.06.12.07.52.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973540; 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=XYJWosKtNa0YrCdfi+nbmPQlsHhZsqpfDeFMOxFj1JA=; b=WewJJ9+QoRES2Me9JANlanMZRywQo8/4+PscGEi8djqwzAftNf5ksz/88ql36iG0UEk9Jb JmVPnLaJIzyTJS11eB+F026XyIYtFlSgJm2rgRuDvGVqYmv6K7FWq5wtHgcvumeInw+aQY /7Ubx1VHMSFfXWsgKNrDQCo2HEpNQxw= X-MC-Unique: mWhjM3pVNrabT2no1CwXkQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=XYJWosKtNa0YrCdfi+nbmPQlsHhZsqpfDeFMOxFj1JA=; b=k2uijgiO4oFzoG6p+0iwqGFXxB0v8LCUWC8UrjyWl6e9Y4wF/SbYfyHQSbVlerJ/0d SiKVAcXrsIO7hlvQHw1a1Cl7sm3ux0RN7xRobjkd7mTBLuN5mh6HoU4NeayvROalXCur HJFR5c8L6tx6YA9gZJ7yIPb/f23eVi5TUyXQ92ijvomZNMmuDr3fuJ2C+9Qsse5f1tQP PY1kiVaRS6cwWSAES6W3gfq0BCriG18/ZvFGipODorqv4DutaP41TqGokeZ+PJ6gp+nk 7aUzLTKsYBl3Ss+GwlO2zn8T87jDiEZCXifvnmqPneKx/qXsQ4c8br85uiAuHxLKN9qN iC9g== X-Gm-Message-State: AOAM531l95cZlv0KoGqbJRrua4/TDVpYF6qp2h7WHokbl93EgvbZawvQ KbXc0F1VGEvBy5UsUOX85TcRYivR9GjGcy46QKvnrS0zAz0MieR7Nv6T9m/VqybFf6AM4fZfyWt 5+GnK2Mbb8ghFMhk= X-Received: by 2002:adf:fc4e:: with SMTP id e14mr15313516wrs.348.1591973537895; Fri, 12 Jun 2020 07:52:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzR0j3QgiKw9ix9SXDk1SqR2xOa3qiy/u2bEGSFuXXqKMvXpTcEf/zzWvP/yEizLNKjqqwHQ== X-Received: by 2002:adf:fc4e:: with SMTP id e14mr15313498wrs.348.1591973537689; Fri, 12 Jun 2020 07:52:17 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:15 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 33/58] hw/pci-host: Use the IEC binary prefix definitions Message-ID: <20200612141917.9446-34-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:17 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org, Richard Henderson , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 IEC binary prefixes ease code review: the unit is explicit. Reviewed-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200601142930.29408-6-f4bug@amsat.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Richard Henderson --- hw/pci-host/i440fx.c | 3 ++- hw/pci-host/q35.c | 2 +- hw/pci-host/versatile.c | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 0adbd77553..aefb416c8f 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -23,6 +23,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/units.h" #include "qemu/range.h" #include "hw/i386/pc.h" #include "hw/pci/pci.h" @@ -301,7 +302,7 @@ PCIBus *i440fx_init(const char *host_type, const char *= pci_type, memory_region_set_enabled(&f->smram_region, true); =20 /* smram, as seen by SMM CPUs */ - memory_region_init(&f->smram, OBJECT(d), "smram", 1ull << 32); + memory_region_init(&f->smram, OBJECT(d), "smram", 4 * GiB); memory_region_set_enabled(&f->smram, true); memory_region_init_alias(&f->low_smram, OBJECT(d), "smram-low", f->ram_memory, 0xa0000, 0x20000); diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index 352aeecfa7..b788f17b2c 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -589,7 +589,7 @@ static void mch_realize(PCIDevice *d, Error **errp) memory_region_set_enabled(&mch->open_high_smram, false); =20 /* smram, as seen by SMM CPUs */ - memory_region_init(&mch->smram, OBJECT(mch), "smram", 1ull << 32); + memory_region_init(&mch->smram, OBJECT(mch), "smram", 4 * GiB); memory_region_set_enabled(&mch->smram, true); memory_region_init_alias(&mch->low_smram, OBJECT(mch), "smram-low", mch->ram_memory, MCH_HOST_BRIDGE_SMRAM_C_BASE, diff --git a/hw/pci-host/versatile.c b/hw/pci-host/versatile.c index cfb9a78ea6..8ddfb8772a 100644 --- a/hw/pci-host/versatile.c +++ b/hw/pci-host/versatile.c @@ -8,6 +8,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/units.h" #include "hw/sysbus.h" #include "migration/vmstate.h" #include "hw/irq.h" @@ -399,8 +400,8 @@ static void pci_vpb_realize(DeviceState *dev, Error **e= rrp) pci_map_irq_fn mapfn; int i; =20 - memory_region_init(&s->pci_io_space, OBJECT(s), "pci_io", 1ULL << 32); - memory_region_init(&s->pci_mem_space, OBJECT(s), "pci_mem", 1ULL << 32= ); + memory_region_init(&s->pci_io_space, OBJECT(s), "pci_io", 4 * GiB); + memory_region_init(&s->pci_mem_space, OBJECT(s), "pci_mem", 4 * GiB); =20 pci_root_bus_new_inplace(&s->pci_bus, sizeof(s->pci_bus), dev, "pci", &s->pci_mem_space, &s->pci_io_space, --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974536; cv=none; d=zohomail.com; s=zohoarc; b=FJfBvVTE9ngDKg2dZFCZ9XWyN0JpexQ0I9b8J8T8Jj0QvbcvNMobQo/K5mvXDzOjws3N4zgam7/9whOpPfsYqBFPYRbKvfqaCPTTFWYHQX9LwhwnDmiNcwMIafzOxMvBWRmUIOrWumLMUZWOo/TJ81BkUSvKP2FYUTyqJ5qGfUA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974536; 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=gdv4ziay2Sv+upSlMJ3KLdxkcpgWNHmqMtF1sz11Yck=; b=QNRLgXjmFqwaJpCZRXYpZEWDFtCt8vu6tkndnwOlRdqk0DMS7BAiI7BxAS9kKNO+TqFjt3cnbh8mJxfvGzyB2K1upePjVeDG7YguFsSTkUoVS/+sNrtCOAH/lD1M/zXJnxkfrOLHQ/ZCsoEymuPK/vO67QpiC31tPFglM3o5Iiw= 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 159197453607382.8143979622514; Fri, 12 Jun 2020 08:08:56 -0700 (PDT) Received: from localhost ([::1]:43010 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlIc-0003ed-V7 for importer@patchew.org; Fri, 12 Jun 2020 11:08:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50246) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl2k-0007mw-9R for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:30 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:45560 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl2e-0001V8-1f for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:28 -0400 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-42-62RR6lLdMKulMVoeJwd7Hw-1; Fri, 12 Jun 2020 10:52:21 -0400 Received: by mail-wr1-f69.google.com with SMTP id c14so3979861wrm.15 for ; Fri, 12 Jun 2020 07:52:21 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id h7sm9538585wml.24.2020.06.12.07.52.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973543; 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=gdv4ziay2Sv+upSlMJ3KLdxkcpgWNHmqMtF1sz11Yck=; b=CjDxo3/9XIXiiHkt8E89bLgWmoz88+gsd+1Ogsf2Sd8AmXTETxeywmDgISV8Ku10fI8d6C CH1vvBz4d5PdA9YLfdbvhAdk6bI6cshDbfL2NYNCdedwOTmS21oAWQJg1ohe53My6/9+e6 jQ9TtRnZi5Mti1uywxK6ZP30C1/5G3g= X-MC-Unique: 62RR6lLdMKulMVoeJwd7Hw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=gdv4ziay2Sv+upSlMJ3KLdxkcpgWNHmqMtF1sz11Yck=; b=BcD1kMfusj33cHpfFWtCorpkY+m1tWbD/p5BcbvVZXdBuqfVrDr0Xk415ib3V4UoHk DodRMMfEKtn6rsYUYPgItZrHEoBA4vTGpQHtEZe9AtFRh6IW4jCkzJko02lUtBphuKDW OyTLKgrXRdNPGZXQfpxhsSb0DzG7fCJ6R+u7NBwGP4HNXxW2D/DcDVeyNcZi8IqRrPom uY6hPg8jOYtq8roGRCSCu3D21b3Si6t5k/X6gZmeDNtU/KZIx2laeH0xurww5tIvZBba 7FMJajwcamTAi4hdnW0BSQio0vjmxaKcv5qP/v/flqOf7iBoK/L3hotH64tMbbu2tqE+ 20zQ== X-Gm-Message-State: AOAM533fA6VcJtzoyt5R60wmJTUVmwIWOHAUKSDsBuepoZrH1Zi3zdYS GwOuc1Rxou3W0lDrHUVnCMzxhWiLMUHkQynyyXkb61RFzKVGPUWybexK6UEBe3jg/KDkS0rVCki agwT84ZcrQRyfxBw= X-Received: by 2002:a05:6000:1292:: with SMTP id f18mr15674956wrx.208.1591973539968; Fri, 12 Jun 2020 07:52:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwa5mcffTMaSnGZF6/zS88N0NN3r1kHzKXVGkv+XnWyPrHtbcaazC5JvlYUqrFc6fessnR9EA== X-Received: by 2002:a05:6000:1292:: with SMTP id f18mr15674948wrx.208.1591973539752; Fri, 12 Jun 2020 07:52:19 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:18 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 34/58] char-socket: return -1 in case of disconnect during tcp_chr_write Message-ID: <20200612141917.9446-35-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 09:30:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Paolo Bonzini , Dima Stepanov , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Dima Stepanov During testing of the vhost-user-blk reconnect functionality the qemu SIGSEGV was triggered: start qemu as: x86_64-softmmu/qemu-system-x86_64 -m 1024M -M q35 \ -object memory-backend-file,id=3Dram-node0,size=3D1024M,mem-path=3D/dev/= shm/qemu,share=3Don \ -numa node,cpus=3D0,memdev=3Dram-node0 \ -chardev socket,id=3Dchardev0,path=3D./vhost.sock,noserver,reconnect=3D1= \ -device vhost-user-blk-pci,chardev=3Dchardev0,num-queues=3D4 --enable-kvm start vhost-user-blk daemon: ./vhost-user-blk -s ./vhost.sock -b test-img.raw If vhost-user-blk will be killed during the vhost initialization process, for instance after getting VHOST_SET_VRING_CALL command, then QEMU will fail with the following backtrace: Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault. 0x00005555559272bb in vhost_user_read (dev=3D0x7fffef2d53e0, msg=3D0x7fffff= ffd5b0) at ./hw/virtio/vhost-user.c:260 260 CharBackend *chr =3D u->user->chr; #0 0x00005555559272bb in vhost_user_read (dev=3D0x7fffef2d53e0, msg=3D0x7= fffffffd5b0) at ./hw/virtio/vhost-user.c:260 #1 0x000055555592acb8 in vhost_user_get_config (dev=3D0x7fffef2d53e0, con= fig=3D0x7fffef2d5394 "", config_len=3D60) at ./hw/virtio/vhost-user.c:1645 #2 0x0000555555925525 in vhost_dev_get_config (hdev=3D0x7fffef2d53e0, con= fig=3D0x7fffef2d5394 "", config_len=3D60) at ./hw/virtio/vhost.c:1490 #3 0x00005555558cc46b in vhost_user_blk_device_realize (dev=3D0x7fffef2d5= 1a0, errp=3D0x7fffffffd8f0) at ./hw/block/vhost-user-blk.c:429 #4 0x0000555555920090 in virtio_device_realize (dev=3D0x7fffef2d51a0, err= p=3D0x7fffffffd948) at ./hw/virtio/virtio.c:3615 #5 0x0000555555a9779c in device_set_realized (obj=3D0x7fffef2d51a0, value= =3Dtrue, errp=3D0x7fffffffdb88) at ./hw/core/qdev.c:891 ... The problem is that vhost_user_write doesn't get an error after disconnect and try to call vhost_user_read(). The tcp_chr_write() routine should return -1 in case of disconnect. Indicate the EIO error if this routine is called in the disconnected state. Signed-off-by: Dima Stepanov Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- chardev/char-socket.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/chardev/char-socket.c b/chardev/char-socket.c index db253d4024..18e762643b 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -175,15 +175,16 @@ static int tcp_chr_write(Chardev *chr, const uint8_t = *buf, int len) =20 if (ret < 0 && errno !=3D EAGAIN) { if (tcp_chr_read_poll(chr) <=3D 0) { + /* Perform disconnect and return error. */ tcp_chr_disconnect_locked(chr); - return len; } /* else let the read handler finish it properly */ } =20 return ret; } else { - /* XXX: indicate an error ? */ - return len; + /* Indicate an error. */ + errno =3D EIO; + return -1; } } =20 --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974665; cv=none; d=zohomail.com; s=zohoarc; b=CSx1kLB9yBgtAV5wyhnaumVki45Q35WgB4I8/BqcijI5hmf4eRBRmwrup3gVNH6LRm36qwb+dOd9PHGYHRUBSUL1LbFaTOvBRUuMa5LFrzgvrcvWYWgaEFeFvEaIjA+mAdN4oTDglWobTPoi40zaySq2LLDjJ7GK9G727FhMuz8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974665; h=Content-Type: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=2NYIzPHnTVGrlqldKcyFGJ1nv5lf4gt4t0AfJyHtJ8o=; b=SEO9jOXIHBAjaQ8pNchbM785Fk/PAMy9nkaAf2Z74HWpoQhw9w60TPz3gPtVvEMwHILo7sHAuTc+MqcLI8yH4nkyAcQjaUIagdoA1NoMG0XMZMgL4pHPDwyJAiDYt8NjcMF03sC4OZBz0cWkHTCxfzrEp1YaBcIW05NczuYwbWE= 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 1591974665125538.8098922341817; Fri, 12 Jun 2020 08:11:05 -0700 (PDT) Received: from localhost ([::1]:51496 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlKi-0007mV-7w for importer@patchew.org; Fri, 12 Jun 2020 11:11:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50270) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl2l-0007sS-On for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:31 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:40439 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl2i-0001VK-W8 for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:31 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-96-seLpiYVpNAytrCL_fMpiqA-1; Fri, 12 Jun 2020 10:52:23 -0400 Received: by mail-wm1-f72.google.com with SMTP id p24so2548420wmc.1 for ; Fri, 12 Jun 2020 07:52:23 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id b143sm2517331wme.20.2020.06.12.07.52.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973545; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2NYIzPHnTVGrlqldKcyFGJ1nv5lf4gt4t0AfJyHtJ8o=; b=DMKj2MSmMr5fonhFApprERq2R+8PTkdBv9L+Msx74P5OJRbfku6zEKXjpmNerz3n31KR9A BnsPz6Cyq/M52D6Elmntm8VAhcAhaQ/0R/Te+kHhZYYjKFHCOKGAjbOImVpX3gK/rdxRz6 Y3+uy6VeSlEIcOZmhpqMjt2/goohRGQ= X-MC-Unique: seLpiYVpNAytrCL_fMpiqA-1 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=2NYIzPHnTVGrlqldKcyFGJ1nv5lf4gt4t0AfJyHtJ8o=; b=Hs+oZvkGzas7f/KPerBZDQbkxoeFm1K5CkqvobB/li0gs9VAuePP4HFDEucgoFPa4a ZtXtPqdPTIXSSV9hnH8SDH7DNXR8biYh8C+OMylJVNOc41QRcWDZRXfuqp8Slb6wLSKJ x33vEJl5JnZAxJEqliLoXbeVKyR7AfH1z7rBqUEk3oscjRlmsqCzQtp3gZbusZ3b6acp BOr8J4CWUYkKfq1SLMEVc/aqvGMF23gQpB4KAcSrlpCsTP25IXM1zqDE7HEYbA1eSgGO 3NCnZmbD/DVlALiaVDwCEdE0Sp646wW+RLA+KM/DPfkLKgbJ/gCi0EHkYzWuyr/tIxNQ xCWA== X-Gm-Message-State: AOAM531NGW4UJPzHWLdIRDqBcKXQTG5aepOci5bjwIlAmCpyJbynlCjh cOqmGLIDxHzZiCyGL2BiX7gy8SWK9pFVnUJT7c4sSD+5lavuBI/k0Np8o465DNFB6s8Y2Hckrde gyBGDtjoszrRyAgw= X-Received: by 2002:adf:e648:: with SMTP id b8mr15826950wrn.386.1591973542122; Fri, 12 Jun 2020 07:52:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCDx1fHgDc1mCeQmadSyBuNd/uapgEOinEMnmT8jOJCIR0b9tGEH4tCe/IEBKoSdyz64VrFg== X-Received: by 2002:adf:e648:: with SMTP id b8mr15826931wrn.386.1591973541943; Fri, 12 Jun 2020 07:52:21 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:20 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 35/58] vhost-user-blk: delay vhost_user_blk_disconnect Message-ID: <20200612141917.9446-36-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:00:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-block@nongnu.org, Max Reitz , Li Feng , Raphael Norwitz , Dima Stepanov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Dima Stepanov A socket write during vhost-user communication may trigger a disconnect event, calling vhost_user_blk_disconnect() and clearing all the vhost_dev structures holding data that vhost-user functions expect to remain valid to roll back initialization correctly. Delay the cleanup to keep vhost_dev structure valid. There are two possible states to handle: 1. RUN_STATE_PRELAUNCH: skip bh oneshot call and perform disconnect in the caller routine. 2. RUN_STATE_RUNNING: delay by using bh BH changes are based on the similar changes for the vhost-user-net device: commit e7c83a885f865128ae3cf1946f8cb538b63cbfba "vhost-user: delay vhost_user_stop" Signed-off-by: Dima Stepanov Message-Id: <69b73b94dcd066065595266c852810e0863a0895.1590396396.git.dimast= ep@yandex-team.ru> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Signed-off-by: Li Feng Reviewed-by: Raphael Norwitz --- hw/block/vhost-user-blk.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index 9d8c0b3909..76838e76d3 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -349,6 +349,19 @@ static void vhost_user_blk_disconnect(DeviceState *dev) vhost_dev_cleanup(&s->dev); } =20 +static void vhost_user_blk_event(void *opaque, QEMUChrEvent event); + +static void vhost_user_blk_chr_closed_bh(void *opaque) +{ + DeviceState *dev =3D opaque; + VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); + VHostUserBlk *s =3D VHOST_USER_BLK(vdev); + + vhost_user_blk_disconnect(dev); + qemu_chr_fe_set_handlers(&s->chardev, NULL, NULL, vhost_user_blk_event, + NULL, opaque, NULL, true); +} + static void vhost_user_blk_event(void *opaque, QEMUChrEvent event) { DeviceState *dev =3D opaque; @@ -363,7 +376,30 @@ static void vhost_user_blk_event(void *opaque, QEMUChr= Event event) } break; case CHR_EVENT_CLOSED: - vhost_user_blk_disconnect(dev); + /* + * A close event may happen during a read/write, but vhost + * code assumes the vhost_dev remains setup, so delay the + * stop & clear. There are two possible paths to hit this + * disconnect event: + * 1. When VM is in the RUN_STATE_PRELAUNCH state. The + * vhost_user_blk_device_realize() is a caller. + * 2. In tha main loop phase after VM start. + * + * For p2 the disconnect event will be delayed. We can't + * do the same for p1, because we are not running the loop + * at this moment. So just skip this step and perform + * disconnect in the caller function. + * + * TODO: maybe it is a good idea to make the same fix + * for other vhost-user devices. + */ + if (runstate_is_running()) { + AioContext *ctx =3D qemu_get_current_aio_context(); + + qemu_chr_fe_set_handlers(&s->chardev, NULL, NULL, NULL, NULL, + NULL, NULL, false); + aio_bh_schedule_oneshot(ctx, vhost_user_blk_chr_closed_bh, opa= que); + } break; case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974288; cv=none; d=zohomail.com; s=zohoarc; b=WuaK2+bYINpfjsMLr7RAzF/B+xt6CeG8vcHcDhGviG7odiV4yDKKa5o4yxWhN52Srpqt72bBWUGk5tz4Nzag3Z3m/5ZsOcADuwh52Jt9OkWBhZ8PUG7B6jMKTovmkm5BEb4arrBjc681zgIhTs+P5vnEAylbF03wMvUULJGe/D0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974288; 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=MPP6uVIK/72gmaaGLDDvftHafSRk3w6HEMlvs19A15A=; b=Bz7Kj1fzmZp7YnSl4Mj0zhLJtrn3QDX7K2nZdUX3UXPuGMeENnmEm2/coBLpXbB0AMVnyxA1KM1ufom91KgK/NL8hhThB/o02XcXxz9JD2Hfh3+D3mNaCg00ZB3ztJUUC3haf+QwYnFVyv/5f8YRmGAyyqE4UPkVZ/8Or+LxH1s= 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 1591974288506408.78810678565935; Fri, 12 Jun 2020 08:04:48 -0700 (PDT) Received: from localhost ([::1]:55164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlEd-0003y3-9G for importer@patchew.org; Fri, 12 Jun 2020 11:04:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50290) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl2n-0007wy-3I for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:33 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:46909 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl2k-0001VW-P9 for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:32 -0400 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-374-7_bIRhXmP7Sb27P70P2bVg-1; Fri, 12 Jun 2020 10:52:25 -0400 Received: by mail-wr1-f71.google.com with SMTP id n6so3999527wrv.6 for ; Fri, 12 Jun 2020 07:52:25 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id 88sm11331100wre.45.2020.06.12.07.52.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973548; 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=MPP6uVIK/72gmaaGLDDvftHafSRk3w6HEMlvs19A15A=; b=GjW6WUrwN5A+k0rIr7cxm2JoyVbCMhyZK+ucJsQfLe0EcNRItsZPiU04jSHTQjgmakbt/q P/dSEBBkdSXoVFKJsxG3GLqLEQGcB2v0hTZjNG7iT5XsR+f9LDuz36xhx/HzRZkI4GNru8 TGroEfsiL2DVRil4TPZJcHHkuvEuzcQ= X-MC-Unique: 7_bIRhXmP7Sb27P70P2bVg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=MPP6uVIK/72gmaaGLDDvftHafSRk3w6HEMlvs19A15A=; b=Qcz6qcsCuGO+94mcR22NxeyPHTwxBgiG0ZRMX9JcUxNCSqcMP94ZBJuY0kmpyjHJ3h h3MvYxojyKgQGKeH+4e7bMZQk6NEWnTpWJMla5wK2nF59sWwu/DhiVIY0ClWYHkdha8k Yanw2lACVLC0spF/7vqLHexSo1an2yKz+6SyKG84G062joXzVrE/mcX3WrxSo6PSM8K7 pm+jW2v7FLpiN5d2V/VSAltVxXCI8TD4X4rvzGxg+iB5lwQMhiJfDMehg9V/F4gUtwvL 08tbAAmDhTy4mUKkVTBavSzoCuENBbepiS3/btoWKhASnf1qby2Ou7iHSxuVsu6GOIkw sJ2g== X-Gm-Message-State: AOAM530UeSGDGO+VLah8XXIMzCzsYy+0zk6LQ8dCJGUhYwaZQNX1CU1H kLllRouIayNBO7CzXSXJbCkvDLzLubtg0j6+K7JY/4KXpxuBubNQKz+zXI9HzU9eoKrjVg5J3LR mi91fRa9rko/Odq8= X-Received: by 2002:a1c:4b0f:: with SMTP id y15mr14594303wma.83.1591973544077; Fri, 12 Jun 2020 07:52:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkj06rbkNWZvdnA2dEzeo38FV6ISZCTjjnH8CLOkLLrDW96lYhASXA8vDJyOEftqXCMuhPIw== X-Received: by 2002:a1c:4b0f:: with SMTP id y15mr14594282wma.83.1591973543835; Fri, 12 Jun 2020 07:52:23 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:22 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 36/58] Add helper to populate vhost-user message regions Message-ID: <20200612141917.9446-37-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:00:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Raphael Norwitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Raphael Norwitz When setting vhost-user memory tables, memory region descriptors must be copied from the vhost_dev struct to the vhost-user message. To avoid duplicating code in setting the memory tables, we should use a helper to populate this field. This change adds this helper. Signed-off-by: Raphael Norwitz Message-Id: <1588533678-23450-2-git-send-email-raphael.norwitz@nutanix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Marc-Andr=C3=A9 Lureau --- hw/virtio/vhost-user.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index ec21e8fbe8..2e0552dd74 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -407,6 +407,15 @@ static int vhost_user_set_log_base(struct vhost_dev *d= ev, uint64_t base, return 0; } =20 +static void vhost_user_fill_msg_region(VhostUserMemoryRegion *dst, + struct vhost_memory_region *src) +{ + assert(src !=3D NULL && dst !=3D NULL); + dst->userspace_addr =3D src->userspace_addr; + dst->memory_size =3D src->memory_size; + dst->guest_phys_addr =3D src->guest_phys_addr; +} + static int vhost_user_fill_set_mem_table_msg(struct vhost_user *u, struct vhost_dev *dev, VhostUserMsg *msg, @@ -417,6 +426,7 @@ static int vhost_user_fill_set_mem_table_msg(struct vho= st_user *u, ram_addr_t offset; MemoryRegion *mr; struct vhost_memory_region *reg; + VhostUserMemoryRegion region_buffer; =20 msg->hdr.request =3D VHOST_USER_SET_MEM_TABLE; =20 @@ -441,12 +451,8 @@ static int vhost_user_fill_set_mem_table_msg(struct vh= ost_user *u, error_report("Failed preparing vhost-user memory table msg= "); return -1; } - msg->payload.memory.regions[*fd_num].userspace_addr =3D - reg->userspace_addr; - msg->payload.memory.regions[*fd_num].memory_size =3D - reg->memory_size; - msg->payload.memory.regions[*fd_num].guest_phys_addr =3D - reg->guest_phys_addr; + vhost_user_fill_msg_region(®ion_buffer, reg); + msg->payload.memory.regions[*fd_num] =3D region_buffer; msg->payload.memory.regions[*fd_num].mmap_offset =3D offset; fds[(*fd_num)++] =3D fd; } else if (track_ramblocks) { --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974379; cv=none; d=zohomail.com; s=zohoarc; b=NL088dWfcECVGY8Qrh5NWS48tGUqvq5+ZpbRzGGqsQROexlTiuf/4olzNim/zXi9o0FFrxqYYF7SY/rA6QyAWlZDJxNGuIIqvHye4cpISwk/Wpk+pJxyG437yivlcfhxujH2xQwDZPHg+8KpVXqfzPW3J4lJCvd7vS/xfsGS+tQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974379; 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=3WoW/5GHRqsRNTQHlFF254BVJ0vB+TltSYwqwpwCDlQ=; b=HE5yY7SRP5RFPZA8xR/XD3qFBFFMxkWgZTD49KMIb+w9+g9BTmT5F/jNDd5LDHXOUGdDwaXckuTpETft6F0Ea4AFCLFdBKKctiNVihR/TLr6qPf58XM1R/jhRVHXH9odHKfPDbQwQtxorIGlV12g0p6VDKYQdpO0gmPv+LLd5eo= 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 1591974379714659.6792021248892; Fri, 12 Jun 2020 08:06:19 -0700 (PDT) Received: from localhost ([::1]:60910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlG6-0007GV-PP for importer@patchew.org; Fri, 12 Jun 2020 11:06:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50280) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl2m-0007uI-9H for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:32 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:22857 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl2k-0001Ve-L6 for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:31 -0400 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-187-OglCgHjMNQ6-md1eA2VVpg-1; Fri, 12 Jun 2020 10:52:27 -0400 Received: by mail-wr1-f69.google.com with SMTP id i6so3973297wrr.23 for ; Fri, 12 Jun 2020 07:52:27 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id d24sm9030077wmb.45.2020.06.12.07.52.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973549; 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=3WoW/5GHRqsRNTQHlFF254BVJ0vB+TltSYwqwpwCDlQ=; b=BdUL9nULWzAiRJXizhpE3oP2yu21zoJ/VUq6QKllZe89buoG7Rklu177hMwQjXtDeIdUXG xojXOndQsLRa4pMZeSXsCxWDZ/sDVUHFdmNFE3B2d1laBK270Qm4PjAtJrN84j1wFnAeNZ vx61uWXVQ9PzIlG/L2Awenisg9bNAdU= X-MC-Unique: OglCgHjMNQ6-md1eA2VVpg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=3WoW/5GHRqsRNTQHlFF254BVJ0vB+TltSYwqwpwCDlQ=; b=QWAM02TIgqDAlW1egoPpx0da3JL1861y+2Ktfp4RSoRgr7Lj2ypR/ZlbHxHB7lo8Mv W+G7va1q0hXLxaFs2l/ZlhVHop7MGbVsj+ITbY/TIKz7C3Bi72uChdYakWIMjq908OUY icmAUPnKDv1UlY4ou7m+e1k/IfOSp5s9kVNI6RlxXFMEbq68rGya7KeRDkLqLBTnEd+6 YzLdhw1jnTJ4U7DKaLzFEfV67M0lpOOV/uK0OccgvmehtDP1OuClVtfz9k4zpoZxvf3s xVMidY+MAqQ/4y2P0hQtuDiA6NO5Pnh1dxkG1UFlS0V8ZKNqISfCaRtiLI5X7rPfOZwK y1Mg== X-Gm-Message-State: AOAM530n+W99aM7vdf13u2GUk7XisK3oFDnqQTJc4impXBSMxg4gCpIh dHp9MXOevio2XH7XqVRtC6dAc4uTt2J1Qe9vrtf2sbIWicDAlA62Esz/KL48IMQv2JoykNUlrck /qvcp6mrqlV3OF/I= X-Received: by 2002:adf:b697:: with SMTP id j23mr16478858wre.201.1591973546032; Fri, 12 Jun 2020 07:52:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBBuhp/l7oF8mpQgRAFj2CSxb0uUngr3AF5CJIx6l+qihZ57OVYTRlSDKGAMaaNn8hSbz8bQ== X-Received: by 2002:adf:b697:: with SMTP id j23mr16478844wre.201.1591973545856; Fri, 12 Jun 2020 07:52:25 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:24 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 37/58] Add vhost-user helper to get MemoryRegion data Message-ID: <20200612141917.9446-38-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Raphael Norwitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Raphael Norwitz When setting the memory tables, qemu uses a memory region's userspace address to look up the region's MemoryRegion struct. Among other things, the MemoryRegion contains the region's offset and associated file descriptor, all of which need to be sent to the backend. With VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS, this logic will be needed in multiple places, so before feature support is added it should be moved to a helper function. This helper is also used to simplify the vhost_user_can_merge() function. Signed-off-by: Raphael Norwitz Message-Id: <1588533678-23450-3-git-send-email-raphael.norwitz@nutanix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Marc-Andr=C3=A9 Lureau --- hw/virtio/vhost-user.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 2e0552dd74..442b0d650a 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -407,6 +407,18 @@ static int vhost_user_set_log_base(struct vhost_dev *d= ev, uint64_t base, return 0; } =20 +static MemoryRegion *vhost_user_get_mr_data(uint64_t addr, ram_addr_t *off= set, + int *fd) +{ + MemoryRegion *mr; + + assert((uintptr_t)addr =3D=3D addr); + mr =3D memory_region_from_host((void *)(uintptr_t)addr, offset); + *fd =3D memory_region_get_fd(mr); + + return mr; +} + static void vhost_user_fill_msg_region(VhostUserMemoryRegion *dst, struct vhost_memory_region *src) { @@ -433,10 +445,7 @@ static int vhost_user_fill_set_mem_table_msg(struct vh= ost_user *u, for (i =3D 0; i < dev->mem->nregions; ++i) { reg =3D dev->mem->regions + i; =20 - assert((uintptr_t)reg->userspace_addr =3D=3D reg->userspace_addr); - mr =3D memory_region_from_host((void *)(uintptr_t)reg->userspace_a= ddr, - &offset); - fd =3D memory_region_get_fd(mr); + mr =3D vhost_user_get_mr_data(reg->userspace_addr, &offset, &fd); if (fd > 0) { if (track_ramblocks) { assert(*fd_num < VHOST_MEMORY_MAX_NREGIONS); @@ -1551,13 +1560,9 @@ static bool vhost_user_can_merge(struct vhost_dev *d= ev, { ram_addr_t offset; int mfd, rfd; - MemoryRegion *mr; =20 - mr =3D memory_region_from_host((void *)(uintptr_t)start1, &offset); - mfd =3D memory_region_get_fd(mr); - - mr =3D memory_region_from_host((void *)(uintptr_t)start2, &offset); - rfd =3D memory_region_get_fd(mr); + (void)vhost_user_get_mr_data(start1, &offset, &mfd); + (void)vhost_user_get_mr_data(start2, &offset, &rfd); =20 return mfd =3D=3D rfd; } --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974507; cv=none; d=zohomail.com; s=zohoarc; b=Nm/AEcT5+EmTZxPLXPpXgDoxqcfmmMXdgfycZjwEa/c0C4GdVIvGGjbhbnWdfFRip3DQ6ge+VucYBD/sYSqWc/gLTpEKta6hL2OFwtvbiEvYMFrTgHsj0lxR9cjxGBIadHOaXBz2qA6xvV20AKdoCgHLyb1Yys71OT8iu8/LowE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974507; 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=+aLUVA3adcXUxq1ShODevbUsMtd3Sih4ZUcM3DuoFkA=; b=gwNz1AWDnFjJ2+i/WcjuWCDHJsqVJJw7m9OKt2qx4OiftdFRTZwEFHHPaKTsvfY/4UGdkF+ssUkDha+0LcFxq+85H6MpsYZDTMC9IqnNwypUG0DbNdwgKOKNpbT82CeoelQPOFssFVOo0QA1zjZ9b07mx/+qOqHxPGBPheHFP/k= 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 1591974507311213.22700651832486; Fri, 12 Jun 2020 08:08:27 -0700 (PDT) Received: from localhost ([::1]:41048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlI9-0002Rf-Td for importer@patchew.org; Fri, 12 Jun 2020 11:08:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl2o-0007zz-0X for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:34 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:35627 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl2l-0001Vn-Ud for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:33 -0400 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-326-Kwtxg-LuNaq3Aa1TaDs4TA-1; Fri, 12 Jun 2020 10:52:29 -0400 Received: by mail-wr1-f69.google.com with SMTP id m14so3985652wrj.12 for ; Fri, 12 Jun 2020 07:52:29 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id e10sm10348694wrn.11.2020.06.12.07.52.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973551; 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=+aLUVA3adcXUxq1ShODevbUsMtd3Sih4ZUcM3DuoFkA=; b=ObdioC+zuZHuN2fHNPKz+4tqmMe2ZZO9kyNx716SrOAJvhp56a8/OjbwAZqm8QXC1vACdn rG1o/ThzJCBXRlJ6dwWC3zFqhDX9xhUzDzqUYuV7IruCCm02qjbv9TYMQg+LSuNxM6U8Ot 0BcGty5Y8Pov3U42uzVhaZmC7ZxmEwY= X-MC-Unique: Kwtxg-LuNaq3Aa1TaDs4TA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=+aLUVA3adcXUxq1ShODevbUsMtd3Sih4ZUcM3DuoFkA=; b=p1OKxm9SrzW1cbJVA2owQG5bM7dLZHkB3Xtz2yWtKfQg3/tndJ2vAn+KFvg6crfHhz j3/U9tynTvbnEaY31d2SfIId1MqZJ0k//vuwEp3G7BN2oWik6iOo0F73B6eLwcJrh/IK kRqV2xy8XOq97z8GO4PYMZCA45I9jsiRXE0TbaHieLedsIdxkIaXjkfBvGu/UuOxYnbE ad2JllRTQ++TeF0UwlapnWv21cc/dSGtUSgflqpM3aNvg51PN+oiJNTZuDXV3ZLOdO1V zj9L5U0gqQfQoZ9dLNMSXfJJktgeoIffSQ/22GQp2RL7IekCl6Lfm75Rd2pbb04EeNoT kSxQ== X-Gm-Message-State: AOAM5331vUsekfFu+dHNY9X08LvqwalF7CeOwWVYsCnOOc7WJLQsaLKy X6sext+kIE0R64lfopLKpA/xixRjMxBR2+PpoVFkeVqnv17l5ckJ5YAiumgv79ViepJ5SrswWKr hQCmdy1ZWygieNw4= X-Received: by 2002:adf:ab09:: with SMTP id q9mr15005450wrc.79.1591973548153; Fri, 12 Jun 2020 07:52:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcn/Utj4mwHjBsXZx3+DhKEeYYealrBacPcTwDrSaBp3dVkRfdma9HFprFzikq1AFPYkgAIw== X-Received: by 2002:adf:ab09:: with SMTP id q9mr15005429wrc.79.1591973547916; Fri, 12 Jun 2020 07:52:27 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:26 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 38/58] Add VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS Message-ID: <20200612141917.9446-39-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 09:30:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Peter Turschmid , Raphael Norwitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Raphael Norwitz This change introduces a new feature to the vhost-user protocol allowing a backend device to specify the maximum number of ram slots it supports. At this point, the value returned by the backend will be capped at the maximum number of ram slots which can be supported by vhost-user, which is currently set to 8 because of underlying protocol limitations. The returned value will be stored inside the VhostUserState struct so that on device reconnect we can verify that the ram slot limitation has not decreased since the last time the device connected. Signed-off-by: Raphael Norwitz Signed-off-by: Peter Turschmid Message-Id: <1588533678-23450-4-git-send-email-raphael.norwitz@nutanix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Marc-Andr=C3=A9 Lureau --- include/hw/virtio/vhost-user.h | 1 + hw/virtio/vhost-user.c | 49 ++++++++++++++++++++++++++++++++-- docs/interop/vhost-user.rst | 16 +++++++++++ 3 files changed, 64 insertions(+), 2 deletions(-) diff --git a/include/hw/virtio/vhost-user.h b/include/hw/virtio/vhost-user.h index 811e325f42..a9abca3288 100644 --- a/include/hw/virtio/vhost-user.h +++ b/include/hw/virtio/vhost-user.h @@ -20,6 +20,7 @@ typedef struct VhostUserHostNotifier { typedef struct VhostUserState { CharBackend *chr; VhostUserHostNotifier notifier[VIRTIO_QUEUE_MAX]; + int memory_slots; } VhostUserState; =20 bool vhost_user_init(VhostUserState *user, CharBackend *chr, Error **errp); diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 442b0d650a..754ad885cf 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -59,6 +59,8 @@ enum VhostUserProtocolFeature { VHOST_USER_PROTOCOL_F_HOST_NOTIFIER =3D 11, VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD =3D 12, VHOST_USER_PROTOCOL_F_RESET_DEVICE =3D 13, + /* Feature 14 reserved for VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS.= */ + VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS =3D 15, VHOST_USER_PROTOCOL_F_MAX }; =20 @@ -100,6 +102,8 @@ typedef enum VhostUserRequest { VHOST_USER_SET_INFLIGHT_FD =3D 32, VHOST_USER_GPU_SET_SOCKET =3D 33, VHOST_USER_RESET_DEVICE =3D 34, + /* Message number 35 reserved for VHOST_USER_VRING_KICK. */ + VHOST_USER_GET_MAX_MEM_SLOTS =3D 36, VHOST_USER_MAX } VhostUserRequest; =20 @@ -895,6 +899,23 @@ static int vhost_user_set_owner(struct vhost_dev *dev) return 0; } =20 +static int vhost_user_get_max_memslots(struct vhost_dev *dev, + uint64_t *max_memslots) +{ + uint64_t backend_max_memslots; + int err; + + err =3D vhost_user_get_u64(dev, VHOST_USER_GET_MAX_MEM_SLOTS, + &backend_max_memslots); + if (err < 0) { + return err; + } + + *max_memslots =3D backend_max_memslots; + + return 0; +} + static int vhost_user_reset_device(struct vhost_dev *dev) { VhostUserMsg msg =3D { @@ -1392,7 +1413,7 @@ static int vhost_user_postcopy_notifier(NotifierWithR= eturn *notifier, =20 static int vhost_user_backend_init(struct vhost_dev *dev, void *opaque) { - uint64_t features, protocol_features; + uint64_t features, protocol_features, ram_slots; struct vhost_user *u; int err; =20 @@ -1454,6 +1475,27 @@ static int vhost_user_backend_init(struct vhost_dev = *dev, void *opaque) "slave-req protocol features."); return -1; } + + /* get max memory regions if backend supports configurable RAM slo= ts */ + if (!virtio_has_feature(dev->protocol_features, + VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS)= ) { + u->user->memory_slots =3D VHOST_MEMORY_MAX_NREGIONS; + } else { + err =3D vhost_user_get_max_memslots(dev, &ram_slots); + if (err < 0) { + return err; + } + + if (ram_slots < u->user->memory_slots) { + error_report("The backend specified a max ram slots limit " + "of %" PRIu64", when the prior validated limi= t was %d. " + "This limit should never decrease.", ram_slot= s, + u->user->memory_slots); + return -1; + } + + u->user->memory_slots =3D MIN(ram_slots, VHOST_MEMORY_MAX_NREG= IONS); + } } =20 if (dev->migration_blocker =3D=3D NULL && @@ -1519,7 +1561,9 @@ static int vhost_user_get_vq_index(struct vhost_dev *= dev, int idx) =20 static int vhost_user_memslots_limit(struct vhost_dev *dev) { - return VHOST_MEMORY_MAX_NREGIONS; + struct vhost_user *u =3D dev->opaque; + + return u->user->memory_slots; } =20 static bool vhost_user_requires_shm_log(struct vhost_dev *dev) @@ -1904,6 +1948,7 @@ bool vhost_user_init(VhostUserState *user, CharBacken= d *chr, Error **errp) return false; } user->chr =3D chr; + user->memory_slots =3D 0; return true; } =20 diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst index 3b1b6602c7..b3cf5c3cb5 100644 --- a/docs/interop/vhost-user.rst +++ b/docs/interop/vhost-user.rst @@ -815,6 +815,7 @@ Protocol features #define VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD 12 #define VHOST_USER_PROTOCOL_F_RESET_DEVICE 13 #define VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS 14 + #define VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS 15 =20 Master message types -------------------- @@ -1263,6 +1264,21 @@ Master message types =20 The state.num field is currently reserved and must be set to 0. =20 +``VHOST_USER_GET_MAX_MEM_SLOTS`` + :id: 36 + :equivalent ioctl: N/A + :slave payload: u64 + + When the ``VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS`` protocol + feature has been successfully negotiated, this message is submitted + by master to the slave. The slave should return the message with a + u64 payload containing the maximum number of memory slots for + QEMU to expose to the guest. At this point, the value returned + by the backend will be capped at the maximum number of ram slots + which can be supported by vhost-user. Currently that limit is set + at VHOST_USER_MAX_RAM_SLOTS =3D 8 because of underlying protocol + limitations. + Slave message types ------------------- =20 --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974758; cv=none; d=zohomail.com; s=zohoarc; b=ILB3yo+41SXIVmwv/z3eZVDwYiIyywab6PsyS3+l1l5aExBX4SaZAB3qd9LPARzOrgWRJy1MsKKM7XN97rU/clctHJ+ClbbjTgSrc/utyqwcwZTU32DZfmsOybDywhTak/flrH386zO4DZIikWENqO/+LDMXedkWR2geTKXaxkQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974758; 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=jSO3UNNmFcp3vQWCnC6yM3hOuOjgPmF0S065cZCDRxA=; b=LQmHhvuaDMmcnQnf5OWQHMT8v2nYC9OqdF8LfhgojVyH+SllgTxE1KWofs/ezZwvVui58Tge/XyzAl6yXVl5U47amgxQuF7ZA/RGqfmwuuJPGfiNa/cxdF0S/SoadSp1HRPg6kUPgvj9D2k2rDSiyQutMxPDznPoPJyNx0lgYyI= 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 1591974758714467.3742411945044; Fri, 12 Jun 2020 08:12:38 -0700 (PDT) Received: from localhost ([::1]:60216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlMD-0003hK-O6 for importer@patchew.org; Fri, 12 Jun 2020 11:12:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl2t-0008Jj-U6 for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:39 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:39488 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl2q-0001Wc-Te for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:39 -0400 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-505-huaNC275MlCvcQpTZvXpZw-1; Fri, 12 Jun 2020 10:52:32 -0400 Received: by mail-wm1-f69.google.com with SMTP id x6so2546471wmj.9 for ; Fri, 12 Jun 2020 07:52:32 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id g3sm11411101wrb.46.2020.06.12.07.52.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973556; 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=jSO3UNNmFcp3vQWCnC6yM3hOuOjgPmF0S065cZCDRxA=; b=L7W3qVqp3mZ0EVltvSG16QIKSh7kNhsKBDyJJs7OxI9roMuSKZ2Egjc8pXuIoAtVaBYaPS CFHWrSBL5eeYPtOqw/Y6ksGR73uXLWg5cPnYcSZL8ue9+dOSpPfylFdub33zTYV1mVI0su Qw6BOaAYRpl1745dIGYVCZr48J8x6Zs= X-MC-Unique: huaNC275MlCvcQpTZvXpZw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=jSO3UNNmFcp3vQWCnC6yM3hOuOjgPmF0S065cZCDRxA=; b=sB2sk8tBFpSskO2lD3k0WXUIovU+MXZV9fqRgW0tIzoWkSY2eUoNCekg1+BVh/PgM5 64ujrGPu7NOdMIodIAfSENdjyLGmi+RR1oSCkmJIMgHNAlf/8ZrERc2WZD9aSPUG9uFb nElg3nEx+WStioFLgeAPhsCVkIlF7DwTOXKMZ9vWAhTCy5IVxhgzF+ZFsghsKNiQMqIc AL9iqGIuLv3GDcs2C1i53OVLHsJL3T8HFstYM/vKjK6OxzqUJhGmZ3M9AAvfjE+nkFPR UcXtDZ8BGhevb5YQ63+dsHr7LLkZOGOk6haRlWYaN6WWXsOHYnOBKL2SpFzOOaP9JuPy Ab/Q== X-Gm-Message-State: AOAM531a9nFFpShtKuRrYD2ZdMxbtKv/XThJFVCYm02vpG5FHTYpDE+4 WHEXf7himVumtOehCtxrcLcTzxCmDbwSjTZZiCfwu4sR1LixRRos9EQiXalRMj3aKJk2wRkhtDe LngaKC+pGI7s1Cp8= X-Received: by 2002:adf:d84a:: with SMTP id k10mr15180269wrl.336.1591973550804; Fri, 12 Jun 2020 07:52:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRhPlwZnn6ZQCCjEboiKHODWGgD9cRxRUOt7pbdK2KZBa4UMdgP5b6Sk8irDeAFIsmVujagw== X-Received: by 2002:adf:d84a:: with SMTP id k10mr15180226wrl.336.1591973550223; Fri, 12 Jun 2020 07:52:30 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:28 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 39/58] Transmit vhost-user memory regions individually Message-ID: <20200612141917.9446-40-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mike Cui , Peter Maydell , Swapnil Ingle , Peter Turschmid , Raphael Norwitz , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Raphael Norwitz With this change, when the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS protocol feature has been negotiated, Qemu no longer sends the backend all the memory regions in a single message. Rather, when the memory tables are set or updated, a series of VHOST_USER_ADD_MEM_REG and VHOST_USER_REM_MEM_REG messages are sent to transmit the regions to map and/or unmap instead of sending send all the regions in one fixed size VHOST_USER_SET_MEM_TABLE message. The vhost_user struct maintains a shadow state of the VM=E2=80=99s memory regions. When the memory tables are modified, the vhost_user_set_mem_table() function compares the new device memory state to the shadow state and only sends regions which need to be unmapped or mapped in. The regions which must be unmapped are sent first, followed by the new regions to be mapped in. After all the messages have been sent, the shadow state is set to the current virtual device state. Existing backends which do not support VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS are unaffected. Signed-off-by: Raphael Norwitz Signed-off-by: Swapnil Ingle Signed-off-by: Peter Turschmid Suggested-by: Mike Cui Message-Id: <1588533678-23450-5-git-send-email-raphael.norwitz@nutanix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Acked-by: Marc-Andr=C3=A9 Lureau --- hw/virtio/vhost-user.c | 516 ++++++++++++++++++++++++++++++------ docs/interop/vhost-user.rst | 33 ++- 2 files changed, 472 insertions(+), 77 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 754ad885cf..3640f017a2 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -104,6 +104,8 @@ typedef enum VhostUserRequest { VHOST_USER_RESET_DEVICE =3D 34, /* Message number 35 reserved for VHOST_USER_VRING_KICK. */ VHOST_USER_GET_MAX_MEM_SLOTS =3D 36, + VHOST_USER_ADD_MEM_REG =3D 37, + VHOST_USER_REM_MEM_REG =3D 38, VHOST_USER_MAX } VhostUserRequest; =20 @@ -128,6 +130,11 @@ typedef struct VhostUserMemory { VhostUserMemoryRegion regions[VHOST_MEMORY_MAX_NREGIONS]; } VhostUserMemory; =20 +typedef struct VhostUserMemRegMsg { + uint32_t padding; + VhostUserMemoryRegion region; +} VhostUserMemRegMsg; + typedef struct VhostUserLog { uint64_t mmap_size; uint64_t mmap_offset; @@ -186,6 +193,7 @@ typedef union { struct vhost_vring_state state; struct vhost_vring_addr addr; VhostUserMemory memory; + VhostUserMemRegMsg mem_reg; VhostUserLog log; struct vhost_iotlb_msg iotlb; VhostUserConfig config; @@ -226,6 +234,16 @@ struct vhost_user { =20 /* True once we've entered postcopy_listen */ bool postcopy_listen; + + /* Our current regions */ + int num_shadow_regions; + struct vhost_memory_region shadow_regions[VHOST_MEMORY_MAX_NREGIONS]; +}; + +struct scrub_regions { + struct vhost_memory_region *region; + int reg_idx; + int fd_idx; }; =20 static bool ioeventfd_enabled(void) @@ -489,8 +507,332 @@ static int vhost_user_fill_set_mem_table_msg(struct v= host_user *u, return 1; } =20 +static inline bool reg_equal(struct vhost_memory_region *shadow_reg, + struct vhost_memory_region *vdev_reg) +{ + return shadow_reg->guest_phys_addr =3D=3D vdev_reg->guest_phys_addr && + shadow_reg->userspace_addr =3D=3D vdev_reg->userspace_addr && + shadow_reg->memory_size =3D=3D vdev_reg->memory_size; +} + +static void scrub_shadow_regions(struct vhost_dev *dev, + struct scrub_regions *add_reg, + int *nr_add_reg, + struct scrub_regions *rem_reg, + int *nr_rem_reg, uint64_t *shadow_pcb, + bool track_ramblocks) +{ + struct vhost_user *u =3D dev->opaque; + bool found[VHOST_MEMORY_MAX_NREGIONS] =3D {}; + struct vhost_memory_region *reg, *shadow_reg; + int i, j, fd, add_idx =3D 0, rm_idx =3D 0, fd_num =3D 0; + ram_addr_t offset; + MemoryRegion *mr; + bool matching; + + /* + * Find memory regions present in our shadow state which are not in + * the device's current memory state. + * + * Mark regions in both the shadow and device state as "found". + */ + for (i =3D 0; i < u->num_shadow_regions; i++) { + shadow_reg =3D &u->shadow_regions[i]; + matching =3D false; + + for (j =3D 0; j < dev->mem->nregions; j++) { + reg =3D &dev->mem->regions[j]; + + mr =3D vhost_user_get_mr_data(reg->userspace_addr, &offset, &f= d); + + if (reg_equal(shadow_reg, reg)) { + matching =3D true; + found[j] =3D true; + if (track_ramblocks) { + /* + * Reset postcopy client bases, region_rb, and + * region_rb_offset in case regions are removed. + */ + if (fd > 0) { + u->region_rb_offset[j] =3D offset; + u->region_rb[j] =3D mr->ram_block; + shadow_pcb[j] =3D u->postcopy_client_bases[i]; + } else { + u->region_rb_offset[j] =3D 0; + u->region_rb[j] =3D NULL; + } + } + break; + } + } + + /* + * If the region was not found in the current device memory state + * create an entry for it in the removed list. + */ + if (!matching) { + rem_reg[rm_idx].region =3D shadow_reg; + rem_reg[rm_idx++].reg_idx =3D i; + } + } + + /* + * For regions not marked "found", create entries in the added list. + * + * Note their indexes in the device memory state and the indexes of th= eir + * file descriptors. + */ + for (i =3D 0; i < dev->mem->nregions; i++) { + reg =3D &dev->mem->regions[i]; + mr =3D vhost_user_get_mr_data(reg->userspace_addr, &offset, &fd); + if (fd > 0) { + ++fd_num; + } + + /* + * If the region was in both the shadow and device state we don't + * need to send a VHOST_USER_ADD_MEM_REG message for it. + */ + if (found[i]) { + continue; + } + + add_reg[add_idx].region =3D reg; + add_reg[add_idx].reg_idx =3D i; + add_reg[add_idx++].fd_idx =3D fd_num; + } + *nr_rem_reg =3D rm_idx; + *nr_add_reg =3D add_idx; + + return; +} + +static int send_remove_regions(struct vhost_dev *dev, + struct scrub_regions *remove_reg, + int nr_rem_reg, VhostUserMsg *msg, + bool reply_supported) +{ + struct vhost_user *u =3D dev->opaque; + struct vhost_memory_region *shadow_reg; + int i, fd, shadow_reg_idx, ret; + ram_addr_t offset; + VhostUserMemoryRegion region_buffer; + + /* + * The regions in remove_reg appear in the same order they do in the + * shadow table. Therefore we can minimize memory copies by iterating + * through remove_reg backwards. + */ + for (i =3D nr_rem_reg - 1; i >=3D 0; i--) { + shadow_reg =3D remove_reg[i].region; + shadow_reg_idx =3D remove_reg[i].reg_idx; + + vhost_user_get_mr_data(shadow_reg->userspace_addr, &offset, &fd); + + if (fd > 0) { + msg->hdr.request =3D VHOST_USER_REM_MEM_REG; + vhost_user_fill_msg_region(®ion_buffer, shadow_reg); + msg->payload.mem_reg.region =3D region_buffer; + + if (vhost_user_write(dev, msg, &fd, 1) < 0) { + return -1; + } + + if (reply_supported) { + ret =3D process_message_reply(dev, msg); + if (ret) { + return ret; + } + } + } + + /* + * At this point we know the backend has unmapped the region. It i= s now + * safe to remove it from the shadow table. + */ + memmove(&u->shadow_regions[shadow_reg_idx], + &u->shadow_regions[shadow_reg_idx + 1], + sizeof(struct vhost_memory_region) * + (u->num_shadow_regions - shadow_reg_idx)); + u->num_shadow_regions--; + } + + return 0; +} + +static int send_add_regions(struct vhost_dev *dev, + struct scrub_regions *add_reg, int nr_add_reg, + VhostUserMsg *msg, uint64_t *shadow_pcb, + bool reply_supported, bool track_ramblocks) +{ + struct vhost_user *u =3D dev->opaque; + int i, fd, ret, reg_idx, reg_fd_idx; + struct vhost_memory_region *reg; + MemoryRegion *mr; + ram_addr_t offset; + VhostUserMsg msg_reply; + VhostUserMemoryRegion region_buffer; + + for (i =3D 0; i < nr_add_reg; i++) { + reg =3D add_reg[i].region; + reg_idx =3D add_reg[i].reg_idx; + reg_fd_idx =3D add_reg[i].fd_idx; + + mr =3D vhost_user_get_mr_data(reg->userspace_addr, &offset, &fd); + + if (fd > 0) { + if (track_ramblocks) { + trace_vhost_user_set_mem_table_withfd(reg_fd_idx, mr->name, + reg->memory_size, + reg->guest_phys_addr, + reg->userspace_addr, + offset); + u->region_rb_offset[reg_idx] =3D offset; + u->region_rb[reg_idx] =3D mr->ram_block; + } + msg->hdr.request =3D VHOST_USER_ADD_MEM_REG; + vhost_user_fill_msg_region(®ion_buffer, reg); + msg->payload.mem_reg.region =3D region_buffer; + msg->payload.mem_reg.region.mmap_offset =3D offset; + + if (vhost_user_write(dev, msg, &fd, 1) < 0) { + return -1; + } + + if (track_ramblocks) { + uint64_t reply_gpa; + + if (vhost_user_read(dev, &msg_reply) < 0) { + return -1; + } + + reply_gpa =3D msg_reply.payload.mem_reg.region.guest_phys_= addr; + + if (msg_reply.hdr.request !=3D VHOST_USER_ADD_MEM_REG) { + error_report("%s: Received unexpected msg type." + "Expected %d received %d", __func__, + VHOST_USER_ADD_MEM_REG, + msg_reply.hdr.request); + return -1; + } + + /* + * We're using the same structure, just reusing one of the + * fields, so it should be the same size. + */ + if (msg_reply.hdr.size !=3D msg->hdr.size) { + error_report("%s: Unexpected size for postcopy reply " + "%d vs %d", __func__, msg_reply.hdr.size, + msg->hdr.size); + return -1; + } + + /* Get the postcopy client base from the backend's reply. = */ + if (reply_gpa =3D=3D dev->mem->regions[reg_idx].guest_phys= _addr) { + shadow_pcb[reg_idx] =3D + msg_reply.payload.mem_reg.region.userspace_addr; + trace_vhost_user_set_mem_table_postcopy( + msg_reply.payload.mem_reg.region.userspace_addr, + msg->payload.mem_reg.region.userspace_addr, + reg_fd_idx, reg_idx); + } else { + error_report("%s: invalid postcopy reply for region. " + "Got guest physical address %" PRIX64 ", = expected " + "%" PRIX64, __func__, reply_gpa, + dev->mem->regions[reg_idx].guest_phys_add= r); + return -1; + } + } else if (reply_supported) { + ret =3D process_message_reply(dev, msg); + if (ret) { + return ret; + } + } + } else if (track_ramblocks) { + u->region_rb_offset[reg_idx] =3D 0; + u->region_rb[reg_idx] =3D NULL; + } + + /* + * At this point, we know the backend has mapped in the new + * region, if the region has a valid file descriptor. + * + * The region should now be added to the shadow table. + */ + u->shadow_regions[u->num_shadow_regions].guest_phys_addr =3D + reg->guest_phys_addr; + u->shadow_regions[u->num_shadow_regions].userspace_addr =3D + reg->userspace_addr; + u->shadow_regions[u->num_shadow_regions].memory_size =3D + reg->memory_size; + u->num_shadow_regions++; + } + + return 0; +} + +static int vhost_user_add_remove_regions(struct vhost_dev *dev, + VhostUserMsg *msg, + bool reply_supported, + bool track_ramblocks) +{ + struct vhost_user *u =3D dev->opaque; + struct scrub_regions add_reg[VHOST_MEMORY_MAX_NREGIONS]; + struct scrub_regions rem_reg[VHOST_MEMORY_MAX_NREGIONS]; + uint64_t shadow_pcb[VHOST_MEMORY_MAX_NREGIONS] =3D {}; + int nr_add_reg, nr_rem_reg; + + msg->hdr.size =3D sizeof(msg->payload.mem_reg.padding) + + sizeof(VhostUserMemoryRegion); + + /* Find the regions which need to be removed or added. */ + scrub_shadow_regions(dev, add_reg, &nr_add_reg, rem_reg, &nr_rem_reg, + shadow_pcb, track_ramblocks); + + if (nr_rem_reg && send_remove_regions(dev, rem_reg, nr_rem_reg, msg, + reply_supported) < 0) + { + goto err; + } + + if (nr_add_reg && send_add_regions(dev, add_reg, nr_add_reg, msg, + shadow_pcb, reply_supported, track_ramblocks) < 0) + { + goto err; + } + + if (track_ramblocks) { + memcpy(u->postcopy_client_bases, shadow_pcb, + sizeof(uint64_t) * VHOST_MEMORY_MAX_NREGIONS); + /* + * Now we've registered this with the postcopy code, we ack to the + * client, because now we're in the position to be able to deal wi= th + * any faults it generates. + */ + /* TODO: Use this for failure cases as well with a bad value. */ + msg->hdr.size =3D sizeof(msg->payload.u64); + msg->payload.u64 =3D 0; /* OK */ + + if (vhost_user_write(dev, msg, NULL, 0) < 0) { + return -1; + } + } + + return 0; + +err: + if (track_ramblocks) { + memcpy(u->postcopy_client_bases, shadow_pcb, + sizeof(uint64_t) * VHOST_MEMORY_MAX_NREGIONS); + } + + return -1; +} + static int vhost_user_set_mem_table_postcopy(struct vhost_dev *dev, - struct vhost_memory *mem) + struct vhost_memory *mem, + bool reply_supported, + bool config_mem_slots) { struct vhost_user *u =3D dev->opaque; int fds[VHOST_MEMORY_MAX_NREGIONS]; @@ -513,71 +855,84 @@ static int vhost_user_set_mem_table_postcopy(struct v= host_dev *dev, u->region_rb_len =3D dev->mem->nregions; } =20 - if (vhost_user_fill_set_mem_table_msg(u, dev, &msg, fds, &fd_num, + if (config_mem_slots) { + if (vhost_user_add_remove_regions(dev, &msg, reply_supported, true) < 0) { - return -1; - } - - if (vhost_user_write(dev, &msg, fds, fd_num) < 0) { - return -1; - } - - if (vhost_user_read(dev, &msg_reply) < 0) { - return -1; - } - - if (msg_reply.hdr.request !=3D VHOST_USER_SET_MEM_TABLE) { - error_report("%s: Received unexpected msg type." - "Expected %d received %d", __func__, - VHOST_USER_SET_MEM_TABLE, msg_reply.hdr.request); - return -1; - } - /* We're using the same structure, just reusing one of the - * fields, so it should be the same size. - */ - if (msg_reply.hdr.size !=3D msg.hdr.size) { - error_report("%s: Unexpected size for postcopy reply " - "%d vs %d", __func__, msg_reply.hdr.size, msg.hdr.siz= e); - return -1; - } - - memset(u->postcopy_client_bases, 0, - sizeof(uint64_t) * VHOST_MEMORY_MAX_NREGIONS); - - /* They're in the same order as the regions that were sent - * but some of the regions were skipped (above) if they - * didn't have fd's - */ - for (msg_i =3D 0, region_i =3D 0; - region_i < dev->mem->nregions; - region_i++) { - if (msg_i < fd_num && - msg_reply.payload.memory.regions[msg_i].guest_phys_addr =3D=3D - dev->mem->regions[region_i].guest_phys_addr) { - u->postcopy_client_bases[region_i] =3D - msg_reply.payload.memory.regions[msg_i].userspace_addr; - trace_vhost_user_set_mem_table_postcopy( - msg_reply.payload.memory.regions[msg_i].userspace_addr, - msg.payload.memory.regions[msg_i].userspace_addr, - msg_i, region_i); - msg_i++; + return -1; + } + } else { + if (vhost_user_fill_set_mem_table_msg(u, dev, &msg, fds, &fd_num, + true) < 0) { + return -1; + } + + if (vhost_user_write(dev, &msg, fds, fd_num) < 0) { + return -1; + } + + if (vhost_user_read(dev, &msg_reply) < 0) { + return -1; + } + + if (msg_reply.hdr.request !=3D VHOST_USER_SET_MEM_TABLE) { + error_report("%s: Received unexpected msg type." + "Expected %d received %d", __func__, + VHOST_USER_SET_MEM_TABLE, msg_reply.hdr.request); + return -1; + } + + /* + * We're using the same structure, just reusing one of the + * fields, so it should be the same size. + */ + if (msg_reply.hdr.size !=3D msg.hdr.size) { + error_report("%s: Unexpected size for postcopy reply " + "%d vs %d", __func__, msg_reply.hdr.size, + msg.hdr.size); + return -1; + } + + memset(u->postcopy_client_bases, 0, + sizeof(uint64_t) * VHOST_MEMORY_MAX_NREGIONS); + + /* + * They're in the same order as the regions that were sent + * but some of the regions were skipped (above) if they + * didn't have fd's + */ + for (msg_i =3D 0, region_i =3D 0; + region_i < dev->mem->nregions; + region_i++) { + if (msg_i < fd_num && + msg_reply.payload.memory.regions[msg_i].guest_phys_addr = =3D=3D + dev->mem->regions[region_i].guest_phys_addr) { + u->postcopy_client_bases[region_i] =3D + msg_reply.payload.memory.regions[msg_i].userspace_addr; + trace_vhost_user_set_mem_table_postcopy( + msg_reply.payload.memory.regions[msg_i].userspace_addr, + msg.payload.memory.regions[msg_i].userspace_addr, + msg_i, region_i); + msg_i++; + } + } + if (msg_i !=3D fd_num) { + error_report("%s: postcopy reply not fully consumed " + "%d vs %zd", + __func__, msg_i, fd_num); + return -1; + } + + /* + * Now we've registered this with the postcopy code, we ack to the + * client, because now we're in the position to be able to deal + * with any faults it generates. + */ + /* TODO: Use this for failure cases as well with a bad value. */ + msg.hdr.size =3D sizeof(msg.payload.u64); + msg.payload.u64 =3D 0; /* OK */ + if (vhost_user_write(dev, &msg, NULL, 0) < 0) { + return -1; } - } - if (msg_i !=3D fd_num) { - error_report("%s: postcopy reply not fully consumed " - "%d vs %zd", - __func__, msg_i, fd_num); - return -1; - } - /* Now we've registered this with the postcopy code, we ack to the cli= ent, - * because now we're in the position to be able to deal with any faults - * it generates. - */ - /* TODO: Use this for failure cases as well with a bad value */ - msg.hdr.size =3D sizeof(msg.payload.u64); - msg.payload.u64 =3D 0; /* OK */ - if (vhost_user_write(dev, &msg, NULL, 0) < 0) { - return -1; } =20 return 0; @@ -592,12 +947,17 @@ static int vhost_user_set_mem_table(struct vhost_dev = *dev, bool do_postcopy =3D u->postcopy_listen && u->postcopy_fd.handler; bool reply_supported =3D virtio_has_feature(dev->protocol_features, VHOST_USER_PROTOCOL_F_REPLY_= ACK); + bool config_mem_slots =3D + virtio_has_feature(dev->protocol_features, + VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS); =20 if (do_postcopy) { - /* Postcopy has enough differences that it's best done in it's own + /* + * Postcopy has enough differences that it's best done in it's own * version */ - return vhost_user_set_mem_table_postcopy(dev, mem); + return vhost_user_set_mem_table_postcopy(dev, mem, reply_supported, + config_mem_slots); } =20 VhostUserMsg msg =3D { @@ -608,17 +968,23 @@ static int vhost_user_set_mem_table(struct vhost_dev = *dev, msg.hdr.flags |=3D VHOST_USER_NEED_REPLY_MASK; } =20 - if (vhost_user_fill_set_mem_table_msg(u, dev, &msg, fds, &fd_num, + if (config_mem_slots) { + if (vhost_user_add_remove_regions(dev, &msg, reply_supported, false) < 0) { - return -1; - } + return -1; + } + } else { + if (vhost_user_fill_set_mem_table_msg(u, dev, &msg, fds, &fd_num, + false) < 0) { + return -1; + } + if (vhost_user_write(dev, &msg, fds, fd_num) < 0) { + return -1; + } =20 - if (vhost_user_write(dev, &msg, fds, fd_num) < 0) { - return -1; - } - - if (reply_supported) { - return process_message_reply(dev, &msg); + if (reply_supported) { + return process_message_reply(dev, &msg); + } } =20 return 0; diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst index b3cf5c3cb5..037eefab0e 100644 --- a/docs/interop/vhost-user.rst +++ b/docs/interop/vhost-user.rst @@ -1276,8 +1276,37 @@ Master message types QEMU to expose to the guest. At this point, the value returned by the backend will be capped at the maximum number of ram slots which can be supported by vhost-user. Currently that limit is set - at VHOST_USER_MAX_RAM_SLOTS =3D 8 because of underlying protocol - limitations. + at VHOST_USER_MAX_RAM_SLOTS =3D 8. + +``VHOST_USER_ADD_MEM_REG`` + :id: 37 + :equivalent ioctl: N/A + :slave payload: memory region + + When the ``VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS`` protocol + feature has been successfully negotiated, this message is submitted + by the master to the slave. The message payload contains a memory + region descriptor struct, describing a region of guest memory which + the slave device must map in. When the + ``VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS`` protocol feature has + been successfully negotiated, along with the + ``VHOST_USER_REM_MEM_REG`` message, this message is used to set and + update the memory tables of the slave device. + +``VHOST_USER_REM_MEM_REG`` + :id: 38 + :equivalent ioctl: N/A + :slave payload: memory region + + When the ``VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS`` protocol + feature has been successfully negotiated, this message is submitted + by the master to the slave. The message payload contains a memory + region descriptor struct, describing a region of guest memory which + the slave device must unmap. When the + ``VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS`` protocol feature has + been successfully negotiated, along with the + ``VHOST_USER_ADD_MEM_REG`` message, this message is used to set and + update the memory tables of the slave device. =20 Slave message types ------------------- --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974445; cv=none; d=zohomail.com; s=zohoarc; b=lnFjxIa2jAJIFazR7Jx1F9XN/bK+R+zQmjKHUW+4fcU+p8xtVZe0+V9e7E48J8g6ZrA56qEs6zZrdXPh/MCHXcenM7zRGBQHEGmxGTG/RVUOlX1JRzZxk8U//CNj4q37+Limr5WESf6R28BsmjS4nIl/6J5C6THErgcGnXgi0iU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974445; 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=Ube3ybB5q5kjGGoMmLvjNW9rzwLGwGw6dHhRU8+VAkk=; b=oAndtTgpduT665Twu3YapQy5jWmDypmIzRb0U1kRUDJYKnnuSJqX4XhL5KJlt7Ipro55Vu2ZVNeyzI2gXPfaZEXKOh6iz//QOONUXkkAlHkFXCu/vbJYnw7VitWUOQ+OZByzB4P0OO+wdMLw9CL3loYx9HDt1EXAqOdjm13FvGs= 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 1591974445198114.43581005371789; Fri, 12 Jun 2020 08:07:25 -0700 (PDT) Received: from localhost ([::1]:37726 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlHA-000114-7I for importer@patchew.org; Fri, 12 Jun 2020 11:07:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl2v-0008NL-4t for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:41 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:32157 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl2s-0001XH-RE for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:40 -0400 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-321-PZrWERkfMGK9XMn10EyvHA-1; Fri, 12 Jun 2020 10:52:34 -0400 Received: by mail-wr1-f72.google.com with SMTP id m14so3985736wrj.12 for ; Fri, 12 Jun 2020 07:52:33 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id r4sm10185104wro.32.2020.06.12.07.52.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973558; 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=Ube3ybB5q5kjGGoMmLvjNW9rzwLGwGw6dHhRU8+VAkk=; b=iyvKa53ByM5aVgsXAv4AVvJJDR2kCBPFXUuJjRB+Z8vsBxezfqvH1RxgnEFeVckRh9FDif dmwf8KIyF7wEhkLFIk0WLJfXCXRg2F0eqDKQx/c4UlgzvoaZZR1kmxPvyBAkPKQ2LWYFFx VmEFkFdwIJMOyX0xTLzkEvUOtJxat3E= X-MC-Unique: PZrWERkfMGK9XMn10EyvHA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=Ube3ybB5q5kjGGoMmLvjNW9rzwLGwGw6dHhRU8+VAkk=; b=el3bsHJQrqzGd+Tu5lsXkUqtuhKOFHOlkmj8YVdeZjWWAbVJHjsizjX5RamIPkgniH LRSJNSqEeQWbPKDXZOGFpJY53JuG9Jv5VxUhX3zAN+zKFDZiPQtOBTinR4UObjm2SB78 sumksr+yF/KvsC/cwzNlwatTZUee9S64aXNuFVvS+7+UGia04PE3sQkcZr7ZLz62Xhte HulQIiuZ6p/NIcP8fWJPPFCrkyPi12htv8qaBBlme487LP3VXUme1GsN058yKbDqpJfK P47GIVZ9K6LesaZVr1C9Ud/+UcQJjPX2Y34m+2ynROg7RyVJNR38Re1J857Zr42iEoCR I/8A== X-Gm-Message-State: AOAM531wWsHAUE0/SbK7PaRCmBglIfktOcaKpk73NvSl7rQCQ7iJiHzZ 41zpCPYQCjeRZ+BXNoy6HvVZ2ccB7IPZMLr/n15PZiximb4W+TWwhm3/tK2ZHmJeo8Wf+JJYlae axHpoLQb5R2+cpok= X-Received: by 2002:adf:feca:: with SMTP id q10mr14308617wrs.380.1591973552644; Fri, 12 Jun 2020 07:52:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyydQCnWHv/yhNZ74LocQysvbG0614FUqpOtkQsLQ649v6YWNssZndtTqqXEgIxP2PpqyQ8WA== X-Received: by 2002:adf:feca:: with SMTP id q10mr14308601wrs.380.1591973552315; Fri, 12 Jun 2020 07:52:32 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:30 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 40/58] Lift max memory slots limit imposed by vhost-user Message-ID: <20200612141917.9446-41-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mike Cui , Peter Maydell , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Peter Turschmid , Raphael Norwitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Raphael Norwitz Historically, sending all memory regions to vhost-user backends in a single message imposed a limitation on the number of times memory could be hot-added to a VM with a vhost-user device. Now that backends which support the VHOST_USER_PROTOCOL_F_CONFIGURE_SLOTS send memory regions individually, we no longer need to impose this limitation on devices which support this feature. With this change, VMs with a vhost-user device which supports the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS can support a configurable number of memory slots, up to the maximum allowed by the target platform. Existing backends which do not support VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS are unaffected. Signed-off-by: Raphael Norwitz Signed-off-by: Peter Turschmid Suggested-by: Mike Cui Message-Id: <1588533678-23450-6-git-send-email-raphael.norwitz@nutanix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Marc-Andr=C3=A9 Lureau --- hw/virtio/vhost-user.c | 56 ++++++++++++++++++++++++------------- docs/interop/vhost-user.rst | 7 ++--- 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 3640f017a2..4d6cd4e58a 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -35,10 +35,28 @@ #include #endif =20 -#define VHOST_MEMORY_MAX_NREGIONS 8 +#define VHOST_MEMORY_BASELINE_NREGIONS 8 #define VHOST_USER_F_PROTOCOL_FEATURES 30 #define VHOST_USER_SLAVE_MAX_FDS 8 =20 +/* + * Set maximum number of RAM slots supported to + * the maximum number supported by the target + * hardware plaform. + */ +#if defined(TARGET_X86) || defined(TARGET_X86_64) || \ + defined(TARGET_ARM) || defined(TARGET_ARM_64) +#include "hw/acpi/acpi.h" +#define VHOST_USER_MAX_RAM_SLOTS ACPI_MAX_RAM_SLOTS + +#elif defined(TARGET_PPC) || defined(TARGET_PPC_64) +#include "hw/ppc/spapr.h" +#define VHOST_USER_MAX_RAM_SLOTS SPAPR_MAX_RAM_SLOTS + +#else +#define VHOST_USER_MAX_RAM_SLOTS 512 +#endif + /* * Maximum size of virtio device config space */ @@ -127,7 +145,7 @@ typedef struct VhostUserMemoryRegion { typedef struct VhostUserMemory { uint32_t nregions; uint32_t padding; - VhostUserMemoryRegion regions[VHOST_MEMORY_MAX_NREGIONS]; + VhostUserMemoryRegion regions[VHOST_MEMORY_BASELINE_NREGIONS]; } VhostUserMemory; =20 typedef struct VhostUserMemRegMsg { @@ -222,7 +240,7 @@ struct vhost_user { int slave_fd; NotifierWithReturn postcopy_notifier; struct PostCopyFD postcopy_fd; - uint64_t postcopy_client_bases[VHOST_MEMORY_MAX_NREGIONS]; + uint64_t postcopy_client_bases[VHOST_USER_MAX_RAM_SLOTS]; /* Length of the region_rb and region_rb_offset arrays */ size_t region_rb_len; /* RAMBlock associated with a given region */ @@ -237,7 +255,7 @@ struct vhost_user { =20 /* Our current regions */ int num_shadow_regions; - struct vhost_memory_region shadow_regions[VHOST_MEMORY_MAX_NREGIONS]; + struct vhost_memory_region shadow_regions[VHOST_USER_MAX_RAM_SLOTS]; }; =20 struct scrub_regions { @@ -392,7 +410,7 @@ int vhost_user_gpu_set_socket(struct vhost_dev *dev, in= t fd) static int vhost_user_set_log_base(struct vhost_dev *dev, uint64_t base, struct vhost_log *log) { - int fds[VHOST_MEMORY_MAX_NREGIONS]; + int fds[VHOST_USER_MAX_RAM_SLOTS]; size_t fd_num =3D 0; bool shmfd =3D virtio_has_feature(dev->protocol_features, VHOST_USER_PROTOCOL_F_LOG_SHMFD); @@ -470,7 +488,7 @@ static int vhost_user_fill_set_mem_table_msg(struct vho= st_user *u, mr =3D vhost_user_get_mr_data(reg->userspace_addr, &offset, &fd); if (fd > 0) { if (track_ramblocks) { - assert(*fd_num < VHOST_MEMORY_MAX_NREGIONS); + assert(*fd_num < VHOST_MEMORY_BASELINE_NREGIONS); trace_vhost_user_set_mem_table_withfd(*fd_num, mr->name, reg->memory_size, reg->guest_phys_addr, @@ -478,7 +496,7 @@ static int vhost_user_fill_set_mem_table_msg(struct vho= st_user *u, offset); u->region_rb_offset[i] =3D offset; u->region_rb[i] =3D mr->ram_block; - } else if (*fd_num =3D=3D VHOST_MEMORY_MAX_NREGIONS) { + } else if (*fd_num =3D=3D VHOST_MEMORY_BASELINE_NREGIONS) { error_report("Failed preparing vhost-user memory table msg= "); return -1; } @@ -523,7 +541,7 @@ static void scrub_shadow_regions(struct vhost_dev *dev, bool track_ramblocks) { struct vhost_user *u =3D dev->opaque; - bool found[VHOST_MEMORY_MAX_NREGIONS] =3D {}; + bool found[VHOST_USER_MAX_RAM_SLOTS] =3D {}; struct vhost_memory_region *reg, *shadow_reg; int i, j, fd, add_idx =3D 0, rm_idx =3D 0, fd_num =3D 0; ram_addr_t offset; @@ -777,9 +795,9 @@ static int vhost_user_add_remove_regions(struct vhost_d= ev *dev, bool track_ramblocks) { struct vhost_user *u =3D dev->opaque; - struct scrub_regions add_reg[VHOST_MEMORY_MAX_NREGIONS]; - struct scrub_regions rem_reg[VHOST_MEMORY_MAX_NREGIONS]; - uint64_t shadow_pcb[VHOST_MEMORY_MAX_NREGIONS] =3D {}; + struct scrub_regions add_reg[VHOST_USER_MAX_RAM_SLOTS]; + struct scrub_regions rem_reg[VHOST_USER_MAX_RAM_SLOTS]; + uint64_t shadow_pcb[VHOST_USER_MAX_RAM_SLOTS] =3D {}; int nr_add_reg, nr_rem_reg; =20 msg->hdr.size =3D sizeof(msg->payload.mem_reg.padding) + @@ -803,7 +821,7 @@ static int vhost_user_add_remove_regions(struct vhost_d= ev *dev, =20 if (track_ramblocks) { memcpy(u->postcopy_client_bases, shadow_pcb, - sizeof(uint64_t) * VHOST_MEMORY_MAX_NREGIONS); + sizeof(uint64_t) * VHOST_USER_MAX_RAM_SLOTS); /* * Now we've registered this with the postcopy code, we ack to the * client, because now we're in the position to be able to deal wi= th @@ -823,7 +841,7 @@ static int vhost_user_add_remove_regions(struct vhost_d= ev *dev, err: if (track_ramblocks) { memcpy(u->postcopy_client_bases, shadow_pcb, - sizeof(uint64_t) * VHOST_MEMORY_MAX_NREGIONS); + sizeof(uint64_t) * VHOST_USER_MAX_RAM_SLOTS); } =20 return -1; @@ -835,7 +853,7 @@ static int vhost_user_set_mem_table_postcopy(struct vho= st_dev *dev, bool config_mem_slots) { struct vhost_user *u =3D dev->opaque; - int fds[VHOST_MEMORY_MAX_NREGIONS]; + int fds[VHOST_MEMORY_BASELINE_NREGIONS]; size_t fd_num =3D 0; VhostUserMsg msg_reply; int region_i, msg_i; @@ -893,7 +911,7 @@ static int vhost_user_set_mem_table_postcopy(struct vho= st_dev *dev, } =20 memset(u->postcopy_client_bases, 0, - sizeof(uint64_t) * VHOST_MEMORY_MAX_NREGIONS); + sizeof(uint64_t) * VHOST_USER_MAX_RAM_SLOTS); =20 /* * They're in the same order as the regions that were sent @@ -942,7 +960,7 @@ static int vhost_user_set_mem_table(struct vhost_dev *d= ev, struct vhost_memory *mem) { struct vhost_user *u =3D dev->opaque; - int fds[VHOST_MEMORY_MAX_NREGIONS]; + int fds[VHOST_MEMORY_BASELINE_NREGIONS]; size_t fd_num =3D 0; bool do_postcopy =3D u->postcopy_listen && u->postcopy_fd.handler; bool reply_supported =3D virtio_has_feature(dev->protocol_features, @@ -1149,7 +1167,7 @@ static int vhost_set_vring_file(struct vhost_dev *dev, VhostUserRequest request, struct vhost_vring_file *file) { - int fds[VHOST_MEMORY_MAX_NREGIONS]; + int fds[VHOST_USER_MAX_RAM_SLOTS]; size_t fd_num =3D 0; VhostUserMsg msg =3D { .hdr.request =3D request, @@ -1845,7 +1863,7 @@ static int vhost_user_backend_init(struct vhost_dev *= dev, void *opaque) /* get max memory regions if backend supports configurable RAM slo= ts */ if (!virtio_has_feature(dev->protocol_features, VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS)= ) { - u->user->memory_slots =3D VHOST_MEMORY_MAX_NREGIONS; + u->user->memory_slots =3D VHOST_MEMORY_BASELINE_NREGIONS; } else { err =3D vhost_user_get_max_memslots(dev, &ram_slots); if (err < 0) { @@ -1860,7 +1878,7 @@ static int vhost_user_backend_init(struct vhost_dev *= dev, void *opaque) return -1; } =20 - u->user->memory_slots =3D MIN(ram_slots, VHOST_MEMORY_MAX_NREG= IONS); + u->user->memory_slots =3D MIN(ram_slots, VHOST_USER_MAX_RAM_SL= OTS); } } =20 diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst index 037eefab0e..688b7c6900 100644 --- a/docs/interop/vhost-user.rst +++ b/docs/interop/vhost-user.rst @@ -1273,10 +1273,9 @@ Master message types feature has been successfully negotiated, this message is submitted by master to the slave. The slave should return the message with a u64 payload containing the maximum number of memory slots for - QEMU to expose to the guest. At this point, the value returned - by the backend will be capped at the maximum number of ram slots - which can be supported by vhost-user. Currently that limit is set - at VHOST_USER_MAX_RAM_SLOTS =3D 8. + QEMU to expose to the guest. The value returned by the backend + will be capped at the maximum number of ram slots which can be + supported by the target platform. =20 ``VHOST_USER_ADD_MEM_REG`` :id: 37 --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974953; cv=none; d=zohomail.com; s=zohoarc; b=i7AFpVPqsvwWb9jIw2D+UQxLxbqQP+TnBUWtbwsMVd0uWD0JRTgjo2PIHCR/uf644ZWzFMMrC9vigmUIycAmlE/G2mEUZ4tVCuC1TKgoL0W7OFBMyz9WzAOrbwk64Ta5NHKqLL0DB+7Y1wETVLEBEelPP9NUZH+6aP0j4cpxS2Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974953; 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=BPZRKzdJHdjypDoBiRtFVPoYSHFJQu69zEdmNF7eHNU=; b=Njkp0ytjkuZw/7A/MKCwnOZlr5KFMUSamUE67nEPhObjDP4mgiNOH8Y8R2gmXJoLNatK7LzOFRRNkIGy//T92Rh06FBy21U5Pe5b8dQdptpZiu5+8LaeYdaMJI0r2t+U9fT6qzJjEmWZJCdoDJfZGpS02AGANxt0UuPB2CzqIYQ= 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 1591974953907367.60747152155625; Fri, 12 Jun 2020 08:15:53 -0700 (PDT) Received: from localhost ([::1]:43704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlPM-0001Bo-I6 for importer@patchew.org; Fri, 12 Jun 2020 11:15:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl2v-0008P3-Ky for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:41 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:42571 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl2s-0001XI-VO for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:41 -0400 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-477-afHpztCENh2Akq1uIUW2Cw-1; Fri, 12 Jun 2020 10:52:36 -0400 Received: by mail-wm1-f69.google.com with SMTP id h6so2035961wmb.7 for ; Fri, 12 Jun 2020 07:52:36 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id c65sm9778316wme.8.2020.06.12.07.52.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973558; 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=BPZRKzdJHdjypDoBiRtFVPoYSHFJQu69zEdmNF7eHNU=; b=SmwMXk87YBcLqs0+4TriyDQoGF6qc+ahecw1HLwfGEA4YQzlhFBRTvfdcng3ABVLmmLNGP /5T2haFuoqzWkIhLL0I2fYnMoNi0yxr6RpV3BXr86Jv1ETjAtHn5K9QrdVpUww3wuopkFJ TXQoBrfQlRV4NeMk8QkBlLBVA7e0h4k= X-MC-Unique: afHpztCENh2Akq1uIUW2Cw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=BPZRKzdJHdjypDoBiRtFVPoYSHFJQu69zEdmNF7eHNU=; b=d91NQFnK5QRYQ3UDwJ4XsZ6Nm6Q/v0yK4kZ7aRMwB9IZjJg6adZL1FTSSFTtZIVBjh lGWNkeSwybirv/DYemY9wS/ePBwozS4ZADW+ukALapfNCu2URsAdmFp7ZL1CKLbESFfM LLs5ms4NfjPHXxhPm84cVRN7wO9lQB7G0yaagtTK/Gf1AnPhqHjDeKM4TLRSUHfZfcnH ThHaUJ2jY11OEl+N8e+UJJtjt45ztvwfx3rw1o8zNTAAe5jZb1eUnz65Rx8JbrKIrLXP cLd5MCHWKq2sBH1cCizBkVWQDxFR5uNX3JJ5zjchRxGDsrlFNTEIF57CiMVRpEyyJb34 6zew== X-Gm-Message-State: AOAM533a2FQhchmwX53B7esS/kzAipESAK30S1pZ2IyB943enKuPd1HX /EIBSw5x0YBP3dEOGR1M04yFQdgLBbF2rXIsFsmTtVHnlYwgo7mNMp2vDebsBINXk1KLG13OK6n UXfJZcTu9u1ETFSk= X-Received: by 2002:a1c:7d4c:: with SMTP id y73mr2822986wmc.188.1591973554834; Fri, 12 Jun 2020 07:52:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMkVAl+fxrGpcrP3gSfXmo7XQVYdcF3It5T/Oz+ccM9f7Wmmmd1fFwtI3vaxekI0OiV7sk7w== X-Received: by 2002:a1c:7d4c:: with SMTP id y73mr2822973wmc.188.1591973554565; Fri, 12 Jun 2020 07:52:34 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:32 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 41/58] Refactor out libvhost-user fault generation logic Message-ID: <20200612141917.9446-42-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:17 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Johannes Berg , Peter Maydell , Stefan Hajnoczi , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Raphael Norwitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Raphael Norwitz In libvhost-user, the incoming postcopy migration path for setting the backend's memory tables has become convolued. In particular, moving the logic which starts generating faults, having received the final ACK from qemu can be moved to a separate function. This simplifies the code substantially. This logic will also be needed by the postcopy path once the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS feature is supported. Signed-off-by: Raphael Norwitz Message-Id: <1588533678-23450-7-git-send-email-raphael.norwitz@nutanix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Marc-Andr=C3=A9 Lureau --- contrib/libvhost-user/libvhost-user.c | 147 ++++++++++++++------------ 1 file changed, 79 insertions(+), 68 deletions(-) diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/= libvhost-user.c index 3bca996c62..cccfa22209 100644 --- a/contrib/libvhost-user/libvhost-user.c +++ b/contrib/libvhost-user/libvhost-user.c @@ -583,6 +583,84 @@ map_ring(VuDev *dev, VuVirtq *vq) return !(vq->vring.desc && vq->vring.used && vq->vring.avail); } =20 +static bool +generate_faults(VuDev *dev) { + int i; + for (i =3D 0; i < dev->nregions; i++) { + VuDevRegion *dev_region =3D &dev->regions[i]; + int ret; +#ifdef UFFDIO_REGISTER + /* + * We should already have an open ufd. Mark each memory + * range as ufd. + * Discard any mapping we have here; note I can't use MADV_REMOVE + * or fallocate to make the hole since I don't want to lose + * data that's already arrived in the shared process. + * TODO: How to do hugepage + */ + ret =3D madvise((void *)(uintptr_t)dev_region->mmap_addr, + dev_region->size + dev_region->mmap_offset, + MADV_DONTNEED); + if (ret) { + fprintf(stderr, + "%s: Failed to madvise(DONTNEED) region %d: %s\n", + __func__, i, strerror(errno)); + } + /* + * Turn off transparent hugepages so we dont get lose wakeups + * in neighbouring pages. + * TODO: Turn this backon later. + */ + ret =3D madvise((void *)(uintptr_t)dev_region->mmap_addr, + dev_region->size + dev_region->mmap_offset, + MADV_NOHUGEPAGE); + if (ret) { + /* + * Note: This can happen legally on kernels that are configured + * without madvise'able hugepages + */ + fprintf(stderr, + "%s: Failed to madvise(NOHUGEPAGE) region %d: %s\n", + __func__, i, strerror(errno)); + } + struct uffdio_register reg_struct; + reg_struct.range.start =3D (uintptr_t)dev_region->mmap_addr; + reg_struct.range.len =3D dev_region->size + dev_region->mmap_offse= t; + reg_struct.mode =3D UFFDIO_REGISTER_MODE_MISSING; + + if (ioctl(dev->postcopy_ufd, UFFDIO_REGISTER, ®_struct)) { + vu_panic(dev, "%s: Failed to userfault region %d " + "@%p + size:%zx offset: %zx: (ufd=3D%d)%s\n", + __func__, i, + dev_region->mmap_addr, + dev_region->size, dev_region->mmap_offset, + dev->postcopy_ufd, strerror(errno)); + return false; + } + if (!(reg_struct.ioctls & ((__u64)1 << _UFFDIO_COPY))) { + vu_panic(dev, "%s Region (%d) doesn't support COPY", + __func__, i); + return false; + } + DPRINT("%s: region %d: Registered userfault for %" + PRIx64 " + %" PRIx64 "\n", __func__, i, + (uint64_t)reg_struct.range.start, + (uint64_t)reg_struct.range.len); + /* Now it's registered we can let the client at it */ + if (mprotect((void *)(uintptr_t)dev_region->mmap_addr, + dev_region->size + dev_region->mmap_offset, + PROT_READ | PROT_WRITE)) { + vu_panic(dev, "failed to mprotect region %d for postcopy (%s)", + i, strerror(errno)); + return false; + } + /* TODO: Stash 'zero' support flags somewhere */ +#endif + } + + return true; +} + static bool vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg) { @@ -655,74 +733,7 @@ vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMs= g *vmsg) } =20 /* OK, now we can go and register the memory and generate faults */ - for (i =3D 0; i < dev->nregions; i++) { - VuDevRegion *dev_region =3D &dev->regions[i]; - int ret; -#ifdef UFFDIO_REGISTER - /* We should already have an open ufd. Mark each memory - * range as ufd. - * Discard any mapping we have here; note I can't use MADV_REMOVE - * or fallocate to make the hole since I don't want to lose - * data that's already arrived in the shared process. - * TODO: How to do hugepage - */ - ret =3D madvise((void *)(uintptr_t)dev_region->mmap_addr, - dev_region->size + dev_region->mmap_offset, - MADV_DONTNEED); - if (ret) { - fprintf(stderr, - "%s: Failed to madvise(DONTNEED) region %d: %s\n", - __func__, i, strerror(errno)); - } - /* Turn off transparent hugepages so we dont get lose wakeups - * in neighbouring pages. - * TODO: Turn this backon later. - */ - ret =3D madvise((void *)(uintptr_t)dev_region->mmap_addr, - dev_region->size + dev_region->mmap_offset, - MADV_NOHUGEPAGE); - if (ret) { - /* Note: This can happen legally on kernels that are configured - * without madvise'able hugepages - */ - fprintf(stderr, - "%s: Failed to madvise(NOHUGEPAGE) region %d: %s\n", - __func__, i, strerror(errno)); - } - struct uffdio_register reg_struct; - reg_struct.range.start =3D (uintptr_t)dev_region->mmap_addr; - reg_struct.range.len =3D dev_region->size + dev_region->mmap_offse= t; - reg_struct.mode =3D UFFDIO_REGISTER_MODE_MISSING; - - if (ioctl(dev->postcopy_ufd, UFFDIO_REGISTER, ®_struct)) { - vu_panic(dev, "%s: Failed to userfault region %d " - "@%p + size:%zx offset: %zx: (ufd=3D%d)%s\n", - __func__, i, - dev_region->mmap_addr, - dev_region->size, dev_region->mmap_offset, - dev->postcopy_ufd, strerror(errno)); - return false; - } - if (!(reg_struct.ioctls & ((__u64)1 << _UFFDIO_COPY))) { - vu_panic(dev, "%s Region (%d) doesn't support COPY", - __func__, i); - return false; - } - DPRINT("%s: region %d: Registered userfault for %" - PRIx64 " + %" PRIx64 "\n", __func__, i, - (uint64_t)reg_struct.range.start, - (uint64_t)reg_struct.range.len); - /* Now it's registered we can let the client at it */ - if (mprotect((void *)(uintptr_t)dev_region->mmap_addr, - dev_region->size + dev_region->mmap_offset, - PROT_READ | PROT_WRITE)) { - vu_panic(dev, "failed to mprotect region %d for postcopy (%s)", - i, strerror(errno)); - return false; - } - /* TODO: Stash 'zero' support flags somewhere */ -#endif - } + (void)generate_faults(dev); =20 return false; } --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974637; cv=none; d=zohomail.com; s=zohoarc; b=VQ1qBIkOnll9rcnQHxFP+390S8eIr8AmyjOX11h8p3P5of3k3cU090jtYu2d88yRSLRgh0Mr76DvVHFnVmbpfx+aVX84g4wNAPcI3wznJCOwY4TwRBO5K9w21/kBXHrywe8CYX73PxWv4TYwMvJ0x0OfItgZJKHoCnR5lwv3yw8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974637; 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=DbDRG1p4/X4N+xWJw2tEfw4K/ZQW4xdSXq7Ah8IdwPY=; b=fUNUoRfIs7QHrhLluWG+DVNrY6m6HlbsHN90qaYOHE+rU+uxBf15xkBmuKjO9ck+XFr9P4I6IwmQlkzACiIpvEL7KXi05wq17rKCrYCTyRpmx1qMixB59EzjSkGxFmEMW/1Wu1QNiCzKZJUg5aqwHewYfG0QH8ZWZRXvas+g8Pg= 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 1591974637712433.14656614378146; Fri, 12 Jun 2020 08:10:37 -0700 (PDT) Received: from localhost ([::1]:49548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlKG-0006sz-Gy for importer@patchew.org; Fri, 12 Jun 2020 11:10:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50384) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl2w-0008Sd-K8 for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:42 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:51044 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl2u-0001Y7-Oj for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:42 -0400 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-66-MfBwT0C-MImDbbvsW7tvsQ-1; Fri, 12 Jun 2020 10:52:38 -0400 Received: by mail-wr1-f71.google.com with SMTP id o1so3961427wrm.17 for ; Fri, 12 Jun 2020 07:52:38 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id a16sm10115856wrx.8.2020.06.12.07.52.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973560; 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=DbDRG1p4/X4N+xWJw2tEfw4K/ZQW4xdSXq7Ah8IdwPY=; b=U4q+PTnBBX/r47G5DS8Yv9UKWbEf1d9HjIsydMM04htaJCW4I/jRxP91V6cUYvg2C8uiCC dsAyM/u3xbOePNbSpBqZWEaP5uSjDrRloMXe97Q2OZWe0oq3CBxkj8HSDe7WFAO2s4F3bm iqXMXu9/TxRLnqKfS630NOPNQBdmt9M= X-MC-Unique: MfBwT0C-MImDbbvsW7tvsQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=DbDRG1p4/X4N+xWJw2tEfw4K/ZQW4xdSXq7Ah8IdwPY=; b=meogjho8lslI+F9eQasL+z9flFt3T0FkN3MJrwOs8xN+4NuA494hsEJr+VV0RBEqtF +w+0jwIsGiAx6TdGPsrdBpe84+b2NCWUm4XMyWQTwc07+noTtLGjehsz3bv9rk1C+R3h 38/9I9Boco2Zk1kOe2bih6gWDsu0ku9eVN53mQm4WCny5V7mGsNm3DAkz4d+1g/K2Gw9 CyUiFkFp1sXdlqwnL6MZXAhAJvQhlvySmG4GVsbqk9b0ZlibE2NcBL0+Y/Nn1rAr8fO+ 3jQq1jju9GhbW+q3N0UsGwpf+DsCgGaK167Fb11Dnnf89iFDmWeIJfqokGKpXDzH2bXK il2A== X-Gm-Message-State: AOAM531DC5o8kwCfTxNxBHrE1LgAGcOh4kADCSEf6h5oy3/jjJvi1Nq7 TY/orEZncrhmV4/19xbPi+O+kh5HVR3HbecJe0T47hC/E+b8+D5BOmmwozTrmJ8Y+xb8qKh3lTX b+UlATjd9/a4pedY= X-Received: by 2002:adf:82f8:: with SMTP id 111mr15136042wrc.257.1591973556955; Fri, 12 Jun 2020 07:52:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0+TsFT2dVsw3DQpIcI5I+C/pbobHHCSmkAbeGk42+hTlGnI5ekmCeqwLUoW/9dW6iG1304A== X-Received: by 2002:adf:82f8:: with SMTP id 111mr15136020wrc.257.1591973556773; Fri, 12 Jun 2020 07:52:36 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:34 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 42/58] Support ram slot configuration in libvhost-user Message-ID: <20200612141917.9446-43-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 09:30:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Johannes Berg , David Hildenbrand , "Dr. David Alan Gilbert" , Raphael Norwitz , Stefan Hajnoczi , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Raphael Norwitz The VHOST_USER_GET_MAX_MEM_SLOTS message allows a vhost-user backend to specify a maximum number of ram slots it is willing to support. This change adds support for libvhost-user to process this message. For now the backend will reply with 8 as the maximum number of regions supported. libvhost-user does not yet support the vhost-user protocol feature VHOST_USER_PROTOCOL_F_CONFIGIRE_MEM_SLOTS, so qemu should never send the VHOST_USER_GET_MAX_MEM_SLOTS message. Therefore this new functionality is not currently used. Signed-off-by: Raphael Norwitz Message-Id: <1588533678-23450-8-git-send-email-raphael.norwitz@nutanix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Marc-Andr=C3=A9 Lureau --- contrib/libvhost-user/libvhost-user.h | 1 + contrib/libvhost-user/libvhost-user.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/contrib/libvhost-user/libvhost-user.h b/contrib/libvhost-user/= libvhost-user.h index f30394fab6..88ef40d26a 100644 --- a/contrib/libvhost-user/libvhost-user.h +++ b/contrib/libvhost-user/libvhost-user.h @@ -97,6 +97,7 @@ typedef enum VhostUserRequest { VHOST_USER_SET_INFLIGHT_FD =3D 32, VHOST_USER_GPU_SET_SOCKET =3D 33, VHOST_USER_VRING_KICK =3D 35, + VHOST_USER_GET_MAX_MEM_SLOTS =3D 36, VHOST_USER_MAX } VhostUserRequest; =20 diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/= libvhost-user.c index cccfa22209..9f039b707e 100644 --- a/contrib/libvhost-user/libvhost-user.c +++ b/contrib/libvhost-user/libvhost-user.c @@ -137,6 +137,7 @@ vu_request_to_string(unsigned int req) REQ(VHOST_USER_SET_INFLIGHT_FD), REQ(VHOST_USER_GPU_SET_SOCKET), REQ(VHOST_USER_VRING_KICK), + REQ(VHOST_USER_GET_MAX_MEM_SLOTS), REQ(VHOST_USER_MAX), }; #undef REQ @@ -1565,6 +1566,22 @@ vu_handle_vring_kick(VuDev *dev, VhostUserMsg *vmsg) return false; } =20 +static bool vu_handle_get_max_memslots(VuDev *dev, VhostUserMsg *vmsg) +{ + vmsg->flags =3D VHOST_USER_REPLY_MASK | VHOST_USER_VERSION; + vmsg->size =3D sizeof(vmsg->payload.u64); + vmsg->payload.u64 =3D VHOST_MEMORY_MAX_NREGIONS; + vmsg->fd_num =3D 0; + + if (!vu_message_write(dev, dev->sock, vmsg)) { + vu_panic(dev, "Failed to send max ram slots: %s\n", strerror(errno= )); + } + + DPRINT("u64: 0x%016"PRIx64"\n", (uint64_t) VHOST_MEMORY_MAX_NREGIONS); + + return false; +} + static bool vu_process_message(VuDev *dev, VhostUserMsg *vmsg) { @@ -1649,6 +1666,8 @@ vu_process_message(VuDev *dev, VhostUserMsg *vmsg) return vu_set_inflight_fd(dev, vmsg); case VHOST_USER_VRING_KICK: return vu_handle_vring_kick(dev, vmsg); + case VHOST_USER_GET_MAX_MEM_SLOTS: + return vu_handle_get_max_memslots(dev, vmsg); default: vmsg_close_fds(vmsg); vu_panic(dev, "Unhandled request: %d", vmsg->request); --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974413; cv=none; d=zohomail.com; s=zohoarc; b=gJYiLr7v82BH9Bn1YPRDwSctJmgNkDkchxvsYSy3+nCZjmtG556F56tf8/EIB6G0pU8qQQPozxfQhyDGZBPm8Pf+sJuE4jbySdqGVhxtlNy91vEeSMoo0CS/viOVCLKPQUyrEwD8oNry6eNE7TDVPpv/2koQSniz6OdXMgs1o2U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974413; h=Content-Type: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=afqjR/PPKF3RnnjVexEnd3gC/JLrRCP0cPSdSL7aizY=; b=fHVMKm7y4bkmBDNMI3vVtpmWd8LGYPnp9YrUAAUeC37FMjDbA5XKJcYo9zdS/M7UQz1Pe+fCQNIJLd0itzTYxuQkXQmYqCs6+lYaHAiNLe8O+R/ogd7upBijzWMpKJxniLfDJpRSsFJv5p9muIcuYJuUS5ViMUlRoBWaPLmDAqA= 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 1591974413526345.19532158903144; Fri, 12 Jun 2020 08:06:53 -0700 (PDT) Received: from localhost ([::1]:35382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlGe-0008P8-Kt for importer@patchew.org; Fri, 12 Jun 2020 11:06:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50414) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl2z-00009P-Bs for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:45 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:33680 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl2x-0001YZ-F9 for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:45 -0400 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-340-lTV86TTNPeSE4v6-Z_Rhzw-1; Fri, 12 Jun 2020 10:52:41 -0400 Received: by mail-wr1-f69.google.com with SMTP id z10so4017971wrs.2 for ; Fri, 12 Jun 2020 07:52:40 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id a1sm9047842wmj.29.2020.06.12.07.52.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973562; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=afqjR/PPKF3RnnjVexEnd3gC/JLrRCP0cPSdSL7aizY=; b=Cbcv5eIanoOT8keYsRK5a4GxE+EZyiAMZ9XQL3MiesZ/uxSmCM7txRdCu9saAZGC6t7xdV +YP3+ifgFh+S/4o2io75gmf70N6Bv5K0ujRZRPYjvgjxxoupxy+gI+WT5q6kDbyzYwpWmI IT0YJujybS92Eu0+ywfe1BcblQkrbnw= X-MC-Unique: lTV86TTNPeSE4v6-Z_Rhzw-1 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=afqjR/PPKF3RnnjVexEnd3gC/JLrRCP0cPSdSL7aizY=; b=l7NCyvsd5uX/e5OgNINXjB40FuTuk/5TXX1L8AbQRQruTJG+x19CPOAtksyrxQLO5s H3xDoxirkiCOOhgIxJXPJWy9zoyukRU9fzvHeUCjoDBQHdCytzDD/q4vzy4KLgBdw+/e ijdXDzumYzMtP1R3kHQ7jSmCzCyxfkdUfKeyc0emHxrCBdnLY80e8GyENy+CptOA+5nE AXEei7UkBo0EGN6WOxhPdsevmo5U3CttfLVaAn9U+YiE5j8fXMCC0PWOsmEZ1E0D2tlD qYSIzmGLzCO4UR0Cs1vpF/epi1R/CL7PrHhx91W8cAz6IG7mslnJTjMYwoSuf6lcwI09 /lzQ== X-Gm-Message-State: AOAM533Ejepf6nGQRuTzkhp5LbB4uOpuV8+UkS6cmJl8XHW23LKDCy96 P8C7QlkzJ2IeQt3ytDrDW7H23j9jT/KFcfQwqNqcNAxP0TptjMCIvmj7jxQguPGWeMpiV3nmaJF R3Yqzeve73von08I= X-Received: by 2002:a05:600c:21d7:: with SMTP id x23mr14535457wmj.95.1591973559571; Fri, 12 Jun 2020 07:52:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZkqGBN4wgoKnbyCFQkJ4OdT6nvvU7M7/gk7smqNXXxfznN9vb6tsxK8UD2Is36tP+mCABGQ== X-Received: by 2002:a05:600c:21d7:: with SMTP id x23mr14535421wmj.95.1591973559046; Fri, 12 Jun 2020 07:52:39 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:37 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 43/58] Support adding individual regions in libvhost-user Message-ID: <20200612141917.9446-44-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 09:30:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Johannes Berg , "Dr. David Alan Gilbert" , Raphael Norwitz , Stefan Hajnoczi , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Raphael Norwitz When the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS is enabled, qemu will transmit memory regions to a backend individually using the new message VHOST_USER_ADD_MEM_REG. With this change vhost-user backends built with libvhost-user can now map in new memory regions when VHOST_USER_ADD_MEM_REG messages are received. Qemu only sends VHOST_USER_ADD_MEM_REG messages when the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS feature is negotiated, and since it is not yet supported in libvhost-user, this new functionality is not yet used. Signed-off-by: Raphael Norwitz Message-Id: <1588533678-23450-9-git-send-email-raphael.norwitz@nutanix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- contrib/libvhost-user/libvhost-user.h | 7 ++ contrib/libvhost-user/libvhost-user.c | 103 ++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) diff --git a/contrib/libvhost-user/libvhost-user.h b/contrib/libvhost-user/= libvhost-user.h index 88ef40d26a..60ef7fd13e 100644 --- a/contrib/libvhost-user/libvhost-user.h +++ b/contrib/libvhost-user/libvhost-user.h @@ -98,6 +98,7 @@ typedef enum VhostUserRequest { VHOST_USER_GPU_SET_SOCKET =3D 33, VHOST_USER_VRING_KICK =3D 35, VHOST_USER_GET_MAX_MEM_SLOTS =3D 36, + VHOST_USER_ADD_MEM_REG =3D 37, VHOST_USER_MAX } VhostUserRequest; =20 @@ -124,6 +125,11 @@ typedef struct VhostUserMemory { VhostUserMemoryRegion regions[VHOST_MEMORY_MAX_NREGIONS]; } VhostUserMemory; =20 +typedef struct VhostUserMemRegMsg { + uint32_t padding; + VhostUserMemoryRegion region; +} VhostUserMemRegMsg; + typedef struct VhostUserLog { uint64_t mmap_size; uint64_t mmap_offset; @@ -176,6 +182,7 @@ typedef struct VhostUserMsg { struct vhost_vring_state state; struct vhost_vring_addr addr; VhostUserMemory memory; + VhostUserMemRegMsg memreg; VhostUserLog log; VhostUserConfig config; VhostUserVringArea area; diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/= libvhost-user.c index 9f039b707e..d8ee7a23a3 100644 --- a/contrib/libvhost-user/libvhost-user.c +++ b/contrib/libvhost-user/libvhost-user.c @@ -138,6 +138,7 @@ vu_request_to_string(unsigned int req) REQ(VHOST_USER_GPU_SET_SOCKET), REQ(VHOST_USER_VRING_KICK), REQ(VHOST_USER_GET_MAX_MEM_SLOTS), + REQ(VHOST_USER_ADD_MEM_REG), REQ(VHOST_USER_MAX), }; #undef REQ @@ -662,6 +663,106 @@ generate_faults(VuDev *dev) { return true; } =20 +static bool +vu_add_mem_reg(VuDev *dev, VhostUserMsg *vmsg) { + int i; + bool track_ramblocks =3D dev->postcopy_listening; + VhostUserMemoryRegion m =3D vmsg->payload.memreg.region, *msg_region = =3D &m; + VuDevRegion *dev_region =3D &dev->regions[dev->nregions]; + void *mmap_addr; + + /* + * If we are in postcopy mode and we receive a u64 payload with a 0 va= lue + * we know all the postcopy client bases have been recieved, and we + * should start generating faults. + */ + if (track_ramblocks && + vmsg->size =3D=3D sizeof(vmsg->payload.u64) && + vmsg->payload.u64 =3D=3D 0) { + (void)generate_faults(dev); + return false; + } + + DPRINT("Adding region: %d\n", dev->nregions); + DPRINT(" guest_phys_addr: 0x%016"PRIx64"\n", + msg_region->guest_phys_addr); + DPRINT(" memory_size: 0x%016"PRIx64"\n", + msg_region->memory_size); + DPRINT(" userspace_addr 0x%016"PRIx64"\n", + msg_region->userspace_addr); + DPRINT(" mmap_offset 0x%016"PRIx64"\n", + msg_region->mmap_offset); + + dev_region->gpa =3D msg_region->guest_phys_addr; + dev_region->size =3D msg_region->memory_size; + dev_region->qva =3D msg_region->userspace_addr; + dev_region->mmap_offset =3D msg_region->mmap_offset; + + /* + * We don't use offset argument of mmap() since the + * mapped address has to be page aligned, and we use huge + * pages. + */ + if (track_ramblocks) { + /* + * In postcopy we're using PROT_NONE here to catch anyone + * accessing it before we userfault. + */ + mmap_addr =3D mmap(0, dev_region->size + dev_region->mmap_offset, + PROT_NONE, MAP_SHARED, + vmsg->fds[0], 0); + } else { + mmap_addr =3D mmap(0, dev_region->size + dev_region->mmap_offset, + PROT_READ | PROT_WRITE, MAP_SHARED, vmsg->fds[0], + 0); + } + + if (mmap_addr =3D=3D MAP_FAILED) { + vu_panic(dev, "region mmap error: %s", strerror(errno)); + } else { + dev_region->mmap_addr =3D (uint64_t)(uintptr_t)mmap_addr; + DPRINT(" mmap_addr: 0x%016"PRIx64"\n", + dev_region->mmap_addr); + } + + close(vmsg->fds[0]); + + if (track_ramblocks) { + /* + * Return the address to QEMU so that it can translate the ufd + * fault addresses back. + */ + msg_region->userspace_addr =3D (uintptr_t)(mmap_addr + + dev_region->mmap_offset); + + /* Send the message back to qemu with the addresses filled in. */ + vmsg->fd_num =3D 0; + if (!vu_send_reply(dev, dev->sock, vmsg)) { + vu_panic(dev, "failed to respond to add-mem-region for postcop= y"); + return false; + } + + DPRINT("Successfully added new region in postcopy\n"); + dev->nregions++; + return false; + + } else { + for (i =3D 0; i < dev->max_queues; i++) { + if (dev->vq[i].vring.desc) { + if (map_ring(dev, &dev->vq[i])) { + vu_panic(dev, "remapping queue %d for new memory regio= n", + i); + } + } + } + + DPRINT("Successfully added new region\n"); + dev->nregions++; + vmsg_set_reply_u64(vmsg, 0); + return true; + } +} + static bool vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg) { @@ -1668,6 +1769,8 @@ vu_process_message(VuDev *dev, VhostUserMsg *vmsg) return vu_handle_vring_kick(dev, vmsg); case VHOST_USER_GET_MAX_MEM_SLOTS: return vu_handle_get_max_memslots(dev, vmsg); + case VHOST_USER_ADD_MEM_REG: + return vu_add_mem_reg(dev, vmsg); default: vmsg_close_fds(vmsg); vu_panic(dev, "Unhandled request: %d", vmsg->request); --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974545; cv=none; d=zohomail.com; s=zohoarc; b=at5n2XqpFjmnB4IwkP6F/CIVX7lnM0dxak5iz91qJ1ldOJnKxq9dzCSWjeAZSTxWxGZxrAmUFpeOVNVuF3kaIdvMmT4bnCiFeur+Zp2DWJoTTxRnyAGr1BN8qQvJg0JrB5ivWw5jM7A6MfirdYTd7v06beLX3TYshIgiHWKHnkA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974545; h=Content-Type: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=/61PXreG9CtbL2ch+1GsTIa5m/Lv2qjj0nnVUy3KBs8=; b=j+1OaW3BE6QEYiKqiWPcuvHU+8psNz3Khz6zWbgG0aLr/8JoIuGPpF+chWt+UCLUziQEeSY2xQ8DdHwtMws+paXps17Wdf0BBP1VvYhjmc/84BiMti9iavu7HekRgvdvq3JkHp3/BghecC+dN8W6bgXlpU1ohlTxZBGc2+iQxyY= 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 1591974545031321.8333817104161; Fri, 12 Jun 2020 08:09:05 -0700 (PDT) Received: from localhost ([::1]:43750 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlIm-0003zZ-1i for importer@patchew.org; Fri, 12 Jun 2020 11:09:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl31-0000EU-0u for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:47 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:39563 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl2z-0001Yv-5o for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:46 -0400 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-491--LDxGG3HNGOhkejuAnIOZw-1; Fri, 12 Jun 2020 10:52:42 -0400 Received: by mail-wr1-f72.google.com with SMTP id c14so3980161wrm.15 for ; Fri, 12 Jun 2020 07:52:42 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id t7sm9674317wrq.41.2020.06.12.07.52.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973564; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/61PXreG9CtbL2ch+1GsTIa5m/Lv2qjj0nnVUy3KBs8=; b=g7wH69HgjG+0aDwCr+7Pk9x+M6YgE3khimSXeLrNuTYyQGe4qO25Qrdou6FHeJyr7sUN8I E3CB0torDjkUznT4pQvmsHbjQxU6KJiacZnGBeF0OOrP/bAALLOHmHEKMLcbcd6j1BXY+Z eVnWO5PAjKhIEIxVJgILi/aRrvd9h7c= X-MC-Unique: -LDxGG3HNGOhkejuAnIOZw-1 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=/61PXreG9CtbL2ch+1GsTIa5m/Lv2qjj0nnVUy3KBs8=; b=O44+Z3DaBDnowsY5/T8z1aHVPZ3uphMm1OIv2cz9I8dkm0eufYn+lOSNQ4k3Tn54mV ZXUMHTLxSN0wlBlSFhNkn5ByQ5HkMJq9RiiCJVQ52tZwxJjlw8tp9PALalzye4JCIg6x +Qp6mP4C8Ho4/Pix3nljme+Hi4f6WuxSnDWIU3v/ox8LUGrnaFo6d5h81rio5JzwRfxV ooLEyMrBDFJjvc2G2TwwUjeLVN/C3Ts2LUM2Ftlav3Vg2/9MBDOtMUPxksmGT2l22/80 Kp6PJB4lo0FEyvePHYA+ZpBx7AH2oFbSyM50ifk/F4hQeA/95TP3oEoijsStnjrBlstm nR8A== X-Gm-Message-State: AOAM5308bJcAGUbHxfWKHrrGb3joUrI1UDpX3AsJZNSzc1MI0RXnXLjJ WrmJD5fx/dVauCbHIk0yW27BmKygXCbiFfuHdS6N6WRIHtFhvJIjPfH5JblQkOjLbAvB1lUCmXK ZLSYjJ5gCUO9rEaQ= X-Received: by 2002:a1c:2c45:: with SMTP id s66mr14424576wms.40.1591973561589; Fri, 12 Jun 2020 07:52:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDb7wtsbBKIK5Jby1Kz+peKBBPvIuXhdZpDu8O1dmNK/046yiLgjeKRP3cDXIMFk5FsxzhxA== X-Received: by 2002:a1c:2c45:: with SMTP id s66mr14424561wms.40.1591973561357; Fri, 12 Jun 2020 07:52:41 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:39 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 44/58] Support individual region unmap in libvhost-user Message-ID: <20200612141917.9446-45-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Johannes Berg , "Dr. David Alan Gilbert" , Raphael Norwitz , Stefan Hajnoczi , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Raphael Norwitz When the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS protocol feature is enabled, on memory hot-unplug qemu will transmit memory regions to remove individually using the new message VHOST_USER_REM_MEM_REG message. With this change, vhost-user backends build with libvhost-user can now unmap individual memory regions when receiving the VHOST_USER_REM_MEM_REG message. Qemu only sends VHOST_USER_REM_MEM_REG messages when the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS feature is negotiated, and support for that feature has not yet been added in libvhost-user, this new functionality is not yet used. Signed-off-by: Raphael Norwitz Message-Id: <1588533678-23450-10-git-send-email-raphael.norwitz@nutanix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- contrib/libvhost-user/libvhost-user.h | 1 + contrib/libvhost-user/libvhost-user.c | 63 +++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/contrib/libvhost-user/libvhost-user.h b/contrib/libvhost-user/= libvhost-user.h index 60ef7fd13e..f8439713a8 100644 --- a/contrib/libvhost-user/libvhost-user.h +++ b/contrib/libvhost-user/libvhost-user.h @@ -99,6 +99,7 @@ typedef enum VhostUserRequest { VHOST_USER_VRING_KICK =3D 35, VHOST_USER_GET_MAX_MEM_SLOTS =3D 36, VHOST_USER_ADD_MEM_REG =3D 37, + VHOST_USER_REM_MEM_REG =3D 38, VHOST_USER_MAX } VhostUserRequest; =20 diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/= libvhost-user.c index d8ee7a23a3..386449b697 100644 --- a/contrib/libvhost-user/libvhost-user.c +++ b/contrib/libvhost-user/libvhost-user.c @@ -139,6 +139,7 @@ vu_request_to_string(unsigned int req) REQ(VHOST_USER_VRING_KICK), REQ(VHOST_USER_GET_MAX_MEM_SLOTS), REQ(VHOST_USER_ADD_MEM_REG), + REQ(VHOST_USER_REM_MEM_REG), REQ(VHOST_USER_MAX), }; #undef REQ @@ -763,6 +764,66 @@ vu_add_mem_reg(VuDev *dev, VhostUserMsg *vmsg) { } } =20 +static inline bool reg_equal(VuDevRegion *vudev_reg, + VhostUserMemoryRegion *msg_reg) +{ + if (vudev_reg->gpa =3D=3D msg_reg->guest_phys_addr && + vudev_reg->qva =3D=3D msg_reg->userspace_addr && + vudev_reg->size =3D=3D msg_reg->memory_size) { + return true; + } + + return false; +} + +static bool +vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) { + int i, j; + bool found =3D false; + VuDevRegion shadow_regions[VHOST_MEMORY_MAX_NREGIONS] =3D {}; + VhostUserMemoryRegion m =3D vmsg->payload.memreg.region, *msg_region = =3D &m; + + DPRINT("Removing region:\n"); + DPRINT(" guest_phys_addr: 0x%016"PRIx64"\n", + msg_region->guest_phys_addr); + DPRINT(" memory_size: 0x%016"PRIx64"\n", + msg_region->memory_size); + DPRINT(" userspace_addr 0x%016"PRIx64"\n", + msg_region->userspace_addr); + DPRINT(" mmap_offset 0x%016"PRIx64"\n", + msg_region->mmap_offset); + + for (i =3D 0, j =3D 0; i < dev->nregions; i++) { + if (!reg_equal(&dev->regions[i], msg_region)) { + shadow_regions[j].gpa =3D dev->regions[i].gpa; + shadow_regions[j].size =3D dev->regions[i].size; + shadow_regions[j].qva =3D dev->regions[i].qva; + shadow_regions[j].mmap_offset =3D dev->regions[i].mmap_offset; + j++; + } else { + found =3D true; + VuDevRegion *r =3D &dev->regions[i]; + void *m =3D (void *) (uintptr_t) r->mmap_addr; + + if (m) { + munmap(m, r->size + r->mmap_offset); + } + } + } + + if (found) { + memcpy(dev->regions, shadow_regions, + sizeof(VuDevRegion) * VHOST_MEMORY_MAX_NREGIONS); + DPRINT("Successfully removed a region\n"); + dev->nregions--; + vmsg_set_reply_u64(vmsg, 0); + } else { + vu_panic(dev, "Specified region not found\n"); + } + + return true; +} + static bool vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg) { @@ -1771,6 +1832,8 @@ vu_process_message(VuDev *dev, VhostUserMsg *vmsg) return vu_handle_get_max_memslots(dev, vmsg); case VHOST_USER_ADD_MEM_REG: return vu_add_mem_reg(dev, vmsg); + case VHOST_USER_REM_MEM_REG: + return vu_rem_mem_reg(dev, vmsg); default: vmsg_close_fds(vmsg); vu_panic(dev, "Unhandled request: %d", vmsg->request); --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974675; cv=none; d=zohomail.com; s=zohoarc; b=Vct6xKnY650FrrjfS3fzp+39kxfly2BXlmmOFy8DVgHvxc/c05I2P5zmysNFYtR5MOqh+pAD50Y/3xi5OGxhAL36DKeecooCpVeNSP6lD50VWSQhoLKYgh+21H0F2CCy2P2/62GjL1Gn+NG9L1mmq2YroIOFUrRmXAOR4S7zSpw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974675; h=Content-Type: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=/ZfvYRjYmGPxNT0fOPfO9sBNQzeK+Gxo9SoF7dTSLww=; b=HBkQ0DBZEuuuordZoKYwttEyhHMiyM1XK1olse1mQeWHfgPZ7V1b6kV5jZQZ5JZ5t5oxCvyZeLOA/IpvUKTt4f/auyL7DrRLRexBcLNP3BD9bgTSQy+8YP/tWwO5elvV3sOgYlYqEFKjCNslfgxWyVYm/Y1aXLh5Inx3diJPzjs= 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 1591974675192789.4758059222519; Fri, 12 Jun 2020 08:11:15 -0700 (PDT) Received: from localhost ([::1]:52368 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlKr-0008Bf-Or for importer@patchew.org; Fri, 12 Jun 2020 11:11:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50502) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl37-0000TQ-By for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:53 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:58242 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl35-0001Zz-8O for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:52 -0400 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-451-vXICXpsROg-EMQxw7jBclA-1; Fri, 12 Jun 2020 10:52:45 -0400 Received: by mail-wm1-f71.google.com with SMTP id b63so3878202wme.1 for ; Fri, 12 Jun 2020 07:52:45 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id b81sm9781926wmc.5.2020.06.12.07.52.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973568; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/ZfvYRjYmGPxNT0fOPfO9sBNQzeK+Gxo9SoF7dTSLww=; b=i6MtViu3aH1bdqI++M2fTrcfwYFqmTsMFHtmlBTl3UCvxX0NtXtfsq2NRDMsGdI2TkQVb+ R0Ld+/MUOlnftKh9u2TU0DCR61shtHSmkgKR2mbfqtBYFPcm4o4W8jLapcrs7JovHrR8LW zlKQTE72tXXieEc5JWiOrFdPwQcwfwQ= X-MC-Unique: vXICXpsROg-EMQxw7jBclA-1 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=/ZfvYRjYmGPxNT0fOPfO9sBNQzeK+Gxo9SoF7dTSLww=; b=ZErFvFglDjC8Od+IKbFwpbm2rydDnrP/u6oVT3AvMYOKJeZaAXFB9m7cFBERmYw6P+ qGRjbITKnfIbOtc9BwChsxT4p0H+lry4OTgf/eOrlw5GzcW8vDL+Za7wJVGiDVVQBk5X 9iuga/BJ3J89sGicAVjY878drCOcz8jAjAo1vBDpoO5YNi4X2wgxTofEZm4O7oNwLHH8 hmDMLga3QeYGy/h0W00fYZO2nukI7L2qQeu0UW+xUtuCb6UjfP5Y+tUxCvez8i3KqeNN 8biBsP7VGg2GojaCywjQerW2vl4Fkce3rVFwb5aRMCDvM5se4xW3g15i8wXYTdqlwFpt tEIQ== X-Gm-Message-State: AOAM530GPcUkwwPtfCWqYiw6ltfcNNgXNcp4Qmv6uxXAvNRoSaQ45Jp7 2ZEBKUeb6K4riZnnK7cNZmzdGhI0gNf+6LeQPUzm75RiJPES1Jd4ckl1C4xcjQ8F3HwYoQMpVKl dfBKtfJuy9u+CbM0= X-Received: by 2002:a1c:4009:: with SMTP id n9mr13904814wma.104.1591973563889; Fri, 12 Jun 2020 07:52:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjLc0FcSoGpqNZ+8JaAgf5fjgVSv9uitAS1v95SMV89ijiX3CU2GAltlksjBA6mWZD5jhPDg== X-Received: by 2002:a1c:4009:: with SMTP id n9mr13904795wma.104.1591973563664; Fri, 12 Jun 2020 07:52:43 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:41 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 45/58] Lift max ram slots limit in libvhost-user Message-ID: <20200612141917.9446-46-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:17 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Johannes Berg , "Dr. David Alan Gilbert" , Raphael Norwitz , Stefan Hajnoczi , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Raphael Norwitz Historically, VMs with vhost-user devices could hot-add memory a maximum of 8 times. Now that the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS protocol feature has been added, VMs with vhost-user backends which support this new feature can support a configurable number of ram slots up to the maximum supported by the target platform. This change adds VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS support for backends built with libvhost-user, and increases the number of supported ram slots from 8 to 32. Memory hot-add, hot-remove and postcopy migration were tested with the vhost-user-bridge sample. Signed-off-by: Raphael Norwitz Message-Id: <1588533678-23450-11-git-send-email-raphael.norwitz@nutanix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- contrib/libvhost-user/libvhost-user.h | 15 +++++++++++---- contrib/libvhost-user/libvhost-user.c | 17 +++++++++-------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/contrib/libvhost-user/libvhost-user.h b/contrib/libvhost-user/= libvhost-user.h index f8439713a8..844c37c648 100644 --- a/contrib/libvhost-user/libvhost-user.h +++ b/contrib/libvhost-user/libvhost-user.h @@ -28,7 +28,13 @@ =20 #define VIRTQUEUE_MAX_SIZE 1024 =20 -#define VHOST_MEMORY_MAX_NREGIONS 8 +#define VHOST_MEMORY_BASELINE_NREGIONS 8 + +/* + * Set a reasonable maximum number of ram slots, which will be supported by + * any architecture. + */ +#define VHOST_USER_MAX_RAM_SLOTS 32 =20 typedef enum VhostSetConfigType { VHOST_SET_CONFIG_TYPE_MASTER =3D 0, @@ -55,6 +61,7 @@ enum VhostUserProtocolFeature { VHOST_USER_PROTOCOL_F_HOST_NOTIFIER =3D 11, VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD =3D 12, VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS =3D 14, + VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS =3D 15, =20 VHOST_USER_PROTOCOL_F_MAX }; @@ -123,7 +130,7 @@ typedef struct VhostUserMemoryRegion { typedef struct VhostUserMemory { uint32_t nregions; uint32_t padding; - VhostUserMemoryRegion regions[VHOST_MEMORY_MAX_NREGIONS]; + VhostUserMemoryRegion regions[VHOST_MEMORY_BASELINE_NREGIONS]; } VhostUserMemory; =20 typedef struct VhostUserMemRegMsg { @@ -190,7 +197,7 @@ typedef struct VhostUserMsg { VhostUserInflight inflight; } payload; =20 - int fds[VHOST_MEMORY_MAX_NREGIONS]; + int fds[VHOST_MEMORY_BASELINE_NREGIONS]; int fd_num; uint8_t *data; } VU_PACKED VhostUserMsg; @@ -368,7 +375,7 @@ typedef struct VuDevInflightInfo { struct VuDev { int sock; uint32_t nregions; - VuDevRegion regions[VHOST_MEMORY_MAX_NREGIONS]; + VuDevRegion regions[VHOST_USER_MAX_RAM_SLOTS]; VuVirtq *vq; VuDevInflightInfo inflight_info; int log_call_fd; diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/= libvhost-user.c index 386449b697..b1e607298c 100644 --- a/contrib/libvhost-user/libvhost-user.c +++ b/contrib/libvhost-user/libvhost-user.c @@ -269,7 +269,7 @@ have_userfault(void) static bool vu_message_read(VuDev *dev, int conn_fd, VhostUserMsg *vmsg) { - char control[CMSG_SPACE(VHOST_MEMORY_MAX_NREGIONS * sizeof(int))] =3D = { }; + char control[CMSG_SPACE(VHOST_MEMORY_BASELINE_NREGIONS * sizeof(int))]= =3D {}; struct iovec iov =3D { .iov_base =3D (char *)vmsg, .iov_len =3D VHOST_USER_HDR_SIZE, @@ -340,7 +340,7 @@ vu_message_write(VuDev *dev, int conn_fd, VhostUserMsg = *vmsg) { int rc; uint8_t *p =3D (uint8_t *)vmsg; - char control[CMSG_SPACE(VHOST_MEMORY_MAX_NREGIONS * sizeof(int))] =3D = { }; + char control[CMSG_SPACE(VHOST_MEMORY_BASELINE_NREGIONS * sizeof(int))]= =3D {}; struct iovec iov =3D { .iov_base =3D (char *)vmsg, .iov_len =3D VHOST_USER_HDR_SIZE, @@ -353,7 +353,7 @@ vu_message_write(VuDev *dev, int conn_fd, VhostUserMsg = *vmsg) struct cmsghdr *cmsg; =20 memset(control, 0, sizeof(control)); - assert(vmsg->fd_num <=3D VHOST_MEMORY_MAX_NREGIONS); + assert(vmsg->fd_num <=3D VHOST_MEMORY_BASELINE_NREGIONS); if (vmsg->fd_num > 0) { size_t fdsize =3D vmsg->fd_num * sizeof(int); msg.msg_controllen =3D CMSG_SPACE(fdsize); @@ -780,7 +780,7 @@ static bool vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) { int i, j; bool found =3D false; - VuDevRegion shadow_regions[VHOST_MEMORY_MAX_NREGIONS] =3D {}; + VuDevRegion shadow_regions[VHOST_USER_MAX_RAM_SLOTS] =3D {}; VhostUserMemoryRegion m =3D vmsg->payload.memreg.region, *msg_region = =3D &m; =20 DPRINT("Removing region:\n"); @@ -813,7 +813,7 @@ vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) { =20 if (found) { memcpy(dev->regions, shadow_regions, - sizeof(VuDevRegion) * VHOST_MEMORY_MAX_NREGIONS); + sizeof(VuDevRegion) * VHOST_USER_MAX_RAM_SLOTS); DPRINT("Successfully removed a region\n"); dev->nregions--; vmsg_set_reply_u64(vmsg, 0); @@ -1394,7 +1394,8 @@ vu_get_protocol_features_exec(VuDev *dev, VhostUserMs= g *vmsg) 1ULL << VHOST_USER_PROTOCOL_F_SLAVE_REQ | 1ULL << VHOST_USER_PROTOCOL_F_HOST_NOTIFIER | 1ULL << VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD | - 1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK; + 1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK | + 1ULL << VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS; =20 if (have_userfault()) { features |=3D 1ULL << VHOST_USER_PROTOCOL_F_PAGEFAULT; @@ -1732,14 +1733,14 @@ static bool vu_handle_get_max_memslots(VuDev *dev, = VhostUserMsg *vmsg) { vmsg->flags =3D VHOST_USER_REPLY_MASK | VHOST_USER_VERSION; vmsg->size =3D sizeof(vmsg->payload.u64); - vmsg->payload.u64 =3D VHOST_MEMORY_MAX_NREGIONS; + vmsg->payload.u64 =3D VHOST_USER_MAX_RAM_SLOTS; vmsg->fd_num =3D 0; =20 if (!vu_message_write(dev, dev->sock, vmsg)) { vu_panic(dev, "Failed to send max ram slots: %s\n", strerror(errno= )); } =20 - DPRINT("u64: 0x%016"PRIx64"\n", (uint64_t) VHOST_MEMORY_MAX_NREGIONS); + DPRINT("u64: 0x%016"PRIx64"\n", (uint64_t) VHOST_USER_MAX_RAM_SLOTS); =20 return false; } --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974734; cv=none; d=zohomail.com; s=zohoarc; b=U7+C2+koZVgxfcCzkqqSLdiAUR08Z5gItbac00wz4zRyuTZoqffE3wIWgOfATNmLgQBWtcvntqu8iB1TV98zrjfBCqd1D2znXEH6SCEreaHrHGtviUylLEsdcqv8kgOwaq7bYMc9CtIgFftC9QEAfQxr+sSWfglcjUvhG3CmQKw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974734; 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=kF29j1OTXstILIv0rMUhyWfGCjzS5Fq6k2w7s6M2f5A=; b=RfpJBG9A18iOIImBUk6Z+p1d6yDkRi2MF6vXwa9bl46HCVMcRg5rRlA9B+Jp5RaR+bHx9cXesUQN/xpwlcFyhjmzHnXLNY+fCRKupDWP3f8rAfw8VcsimWwR9B2Gj4zslHO1g8ZeuQm27fJFirAUPixk9m6457rOa06PT13zms0= 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 1591974734087213.90848726742968; Fri, 12 Jun 2020 08:12:14 -0700 (PDT) Received: from localhost ([::1]:58044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlLp-0002NO-9L for importer@patchew.org; Fri, 12 Jun 2020 11:12:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50510) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl37-0000Vl-UG for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:53 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:49237 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl35-0001a8-AD for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:53 -0400 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-326-GeWjsw_VNry1kdInVepOeQ-1; Fri, 12 Jun 2020 10:52:47 -0400 Received: by mail-wr1-f69.google.com with SMTP id n6so3999847wrv.6 for ; Fri, 12 Jun 2020 07:52:47 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id d17sm11158256wrg.75.2020.06.12.07.52.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973570; 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=kF29j1OTXstILIv0rMUhyWfGCjzS5Fq6k2w7s6M2f5A=; b=HPul0GmaX72Pez3lHY7zmKKQws9thWrFvSCXY3Ls2UZQYMeoecx63UQHnY1RC0TGF6fUq1 qc7TwAd7iRFncdg5zfAnAQkFiSG4+GkoQ5SCy/oL4q/4C/ofwN2034Nr4C2GeGML9SCgbs Rycq5Xhf7L7Pl/krKoC6zB/JEYqKQ6c= X-MC-Unique: GeWjsw_VNry1kdInVepOeQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=kF29j1OTXstILIv0rMUhyWfGCjzS5Fq6k2w7s6M2f5A=; b=F/wdDSQY4tRxCgLubccSrp/lFQBxpH9EKd1hYk2GUBvz3UramCFAa08xfGC5X9a3EI zNeC04F1+xmiL7+uPTBhYy5+4n18gO6w8+VNmCE2M84TvdjNj7iaLqfIQ82x0SmVkqDv u9vfqQl2IzRfK3Q29lyX0M8w1SUFW29a6HXCqUn2iP5UhyCM0KEttR48iBNXDo6JIrx6 2zxEj3kt9weFR+nnWXrXU9cATJUteDQosy8MEveReyxKGWOsCYBprzzpSMyXkEV93EpX YdNSOhEhPTK49dpadEmheYC9xfhEzPunmS8i880XYOTRqQVeJFBY18vBQoFTa8wbl298 jxkw== X-Gm-Message-State: AOAM533jdSlJko87YAgb+X7Ya292ttNXJICIRfj/bzPuEbSz34/bsCa9 xT4ZMd2+4vRv7AZmypDcWXN0ebrSZn+qFYOo9mReNcNaRA7PuweiQggs2Is/h/LVmmPQGuTii7F fPE3oB57nQUTXgME= X-Received: by 2002:a1c:3c6:: with SMTP id 189mr13554781wmd.81.1591973566077; Fri, 12 Jun 2020 07:52:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIUN24kRkXTK+qkh9f3ZqA2ipoAKt+lZuazLbr/C1qQRIoO4wwxn/5EVh3B0bqkDcgaC/18g== X-Received: by 2002:a1c:3c6:: with SMTP id 189mr13554762wmd.81.1591973565845; Fri, 12 Jun 2020 07:52:45 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:44 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 46/58] libvhost-user: advertise vring features Message-ID: <20200612141917.9446-47-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 09:30:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jason Wang , Raphael Norwitz , Stefan Hajnoczi , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Stefan Hajnoczi libvhost-user implements several vring features without advertising them. There is no way for the vhost-user master to detect support for these features. Things more or less work today because QEMU assumes the vhost-user backend always implements certain feature bits like VIRTIO_RING_F_EVENT_IDX. This is not documented anywhere. This patch explicitly advertises features implemented in libvhost-user so that the vhost-user master does not need to make undocumented assumptions. Feature bits that libvhost-user now advertises can be removed from vhost-user-blk.c. Devices should not be responsible for advertising vring feature bits, that is libvhost-user's job. Cc: Marc-Andr=C3=A9 Lureau Cc: Jason Wang Cc: Michael S. Tsirkin Signed-off-by: Stefan Hajnoczi Message-Id: <20200529161338.456017-1-stefanha@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Marc-Andr=C3=A9 Lureau --- contrib/libvhost-user/libvhost-user.c | 10 ++++++++++ contrib/vhost-user-blk/vhost-user-blk.c | 4 +--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/= libvhost-user.c index b1e607298c..d315db1396 100644 --- a/contrib/libvhost-user/libvhost-user.c +++ b/contrib/libvhost-user/libvhost-user.c @@ -498,6 +498,16 @@ static bool vu_get_features_exec(VuDev *dev, VhostUserMsg *vmsg) { vmsg->payload.u64 =3D + /* + * The following VIRTIO feature bits are supported by our virtqueue + * implementation: + */ + 1ULL << VIRTIO_F_NOTIFY_ON_EMPTY | + 1ULL << VIRTIO_RING_F_INDIRECT_DESC | + 1ULL << VIRTIO_RING_F_EVENT_IDX | + 1ULL << VIRTIO_F_VERSION_1 | + + /* vhost-user feature bits */ 1ULL << VHOST_F_LOG_ALL | 1ULL << VHOST_USER_F_PROTOCOL_FEATURES; =20 diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-b= lk/vhost-user-blk.c index 6fd91c7e99..25eccd02b5 100644 --- a/contrib/vhost-user-blk/vhost-user-blk.c +++ b/contrib/vhost-user-blk/vhost-user-blk.c @@ -382,9 +382,7 @@ vub_get_features(VuDev *dev) 1ull << VIRTIO_BLK_F_DISCARD | 1ull << VIRTIO_BLK_F_WRITE_ZEROES | #endif - 1ull << VIRTIO_BLK_F_CONFIG_WCE | - 1ull << VIRTIO_F_VERSION_1 | - 1ull << VHOST_USER_F_PROTOCOL_FEATURES; + 1ull << VIRTIO_BLK_F_CONFIG_WCE; =20 if (vdev_blk->enable_ro) { features |=3D 1ull << VIRTIO_BLK_F_RO; --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974856; cv=none; d=zohomail.com; s=zohoarc; b=CTaPdg/c4aOAzoqbrp0iym7PDR6qYmV1OVb+CR+KiSXdFGQDCy7ZY2ns7Zrhfnq6A2TBhclIXRi1JpeInq/yNOJEDhRt5jEMPK6oTmALPtF+S4zM9yL9Zf1vqDElRhYWHz1QVFCbJlYWz/PBK+xbtp/qFolZMpyJE+eWOzNgmX8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974856; h=Content-Type: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=2UE9wdKZP6GU89BTo6VTTIYbzUF0RJkP16ivEbUjuuA=; b=P7iP1RPUowiraBFUclaXZ27pvxUldMK7FHKyfPWCbV3u4SSZsTk4cn3aQddJg706F4o64HVaP/AAMyMDPLDrBUbQQ4bwTlLZfdpciFfkQpNYcp2SetLhMERwZ4uGVKdXYb0HhvRxlpBsItk1dWSs0M00syeT5hIXwqLz2fz5sEM= 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 1591974856809212.88795925744876; Fri, 12 Jun 2020 08:14:16 -0700 (PDT) Received: from localhost ([::1]:38096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlNn-00076h-Ph for importer@patchew.org; Fri, 12 Jun 2020 11:14:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl38-0000WO-8D for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:54 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:42277 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl35-0001aS-Tz for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:52:53 -0400 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-155-KWVTdW7nNQuChF4PgqDi8g-1; Fri, 12 Jun 2020 10:52:49 -0400 Received: by mail-wm1-f69.google.com with SMTP id h6so2036195wmb.7 for ; Fri, 12 Jun 2020 07:52:49 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id b18sm10084354wrn.88.2020.06.12.07.52.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973571; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2UE9wdKZP6GU89BTo6VTTIYbzUF0RJkP16ivEbUjuuA=; b=AaXPTsXlNd1IzM8ahfawdObPbfgyCtFoXePUUAPxWFEg4YWo+Hin1vF22Jpy0pwAaTcRPz /kkM3ubS3dE4ldVt9FfZkiFCfJQhOkRclsl8YB8QUS0dclJVh+qiXsNPDzF+EMMCuOYNTQ /mXnQp+FKeyEebWzCZr2csypSBF6EhQ= X-MC-Unique: KWVTdW7nNQuChF4PgqDi8g-1 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=2UE9wdKZP6GU89BTo6VTTIYbzUF0RJkP16ivEbUjuuA=; b=YagvGUylD/wNTzhp4qL413ZLj3zfHMtQ5MNWMhdycfs4LjVuDMFMAMLxGeoCZNANRY gKQc0jGehchAC+uRwJ7BwcPAHh3HaWth928IJjiNqzFcO9KqJL4b1i7iNX1UD/5bQZQI VwOdjF7e+X2/itdFopq7cXCXfSRvtzoqzmsY1MHr4BXsd5ZZUtZxYil9RUOWeGgj5FD6 wreIFp4L2bsCcu1V9dwR5COoRo+VmMHHIh28HtikJNVpDXHbGrM5HTQIBzIwcNcTEc6h id1d2Mp8WwExMGwRZdXIEcz6RJiseeQqiTBEVVExByLdjfefGmEm6Fkhps0k6m4kkgFg iGMA== X-Gm-Message-State: AOAM533AkGRCDCMscw3nW/YY+e0SIRXYw6NlGtWM1fzbRjTGdcmCSxJJ QtP72NIhMTtkbqa3pmed1JCQTH+8pK1hm7l3T3XZeekGjdAQSaURBTTptuuwIYavIUh/dh+ckfC WTVBrufNni8or/m0= X-Received: by 2002:a5d:4204:: with SMTP id n4mr16273471wrq.247.1591973568206; Fri, 12 Jun 2020 07:52:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZlkO4kO5MY1FZomgO4/NlH1Ek4W1n/n3KbFkeQy9NdcJqYFtZVERHzn89w/5ZN7DOejcnvw== X-Received: by 2002:a5d:4204:: with SMTP id n4mr16273441wrq.247.1591973567887; Fri, 12 Jun 2020 07:52:47 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:46 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 47/58] hw/pci: Fix crash when running QEMU with "-nic model=rocker" Message-ID: <20200612141917.9446-48-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:17 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , Michael Tokarev , 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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Thomas Huth QEMU currently aborts when being started with "-nic model=3Drocker" or with "-net nic,model=3Drocker". This happens because the "rocker" device is not a normal NIC but a switch, which has different properties. Thus we should only consider real NIC devices for "-nic" and "-net". These devices can be identified by the "netdev" property, so check for this property before adding the device to the list. Reported-by: Michael Tokarev Fixes: 52310c3fa7dc854d ("net: allow using any PCI NICs in -net or -nic") Signed-off-by: Thomas Huth Message-Id: <20200527153152.9211-1-thuth@redhat.com> Reviewed-by: Paolo Bonzini Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci/pci.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 7bf2ae6d92..1b88a32cf7 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1891,7 +1891,18 @@ PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *= rootbus, if (test_bit(DEVICE_CATEGORY_NETWORK, dc->categories) && dc->user_creatable) { const char *name =3D object_class_get_name(list->data); - g_ptr_array_add(pci_nic_models, (gpointer)name); + /* + * A network device might also be something else than a NIC, s= ee + * e.g. the "rocker" device. Thus we have to look for the "net= dev" + * property, too. Unfortunately, some devices like virtio-net = only + * create this property during instance_init, so we have to cr= eate + * a temporary instance here to be able to check it. + */ + Object *obj =3D object_new_with_class(OBJECT_CLASS(dc)); + if (object_property_find(obj, "netdev", NULL)) { + g_ptr_array_add(pci_nic_models, (gpointer)name); + } + object_unref(obj); } next =3D list->next; g_slist_free_1(list); --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.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=1591975641; cv=none; d=zohomail.com; s=zohoarc; b=npfAuK3Py16xwy3Peh6a9Z3Y54WSDvJT2lbsHetEIikr6W0vkEkw5d3SieBH2aQiIPlT0NzRqKKkrqVM1Vre+/O10BPUcS0NbRfhEtNY16xHncv+mNUQx5sw5kzN2xxangvRBa5iEhbgmoXnGGfoq1kbN76z56+oGIHKIwSOwKY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591975641; h=Content-Type: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=MLMSPF+8gptcbag5dodTS3gEYTPDQrFUlsCRvov1pS4=; b=jnqIA4WHHm60j1ehMJqiLd+zqQ+2+y7K6oCwwmBeet3WWvT3OkUKvdklH/IvMhSXzXsWd1TH18oqH5bIRrjQ1IX+v/r3hdgkKlYbZaNsRhYRUYrTa5wsmrOeHVyzUgb2EnOqHn7wZKsxS/1OIMtMyOfw9xFiqea9AwxuAZgCt+E= 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 1591975641563405.5099392484358; Fri, 12 Jun 2020 08:27:21 -0700 (PDT) Received: from localhost ([::1]:59414 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlaS-0004BQ-5E for importer@patchew.org; Fri, 12 Jun 2020 11:27:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52046) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl6I-0006vY-3I for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:56:10 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:38980 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl6B-0002LG-D5 for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:56:09 -0400 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-231-SNyJWdGANuGFBiTePYe-eA-1; Fri, 12 Jun 2020 10:52:52 -0400 Received: by mail-wr1-f69.google.com with SMTP id s7so3993280wrm.16 for ; Fri, 12 Jun 2020 07:52:52 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id d9sm10285901wre.28.2020.06.12.07.52.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973762; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=MLMSPF+8gptcbag5dodTS3gEYTPDQrFUlsCRvov1pS4=; b=RXuTVFFN9eFqEHFdkC+TN91GVWH6Um2nVFAuIvzSCmY3NN0a+l3jRI9CAtAfLRR7LLI9h3 fbEN1PV5jCjr2tVeJcwlEvRX4DrqemCQsYxkuo1kB1iDmwEyjUllNnfPEncBt/aWqkLKDs zGW6Za8rBsxrrT8TTr+kq8WZMrMk8hk= X-MC-Unique: SNyJWdGANuGFBiTePYe-eA-1 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=MLMSPF+8gptcbag5dodTS3gEYTPDQrFUlsCRvov1pS4=; b=SDTHAIZJxDJeWAKAmXJfnQ321LH33WFVSDhnm3DmnJP2GKIUX7b+HEGLrsfgrAqU2Q AFsa/sSxySMKmtfWzf795pI27No7zqlSf0V5tF0P/dBN5NTlwiSQu5mHgzPcBb9upHjG SrZiQQr3fq63I4M1aZAyiD45xPKeEcGAEKqYWnvVzg506rCpUS7m3UQ/U5Ekz1ZZBB/I uFzN4oCm8XY+4iIBC0jKknKUCFECHw4vpGAbk1hksYPEnipsUek194ldUfViNXxWK/BY mSdW8Jtid/GgSadCLB2pi2QdhovkfyLhcnTeld7Qz6NufDggtWdDT2gw+b5HdNwv9m4W 5YtA== X-Gm-Message-State: AOAM531vO7cFZ+ZLLddUaiLtSmNhvGFZWnboGik6qULvLX9pyo5I7WdK g50/48aPF9yBaLgkWxwWTvpcBglgiJ48KYc+oiX2fkOF2fnMQVeE1xSeGFmwYqwgfAnAIzaxvxQ AWCeiG6VwgZrwuos= X-Received: by 2002:a7b:cbcc:: with SMTP id n12mr13135332wmi.127.1591973570519; Fri, 12 Jun 2020 07:52:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoOLFdeNOr3n5CNB9UBxmp8oBbZyxmFTDjme6Gl6d8+N9rA26qVdm9YKnEgHWuYedVT8h8Fg== X-Received: by 2002:a7b:cbcc:: with SMTP id n12mr13135288wmi.127.1591973569922; Fri, 12 Jun 2020 07:52:49 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:48 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 48/58] vhost-vsock: add vhost-vsock-common abstraction Message-ID: <20200612141917.9446-49-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:17 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefano Garzarella Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Stefano Garzarella This patch prepares the introduction of vhost-user-vsock, moving the common code usable for both vhost-vsock and vhost-user-vsock devices, in the new vhost-vsock-common parent class. While moving the code, fixed checkpatch warnings about block comments. Signed-off-by: Stefano Garzarella Message-Id: <20200522122512.87413-2-sgarzare@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost-vsock-common.h | 47 ++++ include/hw/virtio/vhost-vsock.h | 11 +- hw/virtio/vhost-vsock-common.c | 258 ++++++++++++++++++++++ hw/virtio/vhost-vsock.c | 283 ++++--------------------- hw/virtio/Makefile.objs | 2 +- 5 files changed, 350 insertions(+), 251 deletions(-) create mode 100644 include/hw/virtio/vhost-vsock-common.h create mode 100644 hw/virtio/vhost-vsock-common.c diff --git a/include/hw/virtio/vhost-vsock-common.h b/include/hw/virtio/vho= st-vsock-common.h new file mode 100644 index 0000000000..f8b4aaae00 --- /dev/null +++ b/include/hw/virtio/vhost-vsock-common.h @@ -0,0 +1,47 @@ +/* + * Parent class for vhost-vsock devices + * + * Copyright 2015-2020 Red Hat, Inc. + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * (at your option) any later version. See the COPYING file in the + * top-level directory. + */ + +#ifndef _QEMU_VHOST_VSOCK_COMMON_H +#define _QEMU_VHOST_VSOCK_COMMON_H + +#include "hw/virtio/virtio.h" +#include "hw/virtio/vhost.h" + +#define TYPE_VHOST_VSOCK_COMMON "vhost-vsock-common" +#define VHOST_VSOCK_COMMON(obj) \ + OBJECT_CHECK(VHostVSockCommon, (obj), TYPE_VHOST_VSOCK_COMMON) + +enum { + VHOST_VSOCK_SAVEVM_VERSION =3D 0, + + VHOST_VSOCK_QUEUE_SIZE =3D 128, +}; + +typedef struct { + VirtIODevice parent; + + struct vhost_virtqueue vhost_vqs[2]; + struct vhost_dev vhost_dev; + + VirtQueue *event_vq; + VirtQueue *recv_vq; + VirtQueue *trans_vq; + + QEMUTimer *post_load_timer; +} VHostVSockCommon; + +int vhost_vsock_common_start(VirtIODevice *vdev); +void vhost_vsock_common_stop(VirtIODevice *vdev); +int vhost_vsock_common_pre_save(void *opaque); +int vhost_vsock_common_post_load(void *opaque, int version_id); +void vhost_vsock_common_realize(VirtIODevice *vdev, const char *name); +void vhost_vsock_common_unrealize(VirtIODevice *vdev); + +#endif /* _QEMU_VHOST_VSOCK_COMMON_H */ diff --git a/include/hw/virtio/vhost-vsock.h b/include/hw/virtio/vhost-vsoc= k.h index bc5a988ee5..8cbb7b90f9 100644 --- a/include/hw/virtio/vhost-vsock.h +++ b/include/hw/virtio/vhost-vsock.h @@ -14,8 +14,7 @@ #ifndef QEMU_VHOST_VSOCK_H #define QEMU_VHOST_VSOCK_H =20 -#include "hw/virtio/virtio.h" -#include "hw/virtio/vhost.h" +#include "hw/virtio/vhost-vsock-common.h" =20 #define TYPE_VHOST_VSOCK "vhost-vsock-device" #define VHOST_VSOCK(obj) \ @@ -28,14 +27,8 @@ typedef struct { =20 typedef struct { /*< private >*/ - VirtIODevice parent; + VHostVSockCommon parent; VHostVSockConf conf; - 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 >*/ } VHostVSock; diff --git a/hw/virtio/vhost-vsock-common.c b/hw/virtio/vhost-vsock-common.c new file mode 100644 index 0000000000..5b2ebf3496 --- /dev/null +++ b/hw/virtio/vhost-vsock-common.c @@ -0,0 +1,258 @@ +/* + * Parent class for vhost-vsock devices + * + * Copyright 2015-2020 Red Hat, Inc. + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * (at your option) any later version. See the COPYING file in the + * top-level directory. + */ + +#include "qemu/osdep.h" +#include "standard-headers/linux/virtio_vsock.h" +#include "qapi/error.h" +#include "hw/virtio/virtio-access.h" +#include "qemu/error-report.h" +#include "hw/qdev-properties.h" +#include "hw/virtio/vhost-vsock.h" +#include "qemu/iov.h" +#include "monitor/monitor.h" + +int vhost_vsock_common_start(VirtIODevice *vdev) +{ + VHostVSockCommon *vvc =3D VHOST_VSOCK_COMMON(vdev); + BusState *qbus =3D BUS(qdev_get_parent_bus(DEVICE(vdev))); + VirtioBusClass *k =3D VIRTIO_BUS_GET_CLASS(qbus); + int ret; + int i; + + if (!k->set_guest_notifiers) { + error_report("binding does not support guest notifiers"); + return -ENOSYS; + } + + ret =3D vhost_dev_enable_notifiers(&vvc->vhost_dev, vdev); + if (ret < 0) { + error_report("Error enabling host notifiers: %d", -ret); + return ret; + } + + ret =3D k->set_guest_notifiers(qbus->parent, vvc->vhost_dev.nvqs, true= ); + if (ret < 0) { + error_report("Error binding guest notifier: %d", -ret); + goto err_host_notifiers; + } + + vvc->vhost_dev.acked_features =3D vdev->guest_features; + ret =3D vhost_dev_start(&vvc->vhost_dev, vdev); + if (ret < 0) { + error_report("Error starting vhost: %d", -ret); + goto err_guest_notifiers; + } + + /* + * guest_notifier_mask/pending not used yet, so just unmask + * everything here. virtio-pci will do the right thing by + * enabling/disabling irqfd. + */ + for (i =3D 0; i < vvc->vhost_dev.nvqs; i++) { + vhost_virtqueue_mask(&vvc->vhost_dev, vdev, i, false); + } + + return 0; + +err_guest_notifiers: + k->set_guest_notifiers(qbus->parent, vvc->vhost_dev.nvqs, false); +err_host_notifiers: + vhost_dev_disable_notifiers(&vvc->vhost_dev, vdev); + return ret; +} + +void vhost_vsock_common_stop(VirtIODevice *vdev) +{ + VHostVSockCommon *vvc =3D VHOST_VSOCK_COMMON(vdev); + BusState *qbus =3D BUS(qdev_get_parent_bus(DEVICE(vdev))); + VirtioBusClass *k =3D VIRTIO_BUS_GET_CLASS(qbus); + int ret; + + if (!k->set_guest_notifiers) { + return; + } + + vhost_dev_stop(&vvc->vhost_dev, vdev); + + ret =3D k->set_guest_notifiers(qbus->parent, vvc->vhost_dev.nvqs, fals= e); + if (ret < 0) { + error_report("vhost guest notifier cleanup failed: %d", ret); + return; + } + + vhost_dev_disable_notifiers(&vvc->vhost_dev, vdev); +} + + +static void vhost_vsock_common_handle_output(VirtIODevice *vdev, VirtQueue= *vq) +{ + /* Do nothing */ +} + +static void vhost_vsock_common_guest_notifier_mask(VirtIODevice *vdev, int= idx, + bool mask) +{ + VHostVSockCommon *vvc =3D VHOST_VSOCK_COMMON(vdev); + + vhost_virtqueue_mask(&vvc->vhost_dev, vdev, idx, mask); +} + +static bool vhost_vsock_common_guest_notifier_pending(VirtIODevice *vdev, + int idx) +{ + VHostVSockCommon *vvc =3D VHOST_VSOCK_COMMON(vdev); + + return vhost_virtqueue_pending(&vvc->vhost_dev, idx); +} + +static void vhost_vsock_common_send_transport_reset(VHostVSockCommon *vvc) +{ + VirtQueueElement *elem; + VirtQueue *vq =3D vvc->event_vq; + struct virtio_vsock_event event =3D { + .id =3D cpu_to_le32(VIRTIO_VSOCK_EVENT_TRANSPORT_RESET), + }; + + elem =3D virtqueue_pop(vq, sizeof(VirtQueueElement)); + if (!elem) { + error_report("vhost-vsock missed transport reset event"); + return; + } + + if (elem->out_num) { + error_report("invalid vhost-vsock event virtqueue element with " + "out buffers"); + goto out; + } + + if (iov_from_buf(elem->in_sg, elem->in_num, 0, + &event, sizeof(event)) !=3D sizeof(event)) { + error_report("vhost-vsock event virtqueue element is too short"); + goto out; + } + + virtqueue_push(vq, elem, sizeof(event)); + virtio_notify(VIRTIO_DEVICE(vvc), vq); + +out: + g_free(elem); +} + +static void vhost_vsock_common_post_load_timer_cleanup(VHostVSockCommon *v= vc) +{ + if (!vvc->post_load_timer) { + return; + } + + timer_del(vvc->post_load_timer); + timer_free(vvc->post_load_timer); + vvc->post_load_timer =3D NULL; +} + +static void vhost_vsock_common_post_load_timer_cb(void *opaque) +{ + VHostVSockCommon *vvc =3D opaque; + + vhost_vsock_common_post_load_timer_cleanup(vvc); + vhost_vsock_common_send_transport_reset(vvc); +} + +int vhost_vsock_common_pre_save(void *opaque) +{ + VHostVSockCommon *vvc =3D opaque; + + /* + * At this point, backend must be stopped, otherwise + * it might keep writing to memory. + */ + assert(!vvc->vhost_dev.started); + + return 0; +} + +int vhost_vsock_common_post_load(void *opaque, int version_id) +{ + VHostVSockCommon *vvc =3D opaque; + VirtIODevice *vdev =3D VIRTIO_DEVICE(vvc); + + if (virtio_queue_get_addr(vdev, 2)) { + /* + * Defer transport reset event to a vm clock timer so that virtque= ue + * changes happen after migration has completed. + */ + assert(!vvc->post_load_timer); + vvc->post_load_timer =3D + timer_new_ns(QEMU_CLOCK_VIRTUAL, + vhost_vsock_common_post_load_timer_cb, + vvc); + timer_mod(vvc->post_load_timer, 1); + } + return 0; +} + +void vhost_vsock_common_realize(VirtIODevice *vdev, const char *name) +{ + VHostVSockCommon *vvc =3D VHOST_VSOCK_COMMON(vdev); + + virtio_init(vdev, name, VIRTIO_ID_VSOCK, + sizeof(struct virtio_vsock_config)); + + /* Receive and transmit queues belong to vhost */ + vvc->recv_vq =3D virtio_add_queue(vdev, VHOST_VSOCK_QUEUE_SIZE, + vhost_vsock_common_handle_output); + vvc->trans_vq =3D virtio_add_queue(vdev, VHOST_VSOCK_QUEUE_SIZE, + vhost_vsock_common_handle_output); + + /* The event queue belongs to QEMU */ + vvc->event_vq =3D virtio_add_queue(vdev, VHOST_VSOCK_QUEUE_SIZE, + vhost_vsock_common_handle_output); + + vvc->vhost_dev.nvqs =3D ARRAY_SIZE(vvc->vhost_vqs); + vvc->vhost_dev.vqs =3D vvc->vhost_vqs; + + vvc->post_load_timer =3D NULL; +} + +void vhost_vsock_common_unrealize(VirtIODevice *vdev) +{ + VHostVSockCommon *vvc =3D VHOST_VSOCK_COMMON(vdev); + + vhost_vsock_common_post_load_timer_cleanup(vvc); + + virtio_delete_queue(vvc->recv_vq); + virtio_delete_queue(vvc->trans_vq); + virtio_delete_queue(vvc->event_vq); + virtio_cleanup(vdev); +} + +static void vhost_vsock_common_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtioDeviceClass *vdc =3D VIRTIO_DEVICE_CLASS(klass); + + set_bit(DEVICE_CATEGORY_MISC, dc->categories); + vdc->guest_notifier_mask =3D vhost_vsock_common_guest_notifier_mask; + vdc->guest_notifier_pending =3D vhost_vsock_common_guest_notifier_pend= ing; +} + +static const TypeInfo vhost_vsock_common_info =3D { + .name =3D TYPE_VHOST_VSOCK_COMMON, + .parent =3D TYPE_VIRTIO_DEVICE, + .instance_size =3D sizeof(VHostVSockCommon), + .class_init =3D vhost_vsock_common_class_init, + .abstract =3D true, +}; + +static void vhost_vsock_common_register_types(void) +{ + type_register_static(&vhost_vsock_common_info); +} + +type_init(vhost_vsock_common_register_types) diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c index 4a228f5168..c8f0699b4f 100644 --- a/hw/virtio/vhost-vsock.c +++ b/hw/virtio/vhost-vsock.c @@ -12,24 +12,14 @@ */ =20 #include "qemu/osdep.h" -#include #include "standard-headers/linux/virtio_vsock.h" #include "qapi/error.h" -#include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-access.h" #include "qemu/error-report.h" #include "hw/qdev-properties.h" #include "hw/virtio/vhost-vsock.h" -#include "qemu/iov.h" -#include "qemu/module.h" #include "monitor/monitor.h" =20 -enum { - VHOST_VSOCK_SAVEVM_VERSION =3D 0, - - VHOST_VSOCK_QUEUE_SIZE =3D 128, -}; - static void vhost_vsock_get_config(VirtIODevice *vdev, uint8_t *config) { VHostVSock *vsock =3D VHOST_VSOCK(vdev); @@ -39,16 +29,18 @@ static void vhost_vsock_get_config(VirtIODevice *vdev, = uint8_t *config) memcpy(config, &vsockcfg, sizeof(vsockcfg)); } =20 -static int vhost_vsock_set_guest_cid(VHostVSock *vsock) +static int vhost_vsock_set_guest_cid(VirtIODevice *vdev) { - const VhostOps *vhost_ops =3D vsock->vhost_dev.vhost_ops; + VHostVSockCommon *vvc =3D VHOST_VSOCK_COMMON(vdev); + VHostVSock *vsock =3D VHOST_VSOCK(vdev); + const VhostOps *vhost_ops =3D vvc->vhost_dev.vhost_ops; int ret; =20 if (!vhost_ops->vhost_vsock_set_guest_cid) { return -ENOSYS; } =20 - ret =3D vhost_ops->vhost_vsock_set_guest_cid(&vsock->vhost_dev, + ret =3D vhost_ops->vhost_vsock_set_guest_cid(&vvc->vhost_dev, vsock->conf.guest_cid); if (ret < 0) { return -errno; @@ -56,123 +48,58 @@ static int vhost_vsock_set_guest_cid(VHostVSock *vsock) return 0; } =20 -static int vhost_vsock_set_running(VHostVSock *vsock, int start) +static int vhost_vsock_set_running(VirtIODevice *vdev, int start) { - const VhostOps *vhost_ops =3D vsock->vhost_dev.vhost_ops; + VHostVSockCommon *vvc =3D VHOST_VSOCK_COMMON(vdev); + const VhostOps *vhost_ops =3D vvc->vhost_dev.vhost_ops; int ret; =20 if (!vhost_ops->vhost_vsock_set_running) { return -ENOSYS; } =20 - ret =3D vhost_ops->vhost_vsock_set_running(&vsock->vhost_dev, start); + ret =3D vhost_ops->vhost_vsock_set_running(&vvc->vhost_dev, start); if (ret < 0) { return -errno; } return 0; } =20 -static void vhost_vsock_start(VirtIODevice *vdev) -{ - VHostVSock *vsock =3D VHOST_VSOCK(vdev); - BusState *qbus =3D BUS(qdev_get_parent_bus(DEVICE(vdev))); - VirtioBusClass *k =3D VIRTIO_BUS_GET_CLASS(qbus); - int ret; - int i; - - if (!k->set_guest_notifiers) { - error_report("binding does not support guest notifiers"); - return; - } - - ret =3D vhost_dev_enable_notifiers(&vsock->vhost_dev, vdev); - if (ret < 0) { - error_report("Error enabling host notifiers: %d", -ret); - return; - } - - ret =3D k->set_guest_notifiers(qbus->parent, vsock->vhost_dev.nvqs, tr= ue); - if (ret < 0) { - error_report("Error binding guest notifier: %d", -ret); - goto err_host_notifiers; - } - - vsock->vhost_dev.acked_features =3D vdev->guest_features; - ret =3D vhost_dev_start(&vsock->vhost_dev, vdev); - if (ret < 0) { - error_report("Error starting vhost: %d", -ret); - goto err_guest_notifiers; - } - - ret =3D vhost_vsock_set_running(vsock, 1); - if (ret < 0) { - error_report("Error starting vhost vsock: %d", -ret); - goto err_dev_start; - } - - /* guest_notifier_mask/pending not used yet, so just unmask - * everything here. virtio-pci will do the right thing by - * enabling/disabling irqfd. - */ - for (i =3D 0; i < vsock->vhost_dev.nvqs; i++) { - vhost_virtqueue_mask(&vsock->vhost_dev, vdev, i, false); - } - - return; - -err_dev_start: - vhost_dev_stop(&vsock->vhost_dev, vdev); -err_guest_notifiers: - k->set_guest_notifiers(qbus->parent, vsock->vhost_dev.nvqs, false); -err_host_notifiers: - vhost_dev_disable_notifiers(&vsock->vhost_dev, vdev); -} - -static void vhost_vsock_stop(VirtIODevice *vdev) -{ - VHostVSock *vsock =3D VHOST_VSOCK(vdev); - BusState *qbus =3D BUS(qdev_get_parent_bus(DEVICE(vdev))); - VirtioBusClass *k =3D VIRTIO_BUS_GET_CLASS(qbus); - int ret; - - if (!k->set_guest_notifiers) { - return; - } - - ret =3D vhost_vsock_set_running(vsock, 0); - if (ret < 0) { - error_report("vhost vsock set running failed: %d", ret); - return; - } - - vhost_dev_stop(&vsock->vhost_dev, vdev); - - ret =3D k->set_guest_notifiers(qbus->parent, vsock->vhost_dev.nvqs, fa= lse); - if (ret < 0) { - error_report("vhost guest notifier cleanup failed: %d", ret); - return; - } - - vhost_dev_disable_notifiers(&vsock->vhost_dev, vdev); -} =20 static void vhost_vsock_set_status(VirtIODevice *vdev, uint8_t status) { - VHostVSock *vsock =3D VHOST_VSOCK(vdev); + VHostVSockCommon *vvc =3D VHOST_VSOCK_COMMON(vdev); bool should_start =3D status & VIRTIO_CONFIG_S_DRIVER_OK; + int ret; =20 if (!vdev->vm_running) { should_start =3D false; } =20 - if (vsock->vhost_dev.started =3D=3D should_start) { + if (vvc->vhost_dev.started =3D=3D should_start) { return; } =20 if (should_start) { - vhost_vsock_start(vdev); + ret =3D vhost_vsock_common_start(vdev); + if (ret < 0) { + return; + } + + ret =3D vhost_vsock_set_running(vdev, 1); + if (ret < 0) { + vhost_vsock_common_stop(vdev); + error_report("Error starting vhost vsock: %d", -ret); + return; + } } else { - vhost_vsock_stop(vdev); + ret =3D vhost_vsock_set_running(vdev, 0); + if (ret < 0) { + error_report("vhost vsock set running failed: %d", ret); + return; + } + + vhost_vsock_common_stop(vdev); } } =20 @@ -184,108 +111,6 @@ static uint64_t vhost_vsock_get_features(VirtIODevice= *vdev, return requested_features; } =20 -static void vhost_vsock_handle_output(VirtIODevice *vdev, VirtQueue *vq) -{ - /* Do nothing */ -} - -static void vhost_vsock_guest_notifier_mask(VirtIODevice *vdev, int idx, - bool mask) -{ - VHostVSock *vsock =3D VHOST_VSOCK(vdev); - - vhost_virtqueue_mask(&vsock->vhost_dev, vdev, idx, mask); -} - -static bool vhost_vsock_guest_notifier_pending(VirtIODevice *vdev, int idx) -{ - VHostVSock *vsock =3D VHOST_VSOCK(vdev); - - return vhost_virtqueue_pending(&vsock->vhost_dev, idx); -} - -static void vhost_vsock_send_transport_reset(VHostVSock *vsock) -{ - VirtQueueElement *elem; - VirtQueue *vq =3D vsock->event_vq; - struct virtio_vsock_event event =3D { - .id =3D cpu_to_le32(VIRTIO_VSOCK_EVENT_TRANSPORT_RESET), - }; - - elem =3D virtqueue_pop(vq, sizeof(VirtQueueElement)); - if (!elem) { - error_report("vhost-vsock missed transport reset event"); - return; - } - - if (elem->out_num) { - error_report("invalid vhost-vsock event virtqueue element with " - "out buffers"); - goto out; - } - - if (iov_from_buf(elem->in_sg, elem->in_num, 0, - &event, sizeof(event)) !=3D sizeof(event)) { - error_report("vhost-vsock event virtqueue element is too short"); - goto out; - } - - virtqueue_push(vq, elem, sizeof(event)); - virtio_notify(VIRTIO_DEVICE(vsock), vq); - -out: - g_free(elem); -} - -static void vhost_vsock_post_load_timer_cleanup(VHostVSock *vsock) -{ - if (!vsock->post_load_timer) { - return; - } - - timer_del(vsock->post_load_timer); - timer_free(vsock->post_load_timer); - vsock->post_load_timer =3D NULL; -} - -static void vhost_vsock_post_load_timer_cb(void *opaque) -{ - VHostVSock *vsock =3D opaque; - - vhost_vsock_post_load_timer_cleanup(vsock); - vhost_vsock_send_transport_reset(vsock); -} - -static int vhost_vsock_pre_save(void *opaque) -{ - VHostVSock *vsock =3D opaque; - - /* At this point, backend must be stopped, otherwise - * it might keep writing to memory. */ - assert(!vsock->vhost_dev.started); - - return 0; -} - -static int vhost_vsock_post_load(void *opaque, int version_id) -{ - VHostVSock *vsock =3D opaque; - VirtIODevice *vdev =3D VIRTIO_DEVICE(vsock); - - if (virtio_queue_get_addr(vdev, 2)) { - /* Defer transport reset event to a vm clock timer so that virtque= ue - * changes happen after migration has completed. - */ - assert(!vsock->post_load_timer); - vsock->post_load_timer =3D - timer_new_ns(QEMU_CLOCK_VIRTUAL, - vhost_vsock_post_load_timer_cb, - vsock); - timer_mod(vsock->post_load_timer, 1); - } - return 0; -} - static const VMStateDescription vmstate_virtio_vhost_vsock =3D { .name =3D "virtio-vhost_vsock", .minimum_version_id =3D VHOST_VSOCK_SAVEVM_VERSION, @@ -294,12 +119,13 @@ static const VMStateDescription vmstate_virtio_vhost_= vsock =3D { VMSTATE_VIRTIO_DEVICE, VMSTATE_END_OF_LIST() }, - .pre_save =3D vhost_vsock_pre_save, - .post_load =3D vhost_vsock_post_load, + .pre_save =3D vhost_vsock_common_pre_save, + .post_load =3D vhost_vsock_common_post_load, }; =20 static void vhost_vsock_device_realize(DeviceState *dev, Error **errp) { + VHostVSockCommon *vvc =3D VHOST_VSOCK_COMMON(dev); VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); VHostVSock *vsock =3D VHOST_VSOCK(dev); int vhostfd; @@ -331,46 +157,29 @@ static void vhost_vsock_device_realize(DeviceState *d= ev, Error **errp) } } =20 - virtio_init(vdev, "vhost-vsock", VIRTIO_ID_VSOCK, - sizeof(struct virtio_vsock_config)); + vhost_vsock_common_realize(vdev, "vhost-vsock"); =20 - /* Receive and transmit queues belong to vhost */ - 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); - - /* The event queue belongs to QEMU */ - vsock->event_vq =3D virtio_add_queue(vdev, VHOST_VSOCK_QUEUE_SIZE, - vhost_vsock_handle_output); - - vsock->vhost_dev.nvqs =3D ARRAY_SIZE(vsock->vhost_vqs); - vsock->vhost_dev.vqs =3D vsock->vhost_vqs; - ret =3D vhost_dev_init(&vsock->vhost_dev, (void *)(uintptr_t)vhostfd, + ret =3D vhost_dev_init(&vvc->vhost_dev, (void *)(uintptr_t)vhostfd, VHOST_BACKEND_TYPE_KERNEL, 0); if (ret < 0) { error_setg_errno(errp, -ret, "vhost-vsock: vhost_dev_init failed"); goto err_virtio; } =20 - ret =3D vhost_vsock_set_guest_cid(vsock); + ret =3D vhost_vsock_set_guest_cid(vdev); if (ret < 0) { error_setg_errno(errp, -ret, "vhost-vsock: unable to set guest cid= "); goto err_vhost_dev; } =20 - vsock->post_load_timer =3D NULL; return; =20 err_vhost_dev: - vhost_dev_cleanup(&vsock->vhost_dev); + vhost_dev_cleanup(&vvc->vhost_dev); /* vhost_dev_cleanup() closes the vhostfd passed to vhost_dev_init() */ vhostfd =3D -1; err_virtio: - virtio_delete_queue(vsock->recv_vq); - virtio_delete_queue(vsock->trans_vq); - virtio_delete_queue(vsock->event_vq); - virtio_cleanup(vdev); + vhost_vsock_common_unrealize(vdev); if (vhostfd >=3D 0) { close(vhostfd); } @@ -379,19 +188,14 @@ err_virtio: =20 static void vhost_vsock_device_unrealize(DeviceState *dev) { + VHostVSockCommon *vvc =3D VHOST_VSOCK_COMMON(dev); VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); - VHostVSock *vsock =3D VHOST_VSOCK(dev); - - vhost_vsock_post_load_timer_cleanup(vsock); =20 /* This will stop vhost backend if appropriate. */ 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); + vhost_dev_cleanup(&vvc->vhost_dev); + vhost_vsock_common_unrealize(vdev); } =20 static Property vhost_vsock_properties[] =3D { @@ -407,19 +211,16 @@ static void vhost_vsock_class_init(ObjectClass *klass= , void *data) =20 device_class_set_props(dc, vhost_vsock_properties); dc->vmsd =3D &vmstate_virtio_vhost_vsock; - set_bit(DEVICE_CATEGORY_MISC, dc->categories); vdc->realize =3D vhost_vsock_device_realize; vdc->unrealize =3D vhost_vsock_device_unrealize; vdc->get_features =3D vhost_vsock_get_features; vdc->get_config =3D vhost_vsock_get_config; vdc->set_status =3D vhost_vsock_set_status; - vdc->guest_notifier_mask =3D vhost_vsock_guest_notifier_mask; - vdc->guest_notifier_pending =3D vhost_vsock_guest_notifier_pending; } =20 static const TypeInfo vhost_vsock_info =3D { .name =3D TYPE_VHOST_VSOCK, - .parent =3D TYPE_VIRTIO_DEVICE, + .parent =3D TYPE_VHOST_VSOCK_COMMON, .instance_size =3D sizeof(VHostVSock), .class_init =3D vhost_vsock_class_init, }; diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index 4e4d39a0a4..b1eeb44eac 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -17,7 +17,7 @@ obj-$(CONFIG_VIRTIO_PMEM) +=3D virtio-pmem.o common-obj-$(call land,$(CONFIG_VIRTIO_PMEM),$(CONFIG_VIRTIO_PCI)) +=3D vi= rtio-pmem-pci.o obj-$(call land,$(CONFIG_VHOST_USER_FS),$(CONFIG_VIRTIO_PCI)) +=3D vhost-u= ser-fs-pci.o obj-$(CONFIG_VIRTIO_IOMMU) +=3D virtio-iommu.o -obj-$(CONFIG_VHOST_VSOCK) +=3D vhost-vsock.o +obj-$(CONFIG_VHOST_VSOCK) +=3D vhost-vsock-common.o vhost-vsock.o =20 ifeq ($(CONFIG_VIRTIO_PCI),y) obj-$(CONFIG_VHOST_VSOCK) +=3D vhost-vsock-pci.o --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.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=1591975342; cv=none; d=zohomail.com; s=zohoarc; b=YuXS4W6I3dxMEVVlx0y3TEnNpl0rg11KKf0JZV6kn1UWp8ni5Yk40l/gq3Ah4AfTKz1pBGwdaREt/POf1DUFK4HP1Qgl08SL2qHFVcdAE+8P6wHHhh5h9Mdsq+0Q8LKjcuf1ZbRB+ZglfTzj/68XKMJFdKDqo5fsgqrCMJYl5XE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591975342; h=Content-Type: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=sJAZsJmFlqScQwmM7L/XMteb8M4v1LBCTCabVI67rS0=; b=eT2EXTriZHRWeWVc7DaBpLEwpWnA7RALBdSn7m5iHxuIziKwqSpN1n8LehwwKsJ+YC5mNDeDmyviV10YVThMkZtQJ8sX4MRnRy/gvjDJ4W/HeEIbP9nfurRjcZAVMHfid1mEKyVcxZUZQOWBlHvlh4Cpj5wZQMoUMXc7Ww/cy24= 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 15919753425611005.3964289720436; Fri, 12 Jun 2020 08:22:22 -0700 (PDT) Received: from localhost ([::1]:43774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlVd-0004kY-7U for importer@patchew.org; Fri, 12 Jun 2020 11:22:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52032) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl6E-0006mT-Cx for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:56:09 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:23178 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl6B-0002LI-Jp for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:56:06 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-169-DrV05vOgNByA33wIetmv_g-1; Fri, 12 Jun 2020 10:52:53 -0400 Received: by mail-wm1-f72.google.com with SMTP id j128so2547342wmj.6 for ; Fri, 12 Jun 2020 07:52:53 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id 30sm11033821wrd.47.2020.06.12.07.52.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973762; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=sJAZsJmFlqScQwmM7L/XMteb8M4v1LBCTCabVI67rS0=; b=GeFnbHjCaoxVLhNvxAmAW7rECXxhtMwedw2h6YWM2Nb+NJGA3RudLPWA6ZmnrwQHR/pljh FmAWiT549W3Y2ni58HAMyppXS6C0ShLRYMAbLo1NW80ZOZ7sEoqY22nTGpcz/A3GxPl20X AWzRbJbHpXL/cvonNZrDZ+9G1epohto= X-MC-Unique: DrV05vOgNByA33wIetmv_g-1 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=sJAZsJmFlqScQwmM7L/XMteb8M4v1LBCTCabVI67rS0=; b=RmQqSK6EJAQyT/jh+mZnYYt+Y3RPVmpeFggyPDfshju7JwZkbwMtsdV3xKN+P4yEqp /I4gx6Q+Ou3e4KVXwAc3MlclcpQ3MyoQY1+Z4rP3bOhGUuZur1rIdXh2Eu2FgsaB/uNT v3ZjHD2bhvYLYinFFxcFVTzrK/6NBsZcfIpxMWJboAM4DQ0+5xkC3/stw7A8z6zbzVSQ B8ALXCAjFplEp8FN/6yvrhiMcRjuR0pixYEWxb43zRpl0WbM3s848Mhv9UwHTjHaW4yI jFXXWr/OvjqfrL2RmRevbc2+jy+JiFlXMm1npKh28T28zNT6RCDnPV/DCIKRFEizXdZb 8CgA== X-Gm-Message-State: AOAM5304IiLmfP9ZBJNr7cN0WB9zWha99NXruBts5GaYLii7to4YWFJZ oCidk7Vnk7LvahJgda+Rx1FBA6vgJZQb8SV2p2aR/5YhoWRIDPhshDCnUBEIg+/xeD9RW+DNguE gFOir6N8GQvcBjV0= X-Received: by 2002:a05:6000:114e:: with SMTP id d14mr15052839wrx.110.1591973572268; Fri, 12 Jun 2020 07:52:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfmVSlqLtH9a35l8xvWyO9GQ+0ll1uOB5n/o0d4uA6qp43l8aDa8gM8CxbGuiAT/MAoL/Ctw== X-Received: by 2002:a05:6000:114e:: with SMTP id d14mr15052817wrx.110.1591973571903; Fri, 12 Jun 2020 07:52:51 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:50 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 49/58] virtio: add vhost-user-vsock base device Message-ID: <20200612141917.9446-50-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 09:30:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefano Garzarella Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Stefano Garzarella This patch introduces a vhost-user device for vsock, using the vhost-vsock-common parent class. The vhost-user-vsock device can be used to implement the virtio-vsock device emulation in user-space. Signed-off-by: Stefano Garzarella Message-Id: <20200522122512.87413-3-sgarzare@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- configure | 3 + include/hw/virtio/vhost-user-vsock.h | 36 ++++++ hw/virtio/vhost-user-vsock.c | 181 +++++++++++++++++++++++++++ hw/virtio/Makefile.objs | 1 + 4 files changed, 221 insertions(+) create mode 100644 include/hw/virtio/vhost-user-vsock.h create mode 100644 hw/virtio/vhost-user-vsock.c diff --git a/configure b/configure index 597e909b53..7c2adf36e5 100755 --- a/configure +++ b/configure @@ -7196,6 +7196,9 @@ if test "$vhost_crypto" =3D "yes" ; then fi if test "$vhost_vsock" =3D "yes" ; then echo "CONFIG_VHOST_VSOCK=3Dy" >> $config_host_mak + if test "$vhost_user" =3D "yes" ; then + echo "CONFIG_VHOST_USER_VSOCK=3Dy" >> $config_host_mak + fi fi if test "$vhost_kernel" =3D "yes" ; then echo "CONFIG_VHOST_KERNEL=3Dy" >> $config_host_mak diff --git a/include/hw/virtio/vhost-user-vsock.h b/include/hw/virtio/vhost= -user-vsock.h new file mode 100644 index 0000000000..4e128a4b9f --- /dev/null +++ b/include/hw/virtio/vhost-user-vsock.h @@ -0,0 +1,36 @@ +/* + * Vhost-user vsock virtio device + * + * Copyright 2020 Red Hat, Inc. + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * (at your option) any later version. See the COPYING file in the + * top-level directory. + */ + +#ifndef _QEMU_VHOST_USER_VSOCK_H +#define _QEMU_VHOST_USER_VSOCK_H + +#include "hw/virtio/vhost-vsock-common.h" +#include "hw/virtio/vhost-user.h" +#include "standard-headers/linux/virtio_vsock.h" + +#define TYPE_VHOST_USER_VSOCK "vhost-user-vsock-device" +#define VHOST_USER_VSOCK(obj) \ + OBJECT_CHECK(VHostUserVSock, (obj), TYPE_VHOST_USER_VSOCK) + +typedef struct { + CharBackend chardev; +} VHostUserVSockConf; + +typedef struct { + /*< private >*/ + VHostVSockCommon parent; + VhostUserState vhost_user; + VHostUserVSockConf conf; + struct virtio_vsock_config vsockcfg; + + /*< public >*/ +} VHostUserVSock; + +#endif /* _QEMU_VHOST_USER_VSOCK_H */ diff --git a/hw/virtio/vhost-user-vsock.c b/hw/virtio/vhost-user-vsock.c new file mode 100644 index 0000000000..3534a39d62 --- /dev/null +++ b/hw/virtio/vhost-user-vsock.c @@ -0,0 +1,181 @@ +/* + * Vhost-user vsock virtio device + * + * Copyright 2020 Red Hat, Inc. + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * (at your option) any later version. See the COPYING file in the + * top-level directory. + */ + +#include "qemu/osdep.h" + +#include "qapi/error.h" +#include "qemu/error-report.h" +#include "hw/qdev-properties.h" +#include "hw/virtio/vhost-user-vsock.h" + +static const int user_feature_bits[] =3D { + VIRTIO_F_VERSION_1, + VIRTIO_RING_F_INDIRECT_DESC, + VIRTIO_RING_F_EVENT_IDX, + VIRTIO_F_NOTIFY_ON_EMPTY, + VHOST_INVALID_FEATURE_BIT +}; + +static void vuv_get_config(VirtIODevice *vdev, uint8_t *config) +{ + VHostUserVSock *vsock =3D VHOST_USER_VSOCK(vdev); + + memcpy(config, &vsock->vsockcfg, sizeof(struct virtio_vsock_config)); +} + +static int vuv_handle_config_change(struct vhost_dev *dev) +{ + VHostUserVSock *vsock =3D VHOST_USER_VSOCK(dev->vdev); + int ret =3D vhost_dev_get_config(dev, (uint8_t *)&vsock->vsockcfg, + sizeof(struct virtio_vsock_config)); + if (ret < 0) { + error_report("get config space failed"); + return -1; + } + + virtio_notify_config(dev->vdev); + + return 0; +} + +const VhostDevConfigOps vsock_ops =3D { + .vhost_dev_config_notifier =3D vuv_handle_config_change, +}; + +static void vuv_set_status(VirtIODevice *vdev, uint8_t status) +{ + VHostVSockCommon *vvc =3D VHOST_VSOCK_COMMON(vdev); + bool should_start =3D status & VIRTIO_CONFIG_S_DRIVER_OK; + + if (!vdev->vm_running) { + should_start =3D false; + } + + if (vvc->vhost_dev.started =3D=3D should_start) { + return; + } + + if (should_start) { + int ret =3D vhost_vsock_common_start(vdev); + if (ret < 0) { + return; + } + } else { + vhost_vsock_common_stop(vdev); + } +} + +static uint64_t vuv_get_features(VirtIODevice *vdev, + uint64_t features, + Error **errp) +{ + VHostVSockCommon *vvc =3D VHOST_VSOCK_COMMON(vdev); + + return vhost_get_features(&vvc->vhost_dev, user_feature_bits, features= ); +} + +static const VMStateDescription vuv_vmstate =3D { + .name =3D "vhost-user-vsock", + .unmigratable =3D 1, +}; + +static void vuv_device_realize(DeviceState *dev, Error **errp) +{ + VHostVSockCommon *vvc =3D VHOST_VSOCK_COMMON(dev); + VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); + VHostUserVSock *vsock =3D VHOST_USER_VSOCK(dev); + int ret; + + if (!vsock->conf.chardev.chr) { + error_setg(errp, "missing chardev"); + return; + } + + if (!vhost_user_init(&vsock->vhost_user, &vsock->conf.chardev, errp)) { + return; + } + + vhost_vsock_common_realize(vdev, "vhost-user-vsock"); + + vhost_dev_set_config_notifier(&vvc->vhost_dev, &vsock_ops); + + ret =3D vhost_dev_init(&vvc->vhost_dev, &vsock->vhost_user, + VHOST_BACKEND_TYPE_USER, 0); + if (ret < 0) { + error_setg_errno(errp, -ret, "vhost_dev_init failed"); + goto err_virtio; + } + + ret =3D vhost_dev_get_config(&vvc->vhost_dev, (uint8_t *)&vsock->vsock= cfg, + sizeof(struct virtio_vsock_config)); + if (ret < 0) { + error_setg_errno(errp, -ret, "get config space failed"); + goto err_vhost_dev; + } + + return; + +err_vhost_dev: + vhost_dev_cleanup(&vvc->vhost_dev); +err_virtio: + vhost_vsock_common_unrealize(vdev); + vhost_user_cleanup(&vsock->vhost_user); + return; +} + +static void vuv_device_unrealize(DeviceState *dev) +{ + VHostVSockCommon *vvc =3D VHOST_VSOCK_COMMON(dev); + VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); + VHostUserVSock *vsock =3D VHOST_USER_VSOCK(dev); + + /* This will stop vhost backend if appropriate. */ + vuv_set_status(vdev, 0); + + vhost_dev_cleanup(&vvc->vhost_dev); + + vhost_vsock_common_unrealize(vdev); + + vhost_user_cleanup(&vsock->vhost_user); + +} + +static Property vuv_properties[] =3D { + DEFINE_PROP_CHR("chardev", VHostUserVSock, conf.chardev), + DEFINE_PROP_END_OF_LIST(), +}; + +static void vuv_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtioDeviceClass *vdc =3D VIRTIO_DEVICE_CLASS(klass); + + device_class_set_props(dc, vuv_properties); + dc->vmsd =3D &vuv_vmstate; + vdc->realize =3D vuv_device_realize; + vdc->unrealize =3D vuv_device_unrealize; + vdc->get_features =3D vuv_get_features; + vdc->get_config =3D vuv_get_config; + vdc->set_status =3D vuv_set_status; +} + +static const TypeInfo vuv_info =3D { + .name =3D TYPE_VHOST_USER_VSOCK, + .parent =3D TYPE_VHOST_VSOCK_COMMON, + .instance_size =3D sizeof(VHostUserVSock), + .class_init =3D vuv_class_init, +}; + +static void vuv_register_types(void) +{ + type_register_static(&vuv_info); +} + +type_init(vuv_register_types) diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index b1eeb44eac..dd42daedb1 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -18,6 +18,7 @@ common-obj-$(call land,$(CONFIG_VIRTIO_PMEM),$(CONFIG_VIR= TIO_PCI)) +=3D virtio-pme obj-$(call land,$(CONFIG_VHOST_USER_FS),$(CONFIG_VIRTIO_PCI)) +=3D vhost-u= ser-fs-pci.o obj-$(CONFIG_VIRTIO_IOMMU) +=3D virtio-iommu.o obj-$(CONFIG_VHOST_VSOCK) +=3D vhost-vsock-common.o vhost-vsock.o +obj-$(CONFIG_VHOST_USER_VSOCK) +=3D vhost-vsock-common.o vhost-user-vsock.o =20 ifeq ($(CONFIG_VIRTIO_PCI),y) obj-$(CONFIG_VHOST_VSOCK) +=3D vhost-vsock-pci.o --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.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=1591975511; cv=none; d=zohomail.com; s=zohoarc; b=Sjf+t77QJjB2RqN+va0RD6ZPADkAWCOMlZmbI4nteYhyYPLCjLoHqZuzdP7JeKE+PTVsU/4PGqI/nW1swQq/cxZ+dHvj+HmXJlcUxu7xMNThOuTyPY4V7UidmFegj3orUt4Mq0CkhvHW8SN8rb1CUS2FRjDKaOMBn0u1EsGDfic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591975511; h=Content-Type: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=HeK33S58Y66BX2cfotuRkiKIabnRwY34GRnce15Fyy8=; b=nxS9FOyG7qu2GEAU0ARcARTbS8vCBll8XqhtpLH4uTXlsQIbzxaASpsNDMtegtoK8ZFGwlQvgrapp/YTkR6ASM6YtbMT9DX6882F7Hy6lOylO2D4storsfvg9Avee06Owqku2w0I8LN19kS694Qq/yzEn30EK7IfqkTrsil5JFM= 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 1591975511742369.5957531349111; Fri, 12 Jun 2020 08:25:11 -0700 (PDT) Received: from localhost ([::1]:53490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlYM-0000fl-FZ for importer@patchew.org; Fri, 12 Jun 2020 11:25:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl6E-0006lx-5Q for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:56:09 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:32146 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl6B-0002LN-Ou for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:56:05 -0400 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-408-wzrIZpVNMHyEiXCh7AmfAQ-1; Fri, 12 Jun 2020 10:52:55 -0400 Received: by mail-wr1-f71.google.com with SMTP id e7so4005582wrp.14 for ; Fri, 12 Jun 2020 07:52:55 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id c6sm9630033wma.15.2020.06.12.07.52.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973763; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HeK33S58Y66BX2cfotuRkiKIabnRwY34GRnce15Fyy8=; b=UpI8MEbcnzEITUDSABuEh2YOJ+VyQVZ/SXzNHEWjsLd6XqzyXdpAV/z80UlcUlduwRsUEC +esWEoc3kwdy1WD/kH8oafAtw4kJdLzML76lhSda8jTV1udxh8NYxuZxiOmk1WE5En2Gyq LOSUBTcl6L5ie7+/sL3NjtmzyegyYME= X-MC-Unique: wzrIZpVNMHyEiXCh7AmfAQ-1 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=HeK33S58Y66BX2cfotuRkiKIabnRwY34GRnce15Fyy8=; b=Z+pNXXi44MwTqPzgKKhX3D91AizFcP3e/qHykb8J7M0C74cMN+HaM/ZsUMGG/noEhV xZnvhQTF17NM0XF14iov2oDr2qI+93GKvmkodXm3UXg3IFix/IUTGQ3Vw7SB+x7IUBOs kGZZSL6UJsdCB4/QkNJNnJxpY4LLqnJFNbpoeFoS4/fc+jdPCA9100Gb545pUme4BHng SY5E23mZf5kiAVSagfzzQTmtxxwjMpLgUEXIUBHhtZ3WQEZ2iw4qJItaejSGc8kXndSj yr1/RDBT6IJtJ6fmiJWEZ2or3oh3M4Cbk7SxazcwPCpkTIx3sP3bwcbUC5Qwi9PjRgoC zVKw== X-Gm-Message-State: AOAM532e2o8v3fB4bJxgIqjK/B/UchKnVp4W1zZwmdrJ+qAOiymyIlG7 tQad8YLLF8+A1PKufQqecGsKrdsPEeYZIrNhXTMoDRiUMOvyn3tze1o0eSOQqu27zeOkJDg/8m2 B0PsA5noociNSPrI= X-Received: by 2002:a7b:c8d6:: with SMTP id f22mr13952350wml.188.1591973573940; Fri, 12 Jun 2020 07:52:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4p8E7Ou7m1zN3PEp3hK6VU8oRUBJzyyZANXQ5Q+k4mxvIk81uGgzdu+lfuXtf6lQYVflZXg== X-Received: by 2002:a7b:c8d6:: with SMTP id f22mr13952331wml.188.1591973573747; Fri, 12 Jun 2020 07:52:53 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:52 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 50/58] virtio: add vhost-user-vsock-pci device Message-ID: <20200612141917.9446-51-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:00:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefano Garzarella Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Stefano Garzarella Add the PCI version of vhost-user-vsock Launch QEMU like this: qemu -chardev socket,path=3D/tmp/vm.vsock,id=3Dchr0 \ -device vhost-user-vsock-pci,chardev=3Dchr0 Signed-off-by: Stefano Garzarella Message-Id: <20200522122512.87413-4-sgarzare@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-user-vsock-pci.c | 84 ++++++++++++++++++++++++++++++++ hw/virtio/Makefile.objs | 1 + 2 files changed, 85 insertions(+) create mode 100644 hw/virtio/vhost-user-vsock-pci.c diff --git a/hw/virtio/vhost-user-vsock-pci.c b/hw/virtio/vhost-user-vsock-= pci.c new file mode 100644 index 0000000000..0a6847e6fc --- /dev/null +++ b/hw/virtio/vhost-user-vsock-pci.c @@ -0,0 +1,84 @@ +/* + * Vhost-user vsock PCI Bindings + * + * Copyright 2020 Red Hat, Inc. + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * (at your option) any later version. See the COPYING file in the + * top-level directory. + */ + +#include "qemu/osdep.h" + +#include "virtio-pci.h" +#include "hw/qdev-properties.h" +#include "hw/virtio/vhost-user-vsock.h" + +typedef struct VHostUserVSockPCI VHostUserVSockPCI; + +/* + * vhost-user-vsock-pci: This extends VirtioPCIProxy. + */ +#define TYPE_VHOST_USER_VSOCK_PCI "vhost-user-vsock-pci-base" +#define VHOST_USER_VSOCK_PCI(obj) \ + OBJECT_CHECK(VHostUserVSockPCI, (obj), TYPE_VHOST_USER_VSOCK_PCI) + +struct VHostUserVSockPCI { + VirtIOPCIProxy parent_obj; + VHostUserVSock vdev; +}; + +/* vhost-user-vsock-pci */ + +static Property vhost_user_vsock_pci_properties[] =3D { + DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 3), + DEFINE_PROP_END_OF_LIST(), +}; + +static void vhost_user_vsock_pci_realize(VirtIOPCIProxy *vpci_dev, Error *= *errp) +{ + VHostUserVSockPCI *dev =3D VHOST_USER_VSOCK_PCI(vpci_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + + qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); + object_property_set_bool(OBJECT(vdev), true, "realized", errp); +} + +static void vhost_user_vsock_pci_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtioPCIClass *k =3D VIRTIO_PCI_CLASS(klass); + PCIDeviceClass *pcidev_k =3D PCI_DEVICE_CLASS(klass); + k->realize =3D vhost_user_vsock_pci_realize; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); + device_class_set_props(dc, vhost_user_vsock_pci_properties); + pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; + pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_VSOCK; + pcidev_k->revision =3D 0x00; + pcidev_k->class_id =3D PCI_CLASS_COMMUNICATION_OTHER; +} + +static void vhost_user_vsock_pci_instance_init(Object *obj) +{ + VHostUserVSockPCI *dev =3D VHOST_USER_VSOCK_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VHOST_USER_VSOCK); +} + +static const VirtioPCIDeviceTypeInfo vhost_user_vsock_pci_info =3D { + .base_name =3D TYPE_VHOST_USER_VSOCK_PCI, + .generic_name =3D "vhost-user-vsock-pci", + .transitional_name =3D "vhost-user-vsock-pci-transitional", + .non_transitional_name =3D "vhost-user-vsock-pci-non-transitional", + .instance_size =3D sizeof(VHostUserVSockPCI), + .instance_init =3D vhost_user_vsock_pci_instance_init, + .class_init =3D vhost_user_vsock_pci_class_init, +}; + +static void virtio_pci_vhost_register(void) +{ + virtio_pci_types_register(&vhost_user_vsock_pci_info); +} + +type_init(virtio_pci_vhost_register) diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index dd42daedb1..13e75f171f 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -22,6 +22,7 @@ obj-$(CONFIG_VHOST_USER_VSOCK) +=3D vhost-vsock-common.o = vhost-user-vsock.o =20 ifeq ($(CONFIG_VIRTIO_PCI),y) obj-$(CONFIG_VHOST_VSOCK) +=3D vhost-vsock-pci.o +obj-$(CONFIG_VHOST_USER_VSOCK) +=3D vhost-user-vsock-pci.o obj-$(CONFIG_VHOST_USER_BLK) +=3D vhost-user-blk-pci.o obj-$(CONFIG_VHOST_USER_INPUT) +=3D vhost-user-input-pci.o obj-$(CONFIG_VHOST_USER_SCSI) +=3D vhost-user-scsi-pci.o --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974992; cv=none; d=zohomail.com; s=zohoarc; b=dXnbdi3DwzhyMW2geoJ5bXDezYQEvAHRJ31yBwsIal1/uOm1YPx2/LX7hAHs0u9IcweBTHgqjeo3Ht8UMx1ygfPjiUyYIdOPJ0TJ4wkF+8KNxydS2DcEQC2oFf0M67ibQ130RzycmTqt4MH3oOXsBLgkwj0RV8Rvq05ZKg5H3Hg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974992; 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=DoK3qItB4gtR6vQ0HnOj38qj5Wwjgy/hJn+3HSuSSfw=; b=IvMersH3IxXa6SYpLDqYk0fFwHSDhzRA+kiBaNx1nVj6lfL93Exezn1xaurUWGOEQBtHNc824sU4aaeDFH49s9crD676+TBGVNqAA/ArKH9A8jmiq6lp9iI4iXWhft+8+YNyecH6Ze+a47i/jKB5QANxAqIiQspzoksDe6wBBcA= 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 1591974992227604.726258641795; Fri, 12 Jun 2020 08:16:32 -0700 (PDT) Received: from localhost ([::1]:46522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlPz-0002Nw-CD for importer@patchew.org; Fri, 12 Jun 2020 11:16:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50606) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl3J-00011I-7d for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:53:05 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:22010 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl3H-0001eO-E1 for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:53:04 -0400 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-276-kQN3LIC2NKKzNpnj7yUK5g-1; Fri, 12 Jun 2020 10:52:57 -0400 Received: by mail-wr1-f72.google.com with SMTP id z10so4018238wrs.2 for ; Fri, 12 Jun 2020 07:52:57 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id l17sm8553103wmi.3.2020.06.12.07.52.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973582; 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=DoK3qItB4gtR6vQ0HnOj38qj5Wwjgy/hJn+3HSuSSfw=; b=dkJgqJt2dQA1mIQ0sWWfwAdCg4D68i/zBOfimKLp1n9Q4pMz4/VAApF2qGgJ95PhBuK62M fyGyxytCJbtgoElRy1bkHDUyqKX67Nnavf81+gjRF7zf9QWC0gvQX15Obkg759/ngVSAov L8vetRCEAJOSOkTgr3sHFuZ/1Sv1QzQ= X-MC-Unique: kQN3LIC2NKKzNpnj7yUK5g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=DoK3qItB4gtR6vQ0HnOj38qj5Wwjgy/hJn+3HSuSSfw=; b=L9V8X8Yo9mu5MDcZLGQLZFXgth9T8BYz+1iHuYeumLeyMTzG/PXzXq+ixMQjvpoh0Z zDcJfQu8E822Ox8bltEOXcI8GU+wE+H9U8PWE1USZPl/WP1gffI7fl7z85pipzmt5s/9 /XQ7cCENMpTZS/FOJnOL/R3CAWaYLk2YbTd769gijAiLVN3ahWGmgnkS8uH63C6sEZuq QT4ISgqKJYGZZ/NhiKph/VTGzj4gYOrlHPI5w8duKx7mxUtT5EXaPvCJDbYx9xlAuKRV /wrDCJczlJodTjzwTTCZ4hi8h38kSq8MDVKiBmqJ0eov6O8fFpj29NBwRIUdvDunKfan z6ug== X-Gm-Message-State: AOAM531C/SUJMVZN/WSsC/UeomzTCOrJI/UOae8FU1but4JN+z2zUB58 O1Xe4AEvOWMn+l9Oa2DRCc5zOKJBBf6U62VS0NZoeg/a2XlUjqeNdex78Xi6dOHs8f/ChiCyqSD ZdbXKjMY4xGNhmZs= X-Received: by 2002:a5d:4404:: with SMTP id z4mr15825214wrq.189.1591973576214; Fri, 12 Jun 2020 07:52:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfs/JPzBxuGSnsbqoVgNkuFrAPS3p/uyGNSG7hmp3QHdvGnZxyxyUvEtA9+0K82STmKt6SrA== X-Received: by 2002:a5d:4404:: with SMTP id z4mr15825201wrq.189.1591973576044; Fri, 12 Jun 2020 07:52:56 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:54 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 51/58] acpi: make build_madt() more generic. Message-ID: <20200612141917.9446-52-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 09:30:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , Gerd Hoffmann , Igor Mammedov , Paolo Bonzini , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Gerd Hoffmann Remove PCMachineState dependency from build_madt(). Pass AcpiDeviceIf as separate argument instead of depending on PCMachineState->acpi_dev. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Igor Mammedov Message-Id: <20200520132003.9492-6-kraxel@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 1ecb68f45f..d217fc1fe6 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -366,14 +366,13 @@ void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, } =20 static void -build_madt(GArray *table_data, BIOSLinker *linker, PCMachineState *pcms) +build_madt(GArray *table_data, BIOSLinker *linker, + X86MachineState *x86ms, AcpiDeviceIf *adev) { - MachineClass *mc =3D MACHINE_GET_CLASS(pcms); - X86MachineState *x86ms =3D X86_MACHINE(pcms); - const CPUArchIdList *apic_ids =3D mc->possible_cpu_arch_ids(MACHINE(pc= ms)); + MachineClass *mc =3D MACHINE_GET_CLASS(x86ms); + const CPUArchIdList *apic_ids =3D mc->possible_cpu_arch_ids(MACHINE(x8= 6ms)); int madt_start =3D table_data->len; - AcpiDeviceIfClass *adevc =3D ACPI_DEVICE_IF_GET_CLASS(pcms->acpi_dev); - AcpiDeviceIf *adev =3D ACPI_DEVICE_IF(pcms->acpi_dev); + AcpiDeviceIfClass *adevc =3D ACPI_DEVICE_IF_GET_CLASS(adev); bool x2apic_mode =3D false; =20 AcpiMultipleApicTable *madt; @@ -2708,7 +2707,8 @@ void acpi_build(AcpiBuildTables *tables, MachineState= *machine) aml_len +=3D tables_blob->len - fadt; =20 acpi_add_table(table_offsets, tables_blob); - build_madt(tables_blob, tables->linker, pcms); + build_madt(tables_blob, tables->linker, x86ms, + ACPI_DEVICE_IF(pcms->acpi_dev)); =20 vmgenid_dev =3D find_vmgenid_dev(); if (vmgenid_dev) { --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974773; cv=none; d=zohomail.com; s=zohoarc; b=lNEcBluk8oE2kL0CMP+BTlDTRpoLN9d1lE20AV1ENV4/vpSSDfyWEgrbHA0xrei2HCG6CqpMk4u6Nc1I9vlA8nkdoX7epB+nCXHXh+h/UHE88gvSAQgZENvFZEgevRCWhxMBWA3OTmqF3dNUoZpixa/WaDQ64v6/c4G44uQIXTo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974773; 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=4SkTpw3tlfOMxd2u5FlY1lVrn4tytemDjVdlXjNxP9Y=; b=Yp30EpPFjzgzWdW3/ggAMW42Tm11UcQLnNBSb6l8duo9tP92Rj6KEh/Hgkee6NcN9gscRtibIjbmS/t7KCruw1tILhimwHxiI52uETADj5Kyr4FpICq7MuOMK1fyLl+8sNR2tx1RVcSamg8did/0TRviejMHUDYSJcTIiX5YK2U= 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 1591974773586684.6362898175428; Fri, 12 Jun 2020 08:12:53 -0700 (PDT) Received: from localhost ([::1]:60920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlMR-00047O-SQ for importer@patchew.org; Fri, 12 Jun 2020 11:12:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl3R-0001KU-7g for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:53:13 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:33490 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl3L-0001eW-0R for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:53:12 -0400 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-122-9WwjXo6CMqOLgZOasYvqJQ-1; Fri, 12 Jun 2020 10:53:00 -0400 Received: by mail-wr1-f69.google.com with SMTP id e1so4006669wrm.3 for ; Fri, 12 Jun 2020 07:53:00 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id h15sm9920995wrt.73.2020.06.12.07.52.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:52:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973583; 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=4SkTpw3tlfOMxd2u5FlY1lVrn4tytemDjVdlXjNxP9Y=; b=C3S+bM+HC7A2bD2orvEWZtC5jM2VTLGkpVOgW0qE51Gj0/xUbEnCLJ/A8RqpZ944GbBBYf 2WeISOeRrQAtoYsvRE8mm4R5Eoqrzvm5KoEF8jtspIa/SlG7K5JWPvUjiL4LlYs/Or2G30 qkcClPTRRgI+wTMiwaJS/6r4B7Eg2tY= X-MC-Unique: 9WwjXo6CMqOLgZOasYvqJQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=4SkTpw3tlfOMxd2u5FlY1lVrn4tytemDjVdlXjNxP9Y=; b=d+GETSfS3fYOtdTyi/Ne3oWrUhOj4Xi2tycAOsie0SAIciWei751C3bTv1EXxT+xcF Y6ogY2/VCUzdBkIsE6FnFLHQYQzcat9jhA3dlXMbxzn4IeUgt95XSXCqmgC4elikXjGJ cnFJXQqYTVKguyZO4KFBHsHhJaE4HK+1GoTblbNRmZKlJ/GD3rdKP9fIG6MRyENR4tJo prImCljkgWTq1MhzWRTBE6BwVF6lRbU/bJ6sSrbB+wbEPYXEnCaq8kuTNTV9zsSA77T/ 5+B7v6y4n+1wbovO4rgT0cB+vLqjCJo1qOcvfDoWrGaEEBx8fFeOTcjowCgQD1jH9+x1 0img== X-Gm-Message-State: AOAM53022kiXMrOz7qpO1VQ0jLmD1QCK/ACsg6VvRBP7YGaxPclRQUoh FS58m6dhyyIIhxqU20jIH0o41GTOO4G3ub4YStR8eH8PbhTqoM2C8elYY4PbW0sGgmld7Xuqzbd qWe1FeKsoM5OpSUI= X-Received: by 2002:a1c:b656:: with SMTP id g83mr13701372wmf.27.1591973578710; Fri, 12 Jun 2020 07:52:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwCKRhLe6T7jjRlZIYZDglcFMcNekwHPE+pJ57R0duPA7GPXL4sAK4asnDbFZQyROGlLOQyQ== X-Received: by 2002:a1c:b656:: with SMTP id g83mr13701349wmf.27.1591973578337; Fri, 12 Jun 2020 07:52:58 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:56 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 52/58] acpi: create acpi-common.c and move madt code Message-ID: <20200612141917.9446-53-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:00:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , Gerd Hoffmann , Igor Mammedov , Paolo Bonzini , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Gerd Hoffmann We'll need madt support for microvm. Signed-off-by: Gerd Hoffmann Reviewed-by: Igor Mammedov Message-Id: <20200520132003.9492-7-kraxel@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-common.h | 14 ++++ hw/i386/acpi-build.c | 126 +--------------------------------- hw/i386/acpi-common.c | 152 ++++++++++++++++++++++++++++++++++++++++++ hw/i386/Makefile.objs | 1 + 4 files changed, 170 insertions(+), 123 deletions(-) create mode 100644 hw/i386/acpi-common.h create mode 100644 hw/i386/acpi-common.c diff --git a/hw/i386/acpi-common.h b/hw/i386/acpi-common.h new file mode 100644 index 0000000000..c30e461f18 --- /dev/null +++ b/hw/i386/acpi-common.h @@ -0,0 +1,14 @@ +#ifndef HW_I386_ACPI_COMMON_H +#define HW_I386_ACPI_COMMON_H +#include "include/hw/acpi/acpi_dev_interface.h" + +#include "include/hw/acpi/bios-linker-loader.h" +#include "include/hw/i386/x86.h" + +/* Default IOAPIC ID */ +#define ACPI_BUILD_IOAPIC_ID 0x0 + +void acpi_build_madt(GArray *table_data, BIOSLinker *linker, + X86MachineState *x86ms, AcpiDeviceIf *adev); + +#endif diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index d217fc1fe6..26c0c8aefa 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -24,6 +24,7 @@ #include "qapi/error.h" #include "qapi/qmp/qnum.h" #include "acpi-build.h" +#include "acpi-common.h" #include "qemu/bitmap.h" #include "qemu/error-report.h" #include "hw/pci/pci.h" @@ -89,9 +90,6 @@ #define ACPI_BUILD_DPRINTF(fmt, ...) #endif =20 -/* Default IOAPIC ID */ -#define ACPI_BUILD_IOAPIC_ID 0x0 - typedef struct AcpiPmInfo { bool s3_disabled; bool s4_disabled; @@ -327,124 +325,6 @@ build_facs(GArray *table_data) facs->length =3D cpu_to_le32(sizeof(*facs)); } =20 -void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, - const CPUArchIdList *apic_ids, GArray *entry) -{ - uint32_t apic_id =3D apic_ids->cpus[uid].arch_id; - - /* ACPI spec says that LAPIC entry for non present - * CPU may be omitted from MADT or it must be marked - * as disabled. However omitting non present CPU from - * MADT breaks hotplug on linux. So possible CPUs - * should be put in MADT but kept disabled. - */ - if (apic_id < 255) { - AcpiMadtProcessorApic *apic =3D acpi_data_push(entry, sizeof *apic= ); - - apic->type =3D ACPI_APIC_PROCESSOR; - apic->length =3D sizeof(*apic); - apic->processor_id =3D uid; - apic->local_apic_id =3D apic_id; - if (apic_ids->cpus[uid].cpu !=3D NULL) { - apic->flags =3D cpu_to_le32(1); - } else { - apic->flags =3D cpu_to_le32(0); - } - } else { - AcpiMadtProcessorX2Apic *apic =3D acpi_data_push(entry, sizeof *ap= ic); - - apic->type =3D ACPI_APIC_LOCAL_X2APIC; - apic->length =3D sizeof(*apic); - apic->uid =3D cpu_to_le32(uid); - apic->x2apic_id =3D cpu_to_le32(apic_id); - if (apic_ids->cpus[uid].cpu !=3D NULL) { - apic->flags =3D cpu_to_le32(1); - } else { - apic->flags =3D cpu_to_le32(0); - } - } -} - -static void -build_madt(GArray *table_data, BIOSLinker *linker, - X86MachineState *x86ms, AcpiDeviceIf *adev) -{ - MachineClass *mc =3D MACHINE_GET_CLASS(x86ms); - const CPUArchIdList *apic_ids =3D mc->possible_cpu_arch_ids(MACHINE(x8= 6ms)); - int madt_start =3D table_data->len; - AcpiDeviceIfClass *adevc =3D ACPI_DEVICE_IF_GET_CLASS(adev); - bool x2apic_mode =3D false; - - AcpiMultipleApicTable *madt; - AcpiMadtIoApic *io_apic; - AcpiMadtIntsrcovr *intsrcovr; - int i; - - madt =3D acpi_data_push(table_data, sizeof *madt); - madt->local_apic_address =3D cpu_to_le32(APIC_DEFAULT_ADDRESS); - madt->flags =3D cpu_to_le32(1); - - for (i =3D 0; i < apic_ids->len; i++) { - adevc->madt_cpu(adev, i, apic_ids, table_data); - if (apic_ids->cpus[i].arch_id > 254) { - x2apic_mode =3D true; - } - } - - io_apic =3D acpi_data_push(table_data, sizeof *io_apic); - io_apic->type =3D ACPI_APIC_IO; - io_apic->length =3D sizeof(*io_apic); - io_apic->io_apic_id =3D ACPI_BUILD_IOAPIC_ID; - io_apic->address =3D cpu_to_le32(IO_APIC_DEFAULT_ADDRESS); - io_apic->interrupt =3D cpu_to_le32(0); - - if (x86ms->apic_xrupt_override) { - intsrcovr =3D acpi_data_push(table_data, sizeof *intsrcovr); - intsrcovr->type =3D ACPI_APIC_XRUPT_OVERRIDE; - intsrcovr->length =3D sizeof(*intsrcovr); - intsrcovr->source =3D 0; - intsrcovr->gsi =3D cpu_to_le32(2); - intsrcovr->flags =3D cpu_to_le16(0); /* conforms to bus specifica= tions */ - } - for (i =3D 1; i < 16; i++) { -#define ACPI_BUILD_PCI_IRQS ((1<<5) | (1<<9) | (1<<10) | (1<<11)) - if (!(ACPI_BUILD_PCI_IRQS & (1 << i))) { - /* No need for a INT source override structure. */ - continue; - } - intsrcovr =3D acpi_data_push(table_data, sizeof *intsrcovr); - intsrcovr->type =3D ACPI_APIC_XRUPT_OVERRIDE; - intsrcovr->length =3D sizeof(*intsrcovr); - intsrcovr->source =3D i; - intsrcovr->gsi =3D cpu_to_le32(i); - intsrcovr->flags =3D cpu_to_le16(0xd); /* active high, level trig= gered */ - } - - if (x2apic_mode) { - AcpiMadtLocalX2ApicNmi *local_nmi; - - local_nmi =3D acpi_data_push(table_data, sizeof *local_nmi); - local_nmi->type =3D ACPI_APIC_LOCAL_X2APIC_NMI; - local_nmi->length =3D sizeof(*local_nmi); - local_nmi->uid =3D 0xFFFFFFFF; /* all processors */ - local_nmi->flags =3D cpu_to_le16(0); - local_nmi->lint =3D 1; /* ACPI_LINT1 */ - } else { - AcpiMadtLocalNmi *local_nmi; - - local_nmi =3D acpi_data_push(table_data, sizeof *local_nmi); - local_nmi->type =3D ACPI_APIC_LOCAL_NMI; - local_nmi->length =3D sizeof(*local_nmi); - local_nmi->processor_id =3D 0xff; /* all processors */ - local_nmi->flags =3D cpu_to_le16(0); - local_nmi->lint =3D 1; /* ACPI_LINT1 */ - } - - build_header(linker, table_data, - (void *)(table_data->data + madt_start), "APIC", - table_data->len - madt_start, 1, NULL, NULL); -} - static void build_append_pcihp_notify_entry(Aml *method, int slot) { Aml *if_ctx; @@ -2707,8 +2587,8 @@ void acpi_build(AcpiBuildTables *tables, MachineState= *machine) aml_len +=3D tables_blob->len - fadt; =20 acpi_add_table(table_offsets, tables_blob); - build_madt(tables_blob, tables->linker, x86ms, - ACPI_DEVICE_IF(pcms->acpi_dev)); + acpi_build_madt(tables_blob, tables->linker, x86ms, + ACPI_DEVICE_IF(pcms->acpi_dev)); =20 vmgenid_dev =3D find_vmgenid_dev(); if (vmgenid_dev) { diff --git a/hw/i386/acpi-common.c b/hw/i386/acpi-common.c new file mode 100644 index 0000000000..5caca16a0b --- /dev/null +++ b/hw/i386/acpi-common.c @@ -0,0 +1,152 @@ +/* Support for generating ACPI tables and passing them to Guests + * + * Copyright (C) 2008-2010 Kevin O'Connor + * Copyright (C) 2006 Fabrice Bellard + * Copyright (C) 2013 Red Hat Inc + * + * Author: Michael S. Tsirkin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" + +#include "exec/memory.h" +#include "hw/acpi/acpi.h" +#include "hw/acpi/aml-build.h" +#include "hw/acpi/utils.h" +#include "hw/i386/pc.h" +#include "target/i386/cpu.h" + +#include "acpi-build.h" +#include "acpi-common.h" + +void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, + const CPUArchIdList *apic_ids, GArray *entry) +{ + uint32_t apic_id =3D apic_ids->cpus[uid].arch_id; + + /* ACPI spec says that LAPIC entry for non present + * CPU may be omitted from MADT or it must be marked + * as disabled. However omitting non present CPU from + * MADT breaks hotplug on linux. So possible CPUs + * should be put in MADT but kept disabled. + */ + if (apic_id < 255) { + AcpiMadtProcessorApic *apic =3D acpi_data_push(entry, sizeof *apic= ); + + apic->type =3D ACPI_APIC_PROCESSOR; + apic->length =3D sizeof(*apic); + apic->processor_id =3D uid; + apic->local_apic_id =3D apic_id; + if (apic_ids->cpus[uid].cpu !=3D NULL) { + apic->flags =3D cpu_to_le32(1); + } else { + apic->flags =3D cpu_to_le32(0); + } + } else { + AcpiMadtProcessorX2Apic *apic =3D acpi_data_push(entry, sizeof *ap= ic); + + apic->type =3D ACPI_APIC_LOCAL_X2APIC; + apic->length =3D sizeof(*apic); + apic->uid =3D cpu_to_le32(uid); + apic->x2apic_id =3D cpu_to_le32(apic_id); + if (apic_ids->cpus[uid].cpu !=3D NULL) { + apic->flags =3D cpu_to_le32(1); + } else { + apic->flags =3D cpu_to_le32(0); + } + } +} + +void acpi_build_madt(GArray *table_data, BIOSLinker *linker, + X86MachineState *x86ms, AcpiDeviceIf *adev) +{ + MachineClass *mc =3D MACHINE_GET_CLASS(x86ms); + const CPUArchIdList *apic_ids =3D mc->possible_cpu_arch_ids(MACHINE(x8= 6ms)); + int madt_start =3D table_data->len; + AcpiDeviceIfClass *adevc =3D ACPI_DEVICE_IF_GET_CLASS(adev); + bool x2apic_mode =3D false; + + AcpiMultipleApicTable *madt; + AcpiMadtIoApic *io_apic; + AcpiMadtIntsrcovr *intsrcovr; + int i; + + madt =3D acpi_data_push(table_data, sizeof *madt); + madt->local_apic_address =3D cpu_to_le32(APIC_DEFAULT_ADDRESS); + madt->flags =3D cpu_to_le32(1); + + for (i =3D 0; i < apic_ids->len; i++) { + adevc->madt_cpu(adev, i, apic_ids, table_data); + if (apic_ids->cpus[i].arch_id > 254) { + x2apic_mode =3D true; + } + } + + io_apic =3D acpi_data_push(table_data, sizeof *io_apic); + io_apic->type =3D ACPI_APIC_IO; + io_apic->length =3D sizeof(*io_apic); + io_apic->io_apic_id =3D ACPI_BUILD_IOAPIC_ID; + io_apic->address =3D cpu_to_le32(IO_APIC_DEFAULT_ADDRESS); + io_apic->interrupt =3D cpu_to_le32(0); + + if (x86ms->apic_xrupt_override) { + intsrcovr =3D acpi_data_push(table_data, sizeof *intsrcovr); + intsrcovr->type =3D ACPI_APIC_XRUPT_OVERRIDE; + intsrcovr->length =3D sizeof(*intsrcovr); + intsrcovr->source =3D 0; + intsrcovr->gsi =3D cpu_to_le32(2); + intsrcovr->flags =3D cpu_to_le16(0); /* conforms to bus specifica= tions */ + } + for (i =3D 1; i < 16; i++) { +#define ACPI_BUILD_PCI_IRQS ((1<<5) | (1<<9) | (1<<10) | (1<<11)) + if (!(ACPI_BUILD_PCI_IRQS & (1 << i))) { + /* No need for a INT source override structure. */ + continue; + } + intsrcovr =3D acpi_data_push(table_data, sizeof *intsrcovr); + intsrcovr->type =3D ACPI_APIC_XRUPT_OVERRIDE; + intsrcovr->length =3D sizeof(*intsrcovr); + intsrcovr->source =3D i; + intsrcovr->gsi =3D cpu_to_le32(i); + intsrcovr->flags =3D cpu_to_le16(0xd); /* active high, level trig= gered */ + } + + if (x2apic_mode) { + AcpiMadtLocalX2ApicNmi *local_nmi; + + local_nmi =3D acpi_data_push(table_data, sizeof *local_nmi); + local_nmi->type =3D ACPI_APIC_LOCAL_X2APIC_NMI; + local_nmi->length =3D sizeof(*local_nmi); + local_nmi->uid =3D 0xFFFFFFFF; /* all processors */ + local_nmi->flags =3D cpu_to_le16(0); + local_nmi->lint =3D 1; /* ACPI_LINT1 */ + } else { + AcpiMadtLocalNmi *local_nmi; + + local_nmi =3D acpi_data_push(table_data, sizeof *local_nmi); + local_nmi->type =3D ACPI_APIC_LOCAL_NMI; + local_nmi->length =3D sizeof(*local_nmi); + local_nmi->processor_id =3D 0xff; /* all processors */ + local_nmi->flags =3D cpu_to_le16(0); + local_nmi->lint =3D 1; /* ACPI_LINT1 */ + } + + build_header(linker, table_data, + (void *)(table_data->data + madt_start), "APIC", + table_data->len - madt_start, 1, NULL, NULL); +} + diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs index 8ce1b26533..6abc74551a 100644 --- a/hw/i386/Makefile.objs +++ b/hw/i386/Makefile.objs @@ -16,4 +16,5 @@ obj-$(CONFIG_VMMOUSE) +=3D vmmouse.o obj-$(CONFIG_PC) +=3D port92.o =20 obj-y +=3D kvmvapic.o +obj-$(CONFIG_ACPI) +=3D acpi-common.o obj-$(CONFIG_PC) +=3D acpi-build.o --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591975110; cv=none; d=zohomail.com; s=zohoarc; b=Hx3sLx3whyw6ZsTojS7cYEfGYQ024SUl3e9SOYP4imYFaDWuFnUUFTWgBc6MqhoXBWdLJYxMZDl6yfRAyfIeQ3hw6Sytm4qdxx7lMMtwESOaQNmiHmeoLP1YEI74QIirmk4VhkE/j3VMbvYoYYyKGxcH13SnPF3lvWSRvzRDWoI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591975110; 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=mpMbTsm6mehy6ISo1LlFq8k67fPnsrK8nRjA546c8Mw=; b=IIpqzh/uvjy81KhPH0JYQDAoedWlKZLGVUvRiAojPBKCMLH+Gqzt+HiLWcA9uoevMW4WJ7awtD3pCdDbJNXa6Wm4h1XInvyNJ0LGoZGRAqaCGgd1jq2g1985lgUpo4wYfwt08LpzrpD/976Xa0O+ZeyFVYZ2gbVH8Y3Poyo17NU= 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 1591975110520995.7008947699876; Fri, 12 Jun 2020 08:18:30 -0700 (PDT) Received: from localhost ([::1]:52234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlRr-0004zv-79 for importer@patchew.org; Fri, 12 Jun 2020 11:18:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50696) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl3S-0001PO-Rr for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:53:14 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:57120 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl3Q-0001fv-VA for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:53:14 -0400 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-91-Xx4QqlyTOnKrf6Rd1cL4cw-1; Fri, 12 Jun 2020 10:53:02 -0400 Received: by mail-wr1-f69.google.com with SMTP id a4so3987681wrp.5 for ; Fri, 12 Jun 2020 07:53:01 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id h27sm12294814wrb.18.2020.06.12.07.52.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:53:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973592; 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=mpMbTsm6mehy6ISo1LlFq8k67fPnsrK8nRjA546c8Mw=; b=YGd6U0FA36KHrmzNmroz8bK3ILxnidepYa67GFJR5UQvwJxju7ZlLUjQW5w3T9p7Q5J6c4 G8AOS34ciKf5mAvrJ39qCPtskpyLHoHgtRpLLwskILvnSDR9zZUAP57sWt8SvukakhF5bz o6OQMvX/153Cs9orp6aPjS/yb1FKf+c= X-MC-Unique: Xx4QqlyTOnKrf6Rd1cL4cw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=mpMbTsm6mehy6ISo1LlFq8k67fPnsrK8nRjA546c8Mw=; b=RrUYxo7eTnOP7inY/6dTvspy2XH+ZLRl51mzoI6Xt2gjFMkgoLKXz9VxUDc37LIaH0 eSFanLw2HIYC/kLmSlg6rhfYmXy7dgrRAoze0q6Y/GJXe1wiCqE7AeLFh1ZIZeeAs/FE NUdOQL5Ogy6HauzuVDHbb/B1Kt+1vgyx2l56fECqpHwewnon3jBqtY2Kxe9UcsB5d3FA JLSGjsZUcYQpQ7VHNU4zjBYxAdJQ5sPPMdpfqn203QOax5OHkH5nYdPPaRR4gRxh5YAE QJefhiHQdMNxDPpcNkvNzI9e+0AcKR07Q7mbo4v6NBJYsLv3KG7m1rngD25dmsgiyQDl RHqw== X-Gm-Message-State: AOAM530e0fUk1sL6ywmX+AGOcHUL34frTFD/mjRAFLP2vBOQSI9BnVzb WvyfMCN4b0MQQW8mWRfxp6gkl2Oek0ShuxoZA4YDSGIQn1JQAV2ReGHoRx10pjRUXU/jUnTaFJB tLJqrzE360PKzvko= X-Received: by 2002:adf:ed49:: with SMTP id u9mr15156118wro.414.1591973580856; Fri, 12 Jun 2020 07:53:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7+/EmDs+esUL55nYkNA2YVXft42CQkYXR+sgSma7tjR34v7bHmuj5fEugK3MYizzds3BhdA== X-Received: by 2002:adf:ed49:: with SMTP id u9mr15156092wro.414.1591973580663; Fri, 12 Jun 2020 07:53:00 -0700 (PDT) Date: Fri, 12 Jun 2020 10:52:58 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 53/58] acpi: madt: skip pci override on pci-less systems. Message-ID: <20200612141917.9446-54-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , Gerd Hoffmann , Igor Mammedov , Paolo Bonzini , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Gerd Hoffmann Needed for microvm. Signed-off-by: Gerd Hoffmann Reviewed-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200520132003.9492-8-kraxel@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-common.h | 3 ++- hw/i386/acpi-build.c | 2 +- hw/i386/acpi-common.c | 26 +++++++++++++++----------- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/hw/i386/acpi-common.h b/hw/i386/acpi-common.h index c30e461f18..9cac18dddf 100644 --- a/hw/i386/acpi-common.h +++ b/hw/i386/acpi-common.h @@ -9,6 +9,7 @@ #define ACPI_BUILD_IOAPIC_ID 0x0 =20 void acpi_build_madt(GArray *table_data, BIOSLinker *linker, - X86MachineState *x86ms, AcpiDeviceIf *adev); + X86MachineState *x86ms, AcpiDeviceIf *adev, + bool has_pci); =20 #endif diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 26c0c8aefa..473cbdfffd 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2588,7 +2588,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState= *machine) =20 acpi_add_table(table_offsets, tables_blob); acpi_build_madt(tables_blob, tables->linker, x86ms, - ACPI_DEVICE_IF(pcms->acpi_dev)); + ACPI_DEVICE_IF(pcms->acpi_dev), true); =20 vmgenid_dev =3D find_vmgenid_dev(); if (vmgenid_dev) { diff --git a/hw/i386/acpi-common.c b/hw/i386/acpi-common.c index 5caca16a0b..ab9b00581a 100644 --- a/hw/i386/acpi-common.c +++ b/hw/i386/acpi-common.c @@ -72,7 +72,8 @@ void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, } =20 void acpi_build_madt(GArray *table_data, BIOSLinker *linker, - X86MachineState *x86ms, AcpiDeviceIf *adev) + X86MachineState *x86ms, AcpiDeviceIf *adev, + bool has_pci) { MachineClass *mc =3D MACHINE_GET_CLASS(x86ms); const CPUArchIdList *apic_ids =3D mc->possible_cpu_arch_ids(MACHINE(x8= 6ms)); @@ -111,18 +112,21 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *= linker, intsrcovr->gsi =3D cpu_to_le32(2); intsrcovr->flags =3D cpu_to_le16(0); /* conforms to bus specifica= tions */ } - for (i =3D 1; i < 16; i++) { + + if (has_pci) { + for (i =3D 1; i < 16; i++) { #define ACPI_BUILD_PCI_IRQS ((1<<5) | (1<<9) | (1<<10) | (1<<11)) - if (!(ACPI_BUILD_PCI_IRQS & (1 << i))) { - /* No need for a INT source override structure. */ - continue; + if (!(ACPI_BUILD_PCI_IRQS & (1 << i))) { + /* No need for a INT source override structure. */ + continue; + } + intsrcovr =3D acpi_data_push(table_data, sizeof *intsrcovr); + intsrcovr->type =3D ACPI_APIC_XRUPT_OVERRIDE; + intsrcovr->length =3D sizeof(*intsrcovr); + intsrcovr->source =3D i; + intsrcovr->gsi =3D cpu_to_le32(i); + intsrcovr->flags =3D cpu_to_le16(0xd); /* active high, level = triggered */ } - intsrcovr =3D acpi_data_push(table_data, sizeof *intsrcovr); - intsrcovr->type =3D ACPI_APIC_XRUPT_OVERRIDE; - intsrcovr->length =3D sizeof(*intsrcovr); - intsrcovr->source =3D i; - intsrcovr->gsi =3D cpu_to_le32(i); - intsrcovr->flags =3D cpu_to_le16(0xd); /* active high, level trig= gered */ } =20 if (x2apic_mode) { --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.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=1591974697; cv=none; d=zohomail.com; s=zohoarc; b=AG0Dk7dvfw5Z0himoT8awZs2NTiI79jV+l3xN018wPwoNvwYe51aVUKMnOB/LRzT/exisNm/5B+/SdvZMhfHj/1+zequaSPpXYvZlF3k88s9ZzK9WC7UMVCuJw+8uFhK/+1m9L3oqUnJ6YSZBEJSJfH2xvJTrjwXb0ZM4xgCx/Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974697; h=Content-Type: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=2tWNry73oPv2gQlztpgeBRBkHzYAUwx8arM+2V6vlZU=; b=U0aSa8sBfT45CK2MeYt2DgRKM8q/+Yy+VdzQZnpRJXSIyWKNGpk+yhAuaij666GUqott4iRFf/I85pYgVGA88i9IeJUbVpUWVmG1XSNbfgHUJ7sHoi8SCR+P4M41QJKRUptwixI3k3Wu63KBFe3OCAUf7vll51gGHTiWkgBd7KQ= 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 1591974697471479.0553146213724; Fri, 12 Jun 2020 08:11:37 -0700 (PDT) Received: from localhost ([::1]:54574 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlLE-0000pG-Kn for importer@patchew.org; Fri, 12 Jun 2020 11:11:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50688) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl3S-0001Mo-36 for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:53:14 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:46175 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl3O-0001eu-Qt for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:53:13 -0400 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-114-FR1BFfhUNRaFgbS2hdUC8g-1; Fri, 12 Jun 2020 10:53:04 -0400 Received: by mail-wr1-f71.google.com with SMTP id h6so4019293wrx.4 for ; Fri, 12 Jun 2020 07:53:04 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id z206sm9561863wmg.30.2020.06.12.07.53.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:53:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973586; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2tWNry73oPv2gQlztpgeBRBkHzYAUwx8arM+2V6vlZU=; b=DmOH+ahSsMnKTXheLuE6MZSgEWE7gYa53qkIb+0G8WtMMDg9e8GZ8NVEa4z1xTFnVQJ7yP vl8Ckj19BzsqYH8Vx/69mKvuLhi3x9Y6vvnUK1PkoaLvHxZkzij0vEcuehqvNVimOycVjT ZOTk64/Nz/fuuH+DP1e8AJaRoE8EJEo= X-MC-Unique: FR1BFfhUNRaFgbS2hdUC8g-1 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=2tWNry73oPv2gQlztpgeBRBkHzYAUwx8arM+2V6vlZU=; b=mafemCS7uQy6wq/S/hjWS24gfEn8+7pVd3ZlMm/pBgmE+8O8txUsEpDwcZyeWm1RnW KCZery8Pyz97ORntwT4bM7wfwHP+XSgtmEZS5HXYsbpJ/bE2cThDZgBBMp1fVgwvOEKs uKPwTnFB/BNJTt4STSJSqQ3cNDe5x6Z4cmNoN+SPRxGac9y25qiJULI1awCwgzqdfTD4 gSZkI5wi+6NVY1VPy7rSLikhU8F+tXA/VAJbw7+YQ9qdhW1SBST8KMAQesUadnk/WLnP Z29/bUqcN4apczmgaB2XNOtAwn3LUsgVJ9IWD/YmdCsW5pGurfk62+Z74umOx5yAyp9u 8cAg== X-Gm-Message-State: AOAM532h0TvH7LrMDfv60W+Z0v8sND4a1PnEbkMi/Qapokf/NxTAf6bH oyMdIM6v87Oiw3XzY2Jw47RAqB+4Y4n5A9KGU7+RgpERT7d+rXndO3ztvERgtRSj2wA+so1Pst4 ApssxA/FIz/PZ6ZY= X-Received: by 2002:adf:f205:: with SMTP id p5mr16382959wro.302.1591973582837; Fri, 12 Jun 2020 07:53:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwc14BKPyIKhs1OuKJ3EPlYFqZ34/1iXfmlY2UBj3gIzeZrcVhR636cIWmvK342Y0PkeO4PBg== X-Received: by 2002:adf:f205:: with SMTP id p5mr16382934wro.302.1591973582620; Fri, 12 Jun 2020 07:53:02 -0700 (PDT) Date: Fri, 12 Jun 2020 10:53:00 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 54/58] acpi: fadt: add hw-reduced sleep register support Message-ID: <20200612141917.9446-55-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 09:30:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Gerd Hoffmann Add fields to struct AcpiFadtData and update build_fadt() to properly generate sleep register entries. Signed-off-by: Gerd Hoffmann Reviewed-by: Igor Mammedov Message-Id: <20200520132003.9492-9-kraxel@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/acpi-defs.h | 2 ++ hw/acpi/aml-build.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h index c13327fa78..3be9ab5049 100644 --- a/include/hw/acpi/acpi-defs.h +++ b/include/hw/acpi/acpi-defs.h @@ -88,6 +88,8 @@ typedef struct AcpiFadtData { struct AcpiGenericAddress pm_tmr; /* PM_TMR_BLK */ struct AcpiGenericAddress gpe0_blk; /* GPE0_BLK */ struct AcpiGenericAddress reset_reg; /* RESET_REG */ + struct AcpiGenericAddress sleep_ctl; /* SLEEP_CONTROL_REG */ + struct AcpiGenericAddress sleep_sts; /* SLEEP_STATUS_REG */ uint8_t reset_val; /* RESET_VALUE */ uint8_t rev; /* Revision */ uint32_t flags; /* Flags */ diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index d24e9e6c3a..2cb7b991ef 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1866,9 +1866,9 @@ void build_fadt(GArray *tbl, BIOSLinker *linker, cons= t AcpiFadtData *f, } =20 /* SLEEP_CONTROL_REG */ - build_append_gas(tbl, AML_AS_SYSTEM_MEMORY, 0 , 0, 0, 0); + build_append_gas_from_struct(tbl, &f->sleep_ctl); /* SLEEP_STATUS_REG */ - build_append_gas(tbl, AML_AS_SYSTEM_MEMORY, 0 , 0, 0, 0); + build_append_gas_from_struct(tbl, &f->sleep_sts); =20 /* TODO: extra fields need to be added to support revisions above rev5= */ assert(f->rev =3D=3D 5); --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974576; cv=none; d=zohomail.com; s=zohoarc; b=OKz8z4PH2PE6dvI7YO9ga4uG40fMrTeEeRbycN534XsoFBMLbjsWODYnYcVM1rNAGUOO2sk0Td2LjB6zzcnDcQWtGGMxTYAXcYmn7qR51lKL/4cZ5TAPqoLyXAEIv46cAL82xJXdWMBN7JHtDlLHWnT3UYYPhhvWkG2L2Frz860= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974576; 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=7szwIaLeQ8ZLnLw2poVLDcD+YJimMkOHW+I2Lu0XpBE=; b=lX4npoTCLEzhwvCQ8b82fmhPldkcUF1JZrHW01PEuTwfhwIFBgppdBuXr+OF7AUDXPCD/XdOU5J1z9+FlHkkSiGU0kMzTzK63jrM9XHXrtc6fNtawZ5/3dTdCSnvNQkLvvL2dCfsbfBU8YosDU1zNznVYu5YLACf/85GW0a8LlQ= 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 1591974576882934.5602737386628; Fri, 12 Jun 2020 08:09:36 -0700 (PDT) Received: from localhost ([::1]:46170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlJH-0005Pc-Su for importer@patchew.org; Fri, 12 Jun 2020 11:09:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50658) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl3Q-0001Ig-KK for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:53:12 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:53133 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl3O-0001f7-R9 for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:53:12 -0400 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-423-efcmvOAJPoOZPhFmxCrVVw-1; Fri, 12 Jun 2020 10:53:06 -0400 Received: by mail-wm1-f69.google.com with SMTP id b63so3878452wme.1 for ; Fri, 12 Jun 2020 07:53:05 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id 5sm14513623wrr.5.2020.06.12.07.53.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:53:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973588; 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=7szwIaLeQ8ZLnLw2poVLDcD+YJimMkOHW+I2Lu0XpBE=; b=eHyzHfaomNKNSea+mS256znwoBANxtHjBmRNURL87NsH9rKpB7p68c0RikHdeMWjDauPCS t5f1it00gTvs+7sDtYdbZTCQEjK9T5A4fnIwZhawiLsoGvjIyT7grrOtXm+3XcdSCjuYtL aCvtAex8LiNAtOCB9pyqgWipXHeVmbg= X-MC-Unique: efcmvOAJPoOZPhFmxCrVVw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=7szwIaLeQ8ZLnLw2poVLDcD+YJimMkOHW+I2Lu0XpBE=; b=qVqW2KLnc29+2q3FhffjWD1p2ohvN7pfb8TqCl5Wqsr2IVwacLyLsmKJYS0StIqhB6 UJJ7X9qat63zRGhE4O9HJnZNlFU6rvoA/x1AXN5Pa7SvZ1IR0cpoWRQRvkg4D6GgEx0A lGVqQrvjeAaL6RhSZjvb1k7Cr3D/qAFcz1KkdGh9Y1F9bEge1qno461WzI3juGlOhNdY xg4zSMtWRq0UQN5c13VAaSC7xA5jC4izoFulwwmcBj1CqM9Bd+jmgQrEpsbexbbVf5hI 3uQlzZTVl+L8dDgUvclB7Z9spdJWrtS7FFdjvmiMNKSqijwuUjifvwzdmnFbLX8WoODO O41w== X-Gm-Message-State: AOAM530Ixbz0XIHvNbtKRCNeWmrCb7yQ1doVdID6KCGAy01fDz1iqaCN fLwGb41ZS6QWRMl+XyH4GZ9hQh/9VHI5z7BjCmObTn+O+E/yqdo1uf4u1DGBjQD/SUTPKP88s/I EZWi3QWuu9Mfc1ao= X-Received: by 2002:a5d:5092:: with SMTP id a18mr15274568wrt.42.1591973584872; Fri, 12 Jun 2020 07:53:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxa3FKBi+axwSWX+7/7m/yG2Mi06qHbaqCZm9dtzjBWj4ZkG396bwtpb9ll+MDJe6bFWblv/Q== X-Received: by 2002:a5d:5092:: with SMTP id a18mr15274549wrt.42.1591973584698; Fri, 12 Jun 2020 07:53:04 -0700 (PDT) Date: Fri, 12 Jun 2020 10:53:02 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 55/58] acpi: ged: rename event memory region Message-ID: <20200612141917.9446-56-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:26 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Igor Mammedow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Gerd Hoffmann Rename memory region and callbacks and ops to carry "evt" in the name because a second region will be added shortly. Signed-off-by: Gerd Hoffmann Message-Id: <20200520132003.9492-10-kraxel@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Igor Mammedow Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/generic_event_device.h | 2 +- hw/acpi/generic_event_device.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/hw/acpi/generic_event_device.h b/include/hw/acpi/gener= ic_event_device.h index 83917de024..90a9180db5 100644 --- a/include/hw/acpi/generic_event_device.h +++ b/include/hw/acpi/generic_event_device.h @@ -86,7 +86,7 @@ #define ACPI_GED_NVDIMM_HOTPLUG_EVT 0x4 =20 typedef struct GEDState { - MemoryRegion io; + MemoryRegion evt; uint32_t sel; } GEDState; =20 diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c index b1cbdd86b6..1cb34111e5 100644 --- a/hw/acpi/generic_event_device.c +++ b/hw/acpi/generic_event_device.c @@ -142,7 +142,7 @@ void build_ged_aml(Aml *table, const char *name, Hotplu= gHandler *hotplug_dev, } =20 /* Memory read by the GED _EVT AML dynamic method */ -static uint64_t ged_read(void *opaque, hwaddr addr, unsigned size) +static uint64_t ged_evt_read(void *opaque, hwaddr addr, unsigned size) { uint64_t val =3D 0; GEDState *ged_st =3D opaque; @@ -161,14 +161,14 @@ static uint64_t ged_read(void *opaque, hwaddr addr, u= nsigned size) } =20 /* Nothing is expected to be written to the GED memory region */ -static void ged_write(void *opaque, hwaddr addr, uint64_t data, - unsigned int size) +static void ged_evt_write(void *opaque, hwaddr addr, uint64_t data, + unsigned int size) { } =20 -static const MemoryRegionOps ged_ops =3D { - .read =3D ged_read, - .write =3D ged_write, +static const MemoryRegionOps ged_evt_ops =3D { + .read =3D ged_evt_read, + .write =3D ged_evt_write, .endianness =3D DEVICE_LITTLE_ENDIAN, .valid =3D { .min_access_size =3D 4, @@ -287,9 +287,9 @@ static void acpi_ged_initfn(Object *obj) SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); GEDState *ged_st =3D &s->ged_state; =20 - memory_region_init_io(&ged_st->io, obj, &ged_ops, ged_st, + memory_region_init_io(&ged_st->evt, obj, &ged_evt_ops, ged_st, TYPE_ACPI_GED, ACPI_GED_EVT_SEL_LEN); - sysbus_init_mmio(sbd, &ged_st->io); + sysbus_init_mmio(sbd, &ged_st->evt); =20 sysbus_init_irq(sbd, &s->irq); =20 --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591974804; cv=none; d=zohomail.com; s=zohoarc; b=EFRioS2NHmpEkhF9xWI6eCPk+ke0ZxOEeR2Kr0KyIVUhdnbNXJV3xGugAXCi5LNG7pLAdc6eYSiXmyn6Z5f8JYoIjZWuyxhIU3lz30XdcGVBIhuH6QW2uKqDIWvQAW1VsK6YResyIDVe545IKRkU2Ovp/i7paSFiEa37gKb1b7Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591974804; 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=7i0b3GPG3H6Dh/tglQZmkCX3+dgrOP3sk2+xsAeedP8=; b=nsykZRINOYygPKE82ER7eLNA4jkxiO97/NZ5GLMQx1s+6Rip++AsP5YM3rc3GK1ybCDdD8G0SPGxoD4deZZeBvWfO34abrdYCNMza+d/or1m54Ts+Lqez8cxDK57kUTghsfkd/Sn/76TfDtjzi+c4DHzpBq3TLlGRBFV+EliS7s= 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 1591974804245851.0250933791309; Fri, 12 Jun 2020 08:13:24 -0700 (PDT) Received: from localhost ([::1]:34822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlMx-0005eD-EI for importer@patchew.org; Fri, 12 Jun 2020 11:13:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50758) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl3b-0001jc-S1 for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:53:27 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:54142 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl3Y-0001l1-FH for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:53:22 -0400 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-408-LnAI_Ao5PF-fraJ4Fk8wkA-1; Fri, 12 Jun 2020 10:53:08 -0400 Received: by mail-wm1-f70.google.com with SMTP id g84so2545837wmf.4 for ; Fri, 12 Jun 2020 07:53:07 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id z12sm11412692wrg.9.2020.06.12.07.53.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:53:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973599; 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=7i0b3GPG3H6Dh/tglQZmkCX3+dgrOP3sk2+xsAeedP8=; b=PCvT0JDduVIqXsksRvoevv4Bqn3mTkPBVUbmUmRR/SNJ8guUQu4y/R+nIlqaCNhRORUE3d iIWU52NgtnMitO7puwo8ULJs9u1EsQbJ7/8QWwCdUsIMCv6MwvEW105WmxDPpyFG+I/FFr 7RpZgYCozVTCr7nPkh+mxFrPKS7B5yY= X-MC-Unique: LnAI_Ao5PF-fraJ4Fk8wkA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=7i0b3GPG3H6Dh/tglQZmkCX3+dgrOP3sk2+xsAeedP8=; b=F/vQUhTkonhA0RN2QFl8PcMV8oi78h4GS1kiZxZPbFRfHMhjRyuYFAsBJ4ngsNWnqz zxObz3Ljz+qrxCL1tgfl3EHpoCk5JqY6CsEqiNvL3AVXN/3j3+bjIKr5q6B97rmvJPom Pxx2RlHYN7STyyX1BFdHHyxI6g62oyWkunB0mW+Ume+AAGLAr2cBBY5r/0YGsJvFIMAx HW8zkUXJj5+rTeeX4+5dwpuDhXwYds7wyZ8O67dDM6y6fNH+iTKxlOlxl+YOGRNpdK4H RLWT5ZAQuTEl0l6NfcJEHe4z5hY4lpcJTFqja9iMkwLrBLJ/Ivp5KRtDLAPkls5z7mc7 pzIw== X-Gm-Message-State: AOAM532z6nzsPU58D5daOlZgpAdsBgsK0QbwKNdVoYLas+O7Ebvogng1 N4nE828o5Pi+4oINxOE2rZo0fRHIuPsBdXwUiQgH2MbuvzUue1QMKf/hvJTOAEifjzVeRdj2WOi TJoOE7vC6yDByft8= X-Received: by 2002:a7b:c201:: with SMTP id x1mr13553733wmi.58.1591973586894; Fri, 12 Jun 2020 07:53:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxO0ZurgxOIxY6Ld7PFyu/GlaMEhzw3p051F3sGqjFh+91rkas+F1m5zD1X+zowEIEz5GUQ/A== X-Received: by 2002:a7b:c201:: with SMTP id x1mr13553712wmi.58.1591973586655; Fri, 12 Jun 2020 07:53:06 -0700 (PDT) Date: Fri, 12 Jun 2020 10:53:04 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 56/58] Fix parameter type in vhost migration log path Message-ID: <20200612141917.9446-57-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:00:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Raphael Norwitz , Raphael Norwitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Raphael Norwitz The =E2=80=98enable=E2=80=99 parameter to the vhost_migration_log() functio= n is given as an int, but "true"/"false" values are passed in wherever it is invoked. Inside the function itself it is only ever compared with bool values. Therefore the parameter value itself should be changed to bool. Signed-off-by: Raphael Norwitz Message-Id: Reviewed-by: Eric Blake Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index aff98a0ede..aa06a36919 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -809,12 +809,12 @@ err_features: return r; } =20 -static int vhost_migration_log(MemoryListener *listener, int enable) +static int vhost_migration_log(MemoryListener *listener, bool enable) { struct vhost_dev *dev =3D container_of(listener, struct vhost_dev, memory_listener); int r; - if (!!enable =3D=3D dev->log_enabled) { + if (enable =3D=3D dev->log_enabled) { return 0; } if (!dev->started) { --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591975214; cv=none; d=zohomail.com; s=zohoarc; b=WLvY/bPjPcjrJldcnjD00Rg2aLxMFoUSsq4/hoy9YMLLZY0CAlwtXQwJk2BaP5zkx9qw4wDR9I0bqWaEpTpP/cA5AI1Lb3Ui4Jt7RjApYMXq59YHZQGHXnBo6AdSo08PIUM28JPiW/jpoaLgj80pgUGNv9eiI3KpZKmXLZM/RTo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591975214; 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=D/GZNs5L1C46gfOzGMxtE23sRQlVqpPh51YO3SQfyZM=; b=MSIS6sUohWxCz5RWOuu2GA16NiyhqLwj1ECN5X87QL6YtVuBDt8kUWpTL+SIoGcEaA+imXyaDxxpQq3g4TCOlR0m6ZjjSk30ADdzqt+zCLSScQ5qgZmJfJyneR7smIbadFTPmUIZwnlVUkGvkvomhZxcPcJJiY1sieClhvBnW58= 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 1591975214120382.1686404307668; Fri, 12 Jun 2020 08:20:14 -0700 (PDT) Received: from localhost ([::1]:60716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlTY-0008Pe-RQ for importer@patchew.org; Fri, 12 Jun 2020 11:20:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50752) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl3a-0001i6-9a for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:53:22 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:56642 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl3Y-0001l3-FI for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:53:21 -0400 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-218--s92U7c-PS25Tu2R-BKSDQ-1; Fri, 12 Jun 2020 10:53:10 -0400 Received: by mail-wr1-f72.google.com with SMTP id w16so3977463wru.18 for ; Fri, 12 Jun 2020 07:53:10 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id d9sm10286957wre.28.2020.06.12.07.53.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:53:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973599; 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=D/GZNs5L1C46gfOzGMxtE23sRQlVqpPh51YO3SQfyZM=; b=DtKPh3/jHpHpknEgQxeWeFj1fQc5Wr7iTrSqsTgYlgExbCSN7zNLO15ez3RXX1NfoHYR6f soNCiCs67tC2JwSgG/UiNt5g315WgCpJM05EfHvzq76ZEWivvGj77NhknNPO0F/MlQ8iB2 vCyaYggVfPTRrinuZ1XJ6DzbEaguSV8= X-MC-Unique: -s92U7c-PS25Tu2R-BKSDQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=D/GZNs5L1C46gfOzGMxtE23sRQlVqpPh51YO3SQfyZM=; b=JsXkkIrA1r6+TS0bZafStIocTwy07j1KSlV4NKqWh5gBGyrG1h2oyNHsgusol8gdIY 8aiyFeRLfnip0a/zl7DS10WsY9aGNNquPbnSUezd5tcM/RsuhKIYOknD3R2MgbRV6BsO dkDfSfwpx5wP6IEhTGri14ILmFYzw4kHehOvJ5YbvmQiPF2J0/BSXvS2QQToM/IuXkhP +OF1/sHVUDg78O8eDETpuUwXFsnDKmF1QK/ZDDgULO8EADyCslAxhP9MVNpa9nW86RPq oxD6yu7AIbieplZgIrzOU13JSq3SZaLHTkuT6PWzIqM+1hcJoiJshAnkgPjFg7UlcRGj oP+g== X-Gm-Message-State: AOAM533kHxxdIhYJOvcGq2L27fHE/eKm9f5ahSfgVY7LQ+EfNM5bHUlD FG+U7qCytc/MyWlU6NP9Qiv4or1597Vz6BIb6iu4+4wNbWuxp2DMgoiV2VIbYIjoRvfNJFfR5bx cS5UQNfv1/PZeyEg= X-Received: by 2002:a7b:cf02:: with SMTP id l2mr13811840wmg.136.1591973589411; Fri, 12 Jun 2020 07:53:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7xp0gcKJKKCkJffaHQnlVl4YAOFuhnq+k1Wmzpgw6wmORfyYY30TGsbE2HiW0+cao2ZIpXA== X-Received: by 2002:a7b:cf02:: with SMTP id l2mr13811811wmg.136.1591973589172; Fri, 12 Jun 2020 07:53:09 -0700 (PDT) Date: Fri, 12 Jun 2020 10:53:07 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 57/58] pci: Display PCI IRQ pin in "info pci" Message-ID: <20200612141917.9446-58-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 09:30:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Julia Suvorova , "Dr . David Alan Gilbert" , Peter Xu , Markus Armbruster , Alex Williamson , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Peter Xu Sometimes it would be good to be able to read the pin number along with the IRQ number allocated. Since we'll dump the IRQ number, no reason to not dump the pin information. For example, the vfio-pci device will overwrite the pin with the hardware pin number. It would be nice to know the pin number of one assigned device from QMP/HMP. CC: Dr. David Alan Gilbert CC: Alex Williamson CC: Michael S. Tsirkin CC: Marcel Apfelbaum CC: Julia Suvorova CC: Markus Armbruster Signed-off-by: Peter Xu Message-Id: <20200317195908.283800-1-peterx@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Dr. David Alan Gilbert Acked-by: Markus Armbruster --- qapi/misc.json | 6 ++++-- hw/pci/pci.c | 1 + monitor/hmp-cmds.c | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/qapi/misc.json b/qapi/misc.json index 99b90ac80b..a5a0beb902 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -403,6 +403,8 @@ # # @irq: if an IRQ is assigned to the device, the IRQ number # +# @irq_pin: the IRQ pin, zero means no IRQ (since 5.1) +# # @qdev_id: the device name of the PCI device # # @pci_bridge: if the device is a PCI bridge, the bridge information @@ -417,8 +419,8 @@ { 'struct': 'PciDeviceInfo', 'data': {'bus': 'int', 'slot': 'int', 'function': 'int', 'class_info': 'PciDeviceClass', 'id': 'PciDeviceId', - '*irq': 'int', 'qdev_id': 'str', '*pci_bridge': 'PciBridgeInfo', - 'regions': ['PciMemoryRegion']} } + '*irq': 'int', 'irq_pin': 'int', 'qdev_id': 'str', + '*pci_bridge': 'PciBridgeInfo', 'regions': ['PciMemoryRegion'] = }} =20 ## # @PciInfo: diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 1b88a32cf7..a60cf3ae3b 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1776,6 +1776,7 @@ static PciDeviceInfo *qmp_query_pci_device(PCIDevice = *dev, PCIBus *bus, info->regions =3D qmp_query_pci_regions(dev); info->qdev_id =3D g_strdup(dev->qdev.id ? dev->qdev.id : ""); =20 + info->irq_pin =3D dev->config[PCI_INTERRUPT_PIN]; if (dev->config[PCI_INTERRUPT_PIN] !=3D 0) { info->has_irq =3D true; info->irq =3D dev->config[PCI_INTERRUPT_LINE]; diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 9c61e769ca..e03adf0d4d 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -688,7 +688,8 @@ static void hmp_info_pci_device(Monitor *mon, const Pci= DeviceInfo *dev) } =20 if (dev->has_irq) { - monitor_printf(mon, " IRQ %" PRId64 ".\n", dev->irq); + monitor_printf(mon, " IRQ %" PRId64 ", pin %c\n", + dev->irq, (char)('A' + dev->irq_pin - 1)); } =20 if (dev->has_pci_bridge) { --=20 MST From nobody Mon May 20 22:40:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591975244; cv=none; d=zohomail.com; s=zohoarc; b=KZ/CJBp7FQYlSL1VKPnderD1MLYqYFUlWAHOCFZiNNqwjDqhmP9LYRyL5cScBdeJJWtYdA9/asKoTrMHUqjES4epntS3kkNudSjNc1UZa7fhU7lx5dzzy4Pv0qnr8aIltEGyHF5ijtNh+geS0hEmTYgpLA5oP+y1bNnfJ2mXr8w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591975244; h=Content-Type: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=Md6vo2LrasxyjY0uRkbE4pzqGEK/9UBJvsNzXykdtFE=; b=dL5eb41QihEiCo3S5pxD4vXzGew5NTsWB8bDDHhueKRq7eBD3djpldT2JL2H0NXerHhKm3YItWd5cqhpMsZpPML9scYLKile4Vh9BxV33c/0vRZSmaQsHdxVxSVXSfsXy6SeHTQ5ljxcdl8iXI10h1zF9Bp/bJrNEb8k6+dVqPY= 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 1591975244240790.8825416630906; Fri, 12 Jun 2020 08:20:44 -0700 (PDT) Received: from localhost ([::1]:35222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlU2-0001AP-VU for importer@patchew.org; Fri, 12 Jun 2020 11:20:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51988) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjl6C-0006hu-DP for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:56:04 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:49452 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jjl6A-0002LA-PQ for qemu-devel@nongnu.org; Fri, 12 Jun 2020 10:56:04 -0400 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-27-uch6L2XQPhi-fGOtkIgs0g-1; Fri, 12 Jun 2020 10:53:12 -0400 Received: by mail-wm1-f70.google.com with SMTP id u15so2036260wmm.5 for ; Fri, 12 Jun 2020 07:53:12 -0700 (PDT) Received: from redhat.com (bzq-79-178-18-124.red.bezeqint.net. [79.178.18.124]) by smtp.gmail.com with ESMTPSA id 23sm9695058wmo.18.2020.06.12.07.53.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 07:53:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591973762; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Md6vo2LrasxyjY0uRkbE4pzqGEK/9UBJvsNzXykdtFE=; b=gtQISJIX+3lzCx26qokseUq0rbXohoUPy2A7ygR8zol7eFAZCmdOX2zY6wSljK7Myb9X05 62izJR4uDcDczh90/mrbD0vmLmXnHtpJ+qPTJ+0t8/aWQi5RiweEVTgn+FI+JNiTsLUPif v0aUNEki5C/Xtmn7rH7cwVGkElWM0VE= X-MC-Unique: uch6L2XQPhi-fGOtkIgs0g-1 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=Md6vo2LrasxyjY0uRkbE4pzqGEK/9UBJvsNzXykdtFE=; b=etyRBP0BapybySLTIDI3OcxLSBOoDjnjf9WmHDt/dkVKrPpOns6rSVUxYlZmGPJkxi TvPn4RRFvXeVWijr40rVAlggJygZTv0IPB3THreMw313oXB0CFrCWtg0TYWPVJS1WGBI iwPSBpio+ZD+VV/HHUI2DHqTWsciowht3gMI81dXktiQyHU2MZoPtAeME/Ne9rYgKPvM XsqGHrCdnMxaH0UMpiszX0FgRUMAXDfrlhm4L1f0KbD2RJD2PU88cBdkiMv/W0dpBwc2 ZHePOBwOCxIPgf1epj9dVdyELWn2+HucdmP2hmicG4Mu1nI1b0BiGq4y2PKKqA6Red86 41ag== X-Gm-Message-State: AOAM532LhA7mnEGhyARWcOqNkAUtmXe5ZhI2/gzAUunl0rx6blz8CMhu +PQXSHQlKh/pUiMFk90cso/AZj8nYfpuyDXZdNzVGz9tqFyCekhgHDUaZd3aY5qb8vuaqIhS6YE Bo3StWfLxMSN/yJ0= X-Received: by 2002:adf:f446:: with SMTP id f6mr15327333wrp.59.1591973591416; Fri, 12 Jun 2020 07:53:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzs2YowVJuuMs2q+eclSLwCdMPq59T7t941tTR+bwRmytba306Tyz9E/yYc/f+V6GG3C5oX7g== X-Received: by 2002:adf:f446:: with SMTP id f6mr15327314wrp.59.1591973591228; Fri, 12 Jun 2020 07:53:11 -0700 (PDT) Date: Fri, 12 Jun 2020 10:53:09 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 58/58] virtio-pci: fix queue_enable write Message-ID: <20200612141917.9446-59-mst@redhat.com> References: <20200612141917.9446-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200612141917.9446-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 08:07:17 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jason Wang , Stefan Hajnoczi , Stefano Garzarella Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jason Wang Spec said: The driver uses this to selectively prevent the device from executing requests from this virtqueue. 1 - enabled; 0 - disabled. Though write 0 to queue_enable is forbidden by the spec, we should not assume that the value is 1. Fix this by ignore the write value other than 1. Signed-off-by: Jason Wang Message-Id: <20200610054351.15811-1-jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Stefano Garzarella Reviewed-by: Stefan Hajnoczi Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-pci.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index d028c17c24..7bc8c1c056 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1273,16 +1273,20 @@ static void virtio_pci_common_write(void *opaque, h= waddr addr, virtio_queue_set_vector(vdev, vdev->queue_sel, val); break; case VIRTIO_PCI_COMMON_Q_ENABLE: - virtio_queue_set_num(vdev, vdev->queue_sel, - proxy->vqs[vdev->queue_sel].num); - virtio_queue_set_rings(vdev, vdev->queue_sel, + if (val =3D=3D 1) { + virtio_queue_set_num(vdev, vdev->queue_sel, + proxy->vqs[vdev->queue_sel].num); + virtio_queue_set_rings(vdev, vdev->queue_sel, ((uint64_t)proxy->vqs[vdev->queue_sel].desc[1]) << = 32 | proxy->vqs[vdev->queue_sel].desc[0], ((uint64_t)proxy->vqs[vdev->queue_sel].avail[1]) <<= 32 | proxy->vqs[vdev->queue_sel].avail[0], ((uint64_t)proxy->vqs[vdev->queue_sel].used[1]) << = 32 | proxy->vqs[vdev->queue_sel].used[0]); - proxy->vqs[vdev->queue_sel].enabled =3D 1; + proxy->vqs[vdev->queue_sel].enabled =3D 1; + } else { + virtio_error(vdev, "wrong value for queue_enable %"PRIx64, val= ); + } break; case VIRTIO_PCI_COMMON_Q_DESCLO: proxy->vqs[vdev->queue_sel].desc[0] =3D val; --=20 MST