From patchwork Wed Oct 18 15:53:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1850979 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=KkVtPwkb; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9b4W5C9Yz20Zj for ; Thu, 19 Oct 2023 02:54:03 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8rU-00033J-7H; Wed, 18 Oct 2023 11:53:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8rT-000335-32 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:53:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8rR-0006Ks-Az for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:53:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644408; 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=Aub/+wNbCvirFXr2bctIYe5dvlzn9T6vBOGQpLtPcEM=; b=KkVtPwkbQQvLpdEk1Va0rmkJTFx21T0jfSira//Cl+af7ScJ6svP66tmyO3lGcYeIFjQ/+ 89HOcgqJyiEQ1qzHJDJIONJH6zEtgGzASS+F/ydspb5Xf1r5wMSBgWWIFi7ovc03Ct3wOB yakuZK6cnlj5dhOGGTLMTcyhfMqSbLg= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-689-06Llt9_SPDCXNlBWmLQcpw-1; Wed, 18 Oct 2023 11:53:26 -0400 X-MC-Unique: 06Llt9_SPDCXNlBWmLQcpw-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2c50c873604so49619531fa.1 for ; Wed, 18 Oct 2023 08:53:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644404; x=1698249204; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Aub/+wNbCvirFXr2bctIYe5dvlzn9T6vBOGQpLtPcEM=; b=AxmPvCNx6qRs2Pm0XazhldrdHMwzX4ExqwwhHdTCbFBZ7lAzdSJGDcN0OVnnCnETad jVFzXlk7SnVCcJcZVSeIazcsNzpOeiFDJr0SGPXR7AzPuZO0xfE09efK7FhA0bPOZQ03 eJCvXWNuLIdLslDYq24MIlvN/9oQt0upnbOsab9Fr+caWreVXTcQmtgx88VpXbal+8uR jvkLdYPx73Hq7u/nrxcKYvo6HrSU2RQqTSXdDrpWEoiBHuXooJ2ma/pcYBK6WPUDS9gG 18MHv29m7xjesimDrfIQbpy8ix2BMULlNUM5TmMvUbEyQgacmOBTwJoyPmRYaWpOQmvA f3MA== X-Gm-Message-State: AOJu0YyBgiqPsc1FSrbxUfQ5fZjMiiYegmuRKwypVMBjhMQFbco31LKt JjzT0vaNZePddP/3JqeLHA6xrrxcq2yrOcWJ262bGNb9ejRrdei626Teq1HpplB0Uo8T/Mk4dhe d13G4/Gk3xJ8dwclYbQRfQmTEvgw5G6dsk63JQz8EMIDjFYOgMpyEvsK+i+OtJAUAlIJoJG4= X-Received: by 2002:a2e:9113:0:b0:2c5:2103:604b with SMTP id m19-20020a2e9113000000b002c52103604bmr4151391ljg.2.1697644404404; Wed, 18 Oct 2023 08:53:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGhLBx8nDuCD0KRa6kFmDPiirBytCFwi2rejXZ0npCdYQU6ZeQGaDdq6PKDHCf/unbEFNIfVg== X-Received: by 2002:a2e:9113:0:b0:2c5:2103:604b with SMTP id m19-20020a2e9113000000b002c52103604bmr4151374ljg.2.1697644403980; Wed, 18 Oct 2023 08:53:23 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id n13-20020adffe0d000000b0032d9382e6e0sm2390693wrr.45.2023.10.18.08.53.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:53:23 -0700 (PDT) Date: Wed, 18 Oct 2023 11:53:20 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Hawkins Jiawei , Eugenio =?utf-8?b?UMOpcmV6?= , Jason Wang Subject: [PULL 01/83] vdpa: Use iovec for vhost_vdpa_net_cvq_add() Message-ID: <0e6bff0d43bf04c6e7a16c2775879816ca056b3d.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Hawkins Jiawei Next patches in this series will no longer perform an immediate poll and check of the device's used buffers for each CVQ state load command. Consequently, there will be multiple pending buffers in the shadow VirtQueue, making it a must for every control command to have its own buffer. To achieve this, this patch refactor vhost_vdpa_net_cvq_add() to accept `struct iovec`, which eliminates the coupling of control commands to `s->cvq_cmd_out_buffer` and `s->status`, allowing them to use their own buffer. Signed-off-by: Hawkins Jiawei Acked-by: Eugenio Pérez Message-Id: <8a328f146fb043f34edb75ba6d043d2d6de88f99.1697165821.git.yin31149@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 939c984d5b..618758596a 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -618,22 +618,14 @@ static void vhost_vdpa_net_cvq_stop(NetClientState *nc) vhost_vdpa_net_client_stop(nc); } -static ssize_t vhost_vdpa_net_cvq_add(VhostVDPAState *s, size_t out_len, - size_t in_len) +static ssize_t vhost_vdpa_net_cvq_add(VhostVDPAState *s, + const struct iovec *out_sg, size_t out_num, + const struct iovec *in_sg, size_t in_num) { - /* Buffers for the device */ - const struct iovec out = { - .iov_base = s->cvq_cmd_out_buffer, - .iov_len = out_len, - }; - const struct iovec in = { - .iov_base = s->status, - .iov_len = sizeof(virtio_net_ctrl_ack), - }; VhostShadowVirtqueue *svq = g_ptr_array_index(s->vhost_vdpa.shadow_vqs, 0); int r; - r = vhost_svq_add(svq, &out, 1, &in, 1, NULL); + r = vhost_svq_add(svq, out_sg, out_num, in_sg, in_num, NULL); if (unlikely(r != 0)) { if (unlikely(r == -ENOSPC)) { qemu_log_mask(LOG_GUEST_ERROR, "%s: No space on device queue\n", @@ -659,6 +651,15 @@ static ssize_t vhost_vdpa_net_load_cmd(VhostVDPAState *s, uint8_t class, .cmd = cmd, }; size_t data_size = iov_size(data_sg, data_num); + /* Buffers for the device */ + const struct iovec out = { + .iov_base = s->cvq_cmd_out_buffer, + .iov_len = sizeof(ctrl) + data_size, + }; + const struct iovec in = { + .iov_base = s->status, + .iov_len = sizeof(*s->status), + }; assert(data_size < vhost_vdpa_net_cvq_cmd_page_len() - sizeof(ctrl)); @@ -669,8 +670,7 @@ static ssize_t vhost_vdpa_net_load_cmd(VhostVDPAState *s, uint8_t class, iov_to_buf(data_sg, data_num, 0, s->cvq_cmd_out_buffer + sizeof(ctrl), data_size); - return vhost_vdpa_net_cvq_add(s, data_size + sizeof(ctrl), - sizeof(virtio_net_ctrl_ack)); + return vhost_vdpa_net_cvq_add(s, &out, 1, &in, 1); } static int vhost_vdpa_net_load_mac(VhostVDPAState *s, const VirtIONet *n) @@ -1248,10 +1248,15 @@ static int vhost_vdpa_net_handle_ctrl_avail(VhostShadowVirtqueue *svq, .iov_base = s->cvq_cmd_out_buffer, }; /* in buffer used for device model */ - const struct iovec in = { + const struct iovec model_in = { .iov_base = &status, .iov_len = sizeof(status), }; + /* in buffer used for vdpa device */ + const struct iovec vdpa_in = { + .iov_base = s->status, + .iov_len = sizeof(*s->status), + }; ssize_t dev_written = -EINVAL; out.iov_len = iov_to_buf(elem->out_sg, elem->out_num, 0, @@ -1285,7 +1290,7 @@ static int vhost_vdpa_net_handle_ctrl_avail(VhostShadowVirtqueue *svq, goto out; } } else { - dev_written = vhost_vdpa_net_cvq_add(s, out.iov_len, sizeof(status)); + dev_written = vhost_vdpa_net_cvq_add(s, &out, 1, &vdpa_in, 1); if (unlikely(dev_written < 0)) { goto out; } @@ -1301,7 +1306,7 @@ static int vhost_vdpa_net_handle_ctrl_avail(VhostShadowVirtqueue *svq, } status = VIRTIO_NET_ERR; - virtio_net_handle_ctrl_iov(svq->vdev, &in, 1, &out, 1); + virtio_net_handle_ctrl_iov(svq->vdev, &model_in, 1, &out, 1); if (status != VIRTIO_NET_OK) { error_report("Bad CVQ processing in model"); } From patchwork Wed Oct 18 15:53:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1850990 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=E7IcxMtp; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9b7B3vltz20Pd for ; Thu, 19 Oct 2023 02:56:22 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8rl-0004tE-M4; Wed, 18 Oct 2023 11:53:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8rk-0004gP-5E for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:53:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8ri-0006MM-MW for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:53:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644426; 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=UQlj+8sgMBKeSBER7AOYNOJcGiMheAyQ6KzKwKB4ADc=; b=E7IcxMtpJ0Gcbb/gltCe9KDajMhhI0C9Mj1d7kwBLLYZn8fJAU5lkqHqzxiCGMIgh1VL28 D9s66H4pM4NyEnU234bQz7vp38BX8pZVY1ysGSY+hsic6WkR4Ez/sDFCV+o/wR9sH9RyxY 9+VLH4sAhrI6k5uslqUL9R4uU1UGTYw= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-125-b0EBNYhkPFu2VWBHAjRRYg-1; Wed, 18 Oct 2023 11:53:29 -0400 X-MC-Unique: b0EBNYhkPFu2VWBHAjRRYg-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-327ab41de6cso4523087f8f.2 for ; Wed, 18 Oct 2023 08:53:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644408; x=1698249208; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UQlj+8sgMBKeSBER7AOYNOJcGiMheAyQ6KzKwKB4ADc=; b=HrjMUSQR048lRdhd+zMAqXg/8MEpRleC6Ujyvkm3zuLLr4uIyIlLyrYrmHsb4EZqOL Ign3pJRVl4sFAE+V5IIEwptAk4q3CUjJMcUDQcFiJvbOAMseG2sY6js+/YKcKDGoVcdC CS3L+Xff6z7kUGptmXq9+t1lzcXyj8F0tB8z4Y81RATawA9IogKBrrXTmEhV9GnA5e9Y E/PrPxkZxy17zE49ompYhM2pNKQNLlNCYEoXLowNGBWK7CKmm+BUvthhFYPq9R8A6Yn4 e9gk7D/BKN0G0eug2vuwei/mrn3L7YPSXwoxfoYcSd+UC1LzOstMzXj84JwiAnbCUDYs ldDA== X-Gm-Message-State: AOJu0YyIprRF4Lp5Ln4YwVL7TisAWLGYYcc1RwGuHqEUL6FPV1tbMI4S RGi5DkvoeXdsi+x4KA7d/aOcQar5PJ46uJmN1tel+ZKTaSHSwW+uLMgt/BEQGHD5xI50qi8804b T+ynWpfDH/7DYubeEbMZ2dtiTKent6BOPww+ODF4MlD66zICggBfWQqFf+2p/qnVzHX4zmlw= X-Received: by 2002:a5d:5a15:0:b0:321:68fa:70aa with SMTP id bq21-20020a5d5a15000000b0032168fa70aamr6619543wrb.9.1697644408206; Wed, 18 Oct 2023 08:53:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGrlfzl4i2mZoZ96OqdcRidjlVa2MZ0vWiUTAs5cftsEaa56VjMvpfvvNMcJx7nAOZNb08imQ== X-Received: by 2002:a5d:5a15:0:b0:321:68fa:70aa with SMTP id bq21-20020a5d5a15000000b0032168fa70aamr6619528wrb.9.1697644407822; Wed, 18 Oct 2023 08:53:27 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id e6-20020adfe386000000b0032d96dd703bsm2391464wrm.70.2023.10.18.08.53.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:53:27 -0700 (PDT) Date: Wed, 18 Oct 2023 11:53:24 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Hawkins Jiawei , Eugenio =?utf-8?b?UMOpcmV6?= , Jason Wang Subject: [PULL 02/83] vdpa: Avoid using vhost_vdpa_net_load_*() outside vhost_vdpa_net_load() Message-ID: <327dedb8df91f57ef917ab5b5db519146ee6f08b.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Hawkins Jiawei Next patches in this series will refactor vhost_vdpa_net_load_cmd() to iterate through the control commands shadow buffers, allowing QEMU to send CVQ state load commands in parallel at device startup. Considering that QEMU always forwards the CVQ command serialized outside of vhost_vdpa_net_load(), it is more elegant to send the CVQ commands directly without invoking vhost_vdpa_net_load_*() helpers. Signed-off-by: Hawkins Jiawei Acked-by: Eugenio Pérez Message-Id: <254f0618efde7af7229ba4fdada667bb9d318991.1697165821.git.yin31149@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 618758596a..86b8d31244 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -1114,12 +1114,14 @@ static NetClientInfo net_vhost_vdpa_cvq_info = { */ static int vhost_vdpa_net_excessive_mac_filter_cvq_add(VhostVDPAState *s, VirtQueueElement *elem, - struct iovec *out) + struct iovec *out, + const struct iovec *in) { struct virtio_net_ctrl_mac mac_data, *mac_ptr; struct virtio_net_ctrl_hdr *hdr_ptr; uint32_t cursor; ssize_t r; + uint8_t on = 1; /* parse the non-multicast MAC address entries from CVQ command */ cursor = sizeof(*hdr_ptr); @@ -1167,7 +1169,13 @@ static int vhost_vdpa_net_excessive_mac_filter_cvq_add(VhostVDPAState *s, * filter table to the vdpa device, it should send the * VIRTIO_NET_CTRL_RX_PROMISC CVQ command to enable promiscuous mode */ - r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_PROMISC, 1); + hdr_ptr = out->iov_base; + out->iov_len = sizeof(*hdr_ptr) + sizeof(on); + + hdr_ptr->class = VIRTIO_NET_CTRL_RX; + hdr_ptr->cmd = VIRTIO_NET_CTRL_RX_PROMISC; + iov_from_buf(out, 1, sizeof(*hdr_ptr), &on, sizeof(on)); + r = vhost_vdpa_net_cvq_add(s, out, 1, in, 1); if (unlikely(r < 0)) { return r; } @@ -1285,7 +1293,7 @@ static int vhost_vdpa_net_handle_ctrl_avail(VhostShadowVirtqueue *svq, * the CVQ command directly. */ dev_written = vhost_vdpa_net_excessive_mac_filter_cvq_add(s, elem, - &out); + &out, &vdpa_in); if (unlikely(dev_written < 0)) { goto out; } From patchwork Wed Oct 18 15:53:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1850994 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=eEFZcDUI; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9b8j42Czz20Pd for ; Thu, 19 Oct 2023 02:57:41 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8ra-0003Zy-Rz; Wed, 18 Oct 2023 11:53:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8rZ-0003RX-LS for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:53:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8rX-0006LF-M7 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:53:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644414; 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=6rjIIhgIzngiZUO1BhT0Rp7HmlO6psOtfNInxxNDXLU=; b=eEFZcDUIFIHRZGkZZBPS5sFDM53Hd/P/UcGCS33bVGcPWPsmWLh3Pqygi0RLXNxwukuOCc 8e6B3Y6prqzb5sGaZez/8jU2l/uInkVUGkPNwM47ZFAInr6QAdkSEobqPH3V7MLM4QRI8Q xJBaX44WM3SjW6bE6Zc+HKzvXz1RYtM= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-538-XgkZ2kQ5NfedsBdyyIWixg-1; Wed, 18 Oct 2023 11:53:33 -0400 X-MC-Unique: XgkZ2kQ5NfedsBdyyIWixg-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-32da8de4833so2418210f8f.3 for ; Wed, 18 Oct 2023 08:53:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644411; x=1698249211; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6rjIIhgIzngiZUO1BhT0Rp7HmlO6psOtfNInxxNDXLU=; b=doksGyzig3XWk2C3jBqQ8Jhf9bdN05fuKbQ/UcL4GWxfasMmpMcll8MmYJfxIfKFeB K4HoVI4n7QCC85y9P28/v1TEJS8EHByCuhHN1dHqPCVC9/eYLiyX3Ph4FPKxixd/CFwO 2ORB78lIDTIx4UcYYDnsvT+rMqswE/Q7j6f1nn4WfmOmJyaGQ+jmktijzToghvvsHPiS 7Eb43mN7iDhVuDpOD7Jng4FulkNrDtADspUmLQxkSrle+2pcYrypenzJssrR5biA/9Aq 7ci7SQDkFjS3LI4UZT/VI5rneiP4LIDBj5ADP+KOl0uWcAE1YMjb0JPNQiA4MVgHGvo9 5SBA== X-Gm-Message-State: AOJu0Yyr+ScUdW791Y0wVh8GdL6hzc09TFLl6Dd0vG/X7g4+5OXGCzdc bDzFjeG86qryR4VjyEiEAT0j5qiLw/fYLT6Sx1aEIukcaMZ3o6Yx8ZyDMrR2k1RUsnDXxRacKE8 WX1OhT5IPYe3DIzdOs7GtN2P6qwdNV22ej1kmKjGj6h3U2mqRTPzBn07e5QW2sJrq6eBP+hc= X-Received: by 2002:a5d:6087:0:b0:323:306e:65cf with SMTP id w7-20020a5d6087000000b00323306e65cfmr4622349wrt.10.1697644411614; Wed, 18 Oct 2023 08:53:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGi4otNAw/xIqzs63sknX1uTSBu7b1L5gjjJ1+/FcQnseWgPmtfhWwaSgxeubrXIfcWr91dlw== X-Received: by 2002:a5d:6087:0:b0:323:306e:65cf with SMTP id w7-20020a5d6087000000b00323306e65cfmr4622332wrt.10.1697644411261; Wed, 18 Oct 2023 08:53:31 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id j14-20020adfea4e000000b0032d81837433sm2444980wrn.30.2023.10.18.08.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:53:30 -0700 (PDT) Date: Wed, 18 Oct 2023 11:53:28 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Hawkins Jiawei , Eugenio =?utf-8?b?UMOpcmV6?= , Jason Wang Subject: [PULL 03/83] vdpa: Check device ack in vhost_vdpa_net_load_rx_mode() Message-ID: <24e59cfe0cb53416b06c2c117bc22ff22dc54df3.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Hawkins Jiawei Considering that vhost_vdpa_net_load_rx_mode() is only called within vhost_vdpa_net_load_rx() now, this patch refactors vhost_vdpa_net_load_rx_mode() to include a check for the device's ack, simplifying the code and improving its maintainability. Signed-off-by: Hawkins Jiawei Acked-by: Eugenio Pérez Message-Id: <68811d52f96ae12d68f0d67d996ac1642a623943.1697165821.git.yin31149@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 76 ++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 45 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 86b8d31244..36a4e57c0d 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -827,14 +827,24 @@ static int vhost_vdpa_net_load_rx_mode(VhostVDPAState *s, .iov_base = &on, .iov_len = sizeof(on), }; - return vhost_vdpa_net_load_cmd(s, VIRTIO_NET_CTRL_RX, - cmd, &data, 1); + ssize_t dev_written; + + dev_written = vhost_vdpa_net_load_cmd(s, VIRTIO_NET_CTRL_RX, + cmd, &data, 1); + if (unlikely(dev_written < 0)) { + return dev_written; + } + if (*s->status != VIRTIO_NET_OK) { + return -EIO; + } + + return 0; } static int vhost_vdpa_net_load_rx(VhostVDPAState *s, const VirtIONet *n) { - ssize_t dev_written; + ssize_t r; if (!virtio_vdev_has_feature(&n->parent_obj, VIRTIO_NET_F_CTRL_RX)) { return 0; @@ -859,13 +869,9 @@ static int vhost_vdpa_net_load_rx(VhostVDPAState *s, * configuration only at live migration. */ if (!n->mac_table.uni_overflow && !n->promisc) { - dev_written = vhost_vdpa_net_load_rx_mode(s, - VIRTIO_NET_CTRL_RX_PROMISC, 0); - if (unlikely(dev_written < 0)) { - return dev_written; - } - if (*s->status != VIRTIO_NET_OK) { - return -EIO; + r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_PROMISC, 0); + if (unlikely(r < 0)) { + return r; } } @@ -887,13 +893,9 @@ static int vhost_vdpa_net_load_rx(VhostVDPAState *s, * configuration only at live migration. */ if (n->mac_table.multi_overflow || n->allmulti) { - dev_written = vhost_vdpa_net_load_rx_mode(s, - VIRTIO_NET_CTRL_RX_ALLMULTI, 1); - if (unlikely(dev_written < 0)) { - return dev_written; - } - if (*s->status != VIRTIO_NET_OK) { - return -EIO; + r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_ALLMULTI, 1); + if (unlikely(r < 0)) { + return r; } } @@ -912,13 +914,9 @@ static int vhost_vdpa_net_load_rx(VhostVDPAState *s, * configuration only at live migration. */ if (n->alluni) { - dev_written = vhost_vdpa_net_load_rx_mode(s, - VIRTIO_NET_CTRL_RX_ALLUNI, 1); - if (dev_written < 0) { - return dev_written; - } - if (*s->status != VIRTIO_NET_OK) { - return -EIO; + r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_ALLUNI, 1); + if (r < 0) { + return r; } } @@ -933,13 +931,9 @@ static int vhost_vdpa_net_load_rx(VhostVDPAState *s, * configuration only at live migration. */ if (n->nomulti) { - dev_written = vhost_vdpa_net_load_rx_mode(s, - VIRTIO_NET_CTRL_RX_NOMULTI, 1); - if (dev_written < 0) { - return dev_written; - } - if (*s->status != VIRTIO_NET_OK) { - return -EIO; + r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_NOMULTI, 1); + if (r < 0) { + return r; } } @@ -954,13 +948,9 @@ static int vhost_vdpa_net_load_rx(VhostVDPAState *s, * configuration only at live migration. */ if (n->nouni) { - dev_written = vhost_vdpa_net_load_rx_mode(s, - VIRTIO_NET_CTRL_RX_NOUNI, 1); - if (dev_written < 0) { - return dev_written; - } - if (*s->status != VIRTIO_NET_OK) { - return -EIO; + r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_NOUNI, 1); + if (r < 0) { + return r; } } @@ -975,13 +965,9 @@ static int vhost_vdpa_net_load_rx(VhostVDPAState *s, * configuration only at live migration. */ if (n->nobcast) { - dev_written = vhost_vdpa_net_load_rx_mode(s, - VIRTIO_NET_CTRL_RX_NOBCAST, 1); - if (dev_written < 0) { - return dev_written; - } - if (*s->status != VIRTIO_NET_OK) { - return -EIO; + r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_NOBCAST, 1); + if (r < 0) { + return r; } } From patchwork Wed Oct 18 15:53:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1850978 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=QKAMKF+J; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9b4S20mBz20Zj for ; Thu, 19 Oct 2023 02:54:00 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8rd-00043J-Sv; Wed, 18 Oct 2023 11:53:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8rc-0003rk-D7 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:53:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8ra-0006Li-Pm for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:53:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644418; 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=gQj1+sM1CuS1GDO6GpoEJ5VkqRYFFR3ZZ4DVN4jzDRw=; b=QKAMKF+Jh2bBMI+hECQg8sJ985n70Bat8xAGhfLqy9wFAOnaDValgQYtcFleyswdFEN0cg 19iXfWtmi8pN9NIkwDG355TeP8LImlXErx85PTWhhDlDaKyBw/QPE7fNjIuoFw+Bvn9DeA ydaslpVVErvtFq/G5AgZLgGbWJhsiAE= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-634-MLO-0B9IMpWsZH1eJl_wWg-1; Wed, 18 Oct 2023 11:53:37 -0400 X-MC-Unique: MLO-0B9IMpWsZH1eJl_wWg-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-402cd372b8bso54049055e9.2 for ; Wed, 18 Oct 2023 08:53:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644415; x=1698249215; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=gQj1+sM1CuS1GDO6GpoEJ5VkqRYFFR3ZZ4DVN4jzDRw=; b=f42vT/mOyiYrO1Y8SS+6bpO8iCbVRoPxNJBrsJGtVInakSuc4nmer8QCvvYLOZ3rEP tVyCEEhRoX5IVFgxzAZKObgSOJNOKsQi7yby2E5Md31T97UF47+2bTF9SjPRRlZENzUU aC4YHvLcUtH+wCt6cG0o1ME+9iXZdj7dy6T2/lxqBU8P7uCc6mLjEck6k1hpFYhucpNX wwXD6sO2y5ChvxwsCTYnIa2+UCgplQBxT3Taw840DzMjJavyNGUzNfP+ku1rER1BpTyE wIZeUAoOht2mpFYSnlQ5Do9gFa8CCFLybDJ52H1QMUZ3P61aOUxhtoOw6oos3WT295dG 1nng== X-Gm-Message-State: AOJu0Yxz9SXrEG2KP3Jx11o3hM32XRfRXLLYAt+dDPqyQLPSdfX+GShg ldLeJV7/kqYJz43WZHW29V8XsPKTBnJUpZE4cnlx753/d2LQwzPx4F/p1uA0ZvIHsUWbx90pI+4 OSGvmjY5uMtSdlCqJgLvynAK5qhvVJ5yS9wGaCF/OnIUBbSKEzgjRJbLIVtx9YetNGLhtfeE= X-Received: by 2002:adf:ffc3:0:b0:32d:8a32:3b2f with SMTP id x3-20020adfffc3000000b0032d8a323b2fmr4902901wrs.16.1697644415271; Wed, 18 Oct 2023 08:53:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF3yd5cut43jpcvk7Gqt5SQcFwTYj0ID/PDTEsHA5lK46IEeZnspWVLMN6vC9VmvZisNUeIxw== X-Received: by 2002:adf:ffc3:0:b0:32d:8a32:3b2f with SMTP id x3-20020adfffc3000000b0032d8a323b2fmr4902885wrs.16.1697644414899; Wed, 18 Oct 2023 08:53:34 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id y10-20020a5d614a000000b0032d402f816csm2364093wrt.98.2023.10.18.08.53.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:53:34 -0700 (PDT) Date: Wed, 18 Oct 2023 11:53:31 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Hawkins Jiawei , Jason Wang Subject: [PULL 04/83] vdpa: Move vhost_svq_poll() to the caller of vhost_vdpa_net_cvq_add() Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Hawkins Jiawei This patch moves vhost_svq_poll() to the caller of vhost_vdpa_net_cvq_add() and introduces a helper funtion. By making this change, next patches in this series is able to refactor vhost_vdpa_net_load_x() only to delay the polling and checking process until either the SVQ is full or control commands shadow buffers are full. Signed-off-by: Hawkins Jiawei Message-Id: <196cadb55175a75275660c6634a538289f027ae3.1697165821.git.yin31149@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 53 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 36a4e57c0d..ea73e3c410 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -631,15 +631,21 @@ static ssize_t vhost_vdpa_net_cvq_add(VhostVDPAState *s, qemu_log_mask(LOG_GUEST_ERROR, "%s: No space on device queue\n", __func__); } - return r; } - /* - * We can poll here since we've had BQL from the time we sent the - * descriptor. Also, we need to take the answer before SVQ pulls by itself, - * when BQL is released - */ - return vhost_svq_poll(svq, 1); + return r; +} + +/* + * Convenience wrapper to poll SVQ for multiple control commands. + * + * Caller should hold the BQL when invoking this function, and should take + * the answer before SVQ pulls by itself when BQL is released. + */ +static ssize_t vhost_vdpa_net_svq_poll(VhostVDPAState *s, size_t cmds_in_flight) +{ + VhostShadowVirtqueue *svq = g_ptr_array_index(s->vhost_vdpa.shadow_vqs, 0); + return vhost_svq_poll(svq, cmds_in_flight); } static ssize_t vhost_vdpa_net_load_cmd(VhostVDPAState *s, uint8_t class, @@ -660,6 +666,7 @@ static ssize_t vhost_vdpa_net_load_cmd(VhostVDPAState *s, uint8_t class, .iov_base = s->status, .iov_len = sizeof(*s->status), }; + ssize_t r; assert(data_size < vhost_vdpa_net_cvq_cmd_page_len() - sizeof(ctrl)); @@ -670,7 +677,16 @@ static ssize_t vhost_vdpa_net_load_cmd(VhostVDPAState *s, uint8_t class, iov_to_buf(data_sg, data_num, 0, s->cvq_cmd_out_buffer + sizeof(ctrl), data_size); - return vhost_vdpa_net_cvq_add(s, &out, 1, &in, 1); + r = vhost_vdpa_net_cvq_add(s, &out, 1, &in, 1); + if (unlikely(r < 0)) { + return r; + } + + /* + * We can poll here since we've had BQL from the time + * we sent the descriptor. + */ + return vhost_vdpa_net_svq_poll(s, 1); } static int vhost_vdpa_net_load_mac(VhostVDPAState *s, const VirtIONet *n) @@ -1165,6 +1181,15 @@ static int vhost_vdpa_net_excessive_mac_filter_cvq_add(VhostVDPAState *s, if (unlikely(r < 0)) { return r; } + + /* + * We can poll here since we've had BQL from the time + * we sent the descriptor. + */ + r = vhost_vdpa_net_svq_poll(s, 1); + if (unlikely(r < sizeof(*s->status))) { + return r; + } if (*s->status != VIRTIO_NET_OK) { return sizeof(*s->status); } @@ -1284,10 +1309,18 @@ static int vhost_vdpa_net_handle_ctrl_avail(VhostShadowVirtqueue *svq, goto out; } } else { - dev_written = vhost_vdpa_net_cvq_add(s, &out, 1, &vdpa_in, 1); - if (unlikely(dev_written < 0)) { + ssize_t r; + r = vhost_vdpa_net_cvq_add(s, &out, 1, &vdpa_in, 1); + if (unlikely(r < 0)) { + dev_written = r; goto out; } + + /* + * We can poll here since we've had BQL from the time + * we sent the descriptor. + */ + dev_written = vhost_vdpa_net_svq_poll(s, 1); } if (unlikely(dev_written < sizeof(status))) { From patchwork Wed Oct 18 15:53:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1850985 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=P4C+u0wM; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9b535RJKz20Zj for ; Thu, 19 Oct 2023 02:54:31 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8ri-0004Ue-KJ; Wed, 18 Oct 2023 11:53:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8rh-0004Lt-7s for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:53:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8rf-0006M8-6S for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:53:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644422; 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=Y7BTRbAv0zAui1dpeWzjUtaiUFjyDwO0B9v/G8QAxzQ=; b=P4C+u0wMjEVCjbna/F0yMu1TjCEY9P1bP5v3Eh1YN8yfftj98X2mG1Ud2a60/FaijuLti7 EYO821i6DPLtW8KH08Ww7nx2MoaBdEZOfrcsj8mnkKrWaN/lj5elg0+z2oSHWZtFzDoJqS uheRS9aDY3s0tCoeePhRe9wkr+wx2+Y= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-30-WEZ13DTqMa2Ezk2B8TM4PQ-1; Wed, 18 Oct 2023 11:53:41 -0400 X-MC-Unique: WEZ13DTqMa2Ezk2B8TM4PQ-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3fe1521678fso49831625e9.1 for ; Wed, 18 Oct 2023 08:53:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644419; x=1698249219; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Y7BTRbAv0zAui1dpeWzjUtaiUFjyDwO0B9v/G8QAxzQ=; b=VBh36Gvxvgr441XSPI2cwTFPshPhrBYa0mwzaFN7EUZIamlbBNPqxXFGh9iY9XTvG6 A8A0gqtCX3LI6K6SPsUA7aY8sh+aNPKI9qd0fyZQb7MJ2uAspvGqudOz9oshEXjStZ0Q KKfWrSiG6Pw7oYPYcunajhIkBZHybVVYc2wuID031c8trV2IsemBUyKlte4DzxPScR6n YeejPxfXFrZu8HPNizIvDSbhATOR/7x4bkmweC0MWn/QTEEy8blqczF50qpa2/vZvbX8 sPeWpVT6qFYBYOp5oM8nJ4iStqw/M39x0yxEvcMXrBOhC60lAYmxP19CHESK+n4UzObm mkaw== X-Gm-Message-State: AOJu0YxYdc22EPwjqMUIg/FmsQbRbzdjUkKLd6wrB6FQdUe/pMEClyuh A1tcbG3dtIzg8eyhrGWAC186RU7TC0DM1KKbb3A4JkDGcTBY1eFQgq2TXlgXfi6SRY17qzi4q6B FWITFVWYjPLscvzI0W6U+88X4+oYXbWH9fNg5kLRBQihP4jS+NXmNPAGWFLM2Z4K7sDGvYpQ= X-Received: by 2002:a05:600c:3b98:b0:408:2686:e1ba with SMTP id n24-20020a05600c3b9800b004082686e1bamr3515612wms.20.1697644419337; Wed, 18 Oct 2023 08:53:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFrPqSB0BtRD3mF0GJuhX8hxNYxNSOmAqtion2u84U4EYphRPv2pYs55tpI2IopGSthAKGYUA== X-Received: by 2002:a05:600c:3b98:b0:408:2686:e1ba with SMTP id n24-20020a05600c3b9800b004082686e1bamr3515596wms.20.1697644418740; Wed, 18 Oct 2023 08:53:38 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id x19-20020a05600c421300b003fc16ee2864sm1958115wmh.48.2023.10.18.08.53.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:53:38 -0700 (PDT) Date: Wed, 18 Oct 2023 11:53:35 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Hawkins Jiawei , Jason Wang Subject: [PULL 05/83] vdpa: Introduce cursors to vhost_vdpa_net_loadx() Message-ID: <1d7e2a8fd4996fdb20d74fce41fe897311f3b06a.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Hawkins Jiawei This patch introduces two new arugments, `out_cursor` and `in_cursor`, to vhost_vdpa_net_loadx(). Addtionally, it includes a helper function vhost_vdpa_net_load_cursor_reset() for resetting these cursors. Furthermore, this patch refactors vhost_vdpa_net_load_cmd() so that vhost_vdpa_net_load_cmd() prepares buffers for the device using the cursors arguments, instead of directly accesses `s->cvq_cmd_out_buffer` and `s->status` fields. By making these change, next patches in this series can refactor vhost_vdpa_net_load_cmd() directly to iterate through the control commands shadow buffers, allowing QEMU to send CVQ state load commands in parallel at device startup. Signed-off-by: Hawkins Jiawei Message-Id: <1c6516e233a14cc222f0884e148e4e1adceda78d.1697165821.git.yin31149@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 111 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 75 insertions(+), 36 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index ea73e3c410..ef4d242811 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -648,7 +648,22 @@ static ssize_t vhost_vdpa_net_svq_poll(VhostVDPAState *s, size_t cmds_in_flight) return vhost_svq_poll(svq, cmds_in_flight); } -static ssize_t vhost_vdpa_net_load_cmd(VhostVDPAState *s, uint8_t class, +static void vhost_vdpa_net_load_cursor_reset(VhostVDPAState *s, + struct iovec *out_cursor, + struct iovec *in_cursor) +{ + /* reset the cursor of the output buffer for the device */ + out_cursor->iov_base = s->cvq_cmd_out_buffer; + out_cursor->iov_len = vhost_vdpa_net_cvq_cmd_page_len(); + + /* reset the cursor of the in buffer for the device */ + in_cursor->iov_base = s->status; + in_cursor->iov_len = vhost_vdpa_net_cvq_cmd_page_len(); +} + +static ssize_t vhost_vdpa_net_load_cmd(VhostVDPAState *s, + struct iovec *out_cursor, + struct iovec *in_cursor, uint8_t class, uint8_t cmd, const struct iovec *data_sg, size_t data_num) { @@ -657,25 +672,21 @@ static ssize_t vhost_vdpa_net_load_cmd(VhostVDPAState *s, uint8_t class, .cmd = cmd, }; size_t data_size = iov_size(data_sg, data_num); - /* Buffers for the device */ - const struct iovec out = { - .iov_base = s->cvq_cmd_out_buffer, - .iov_len = sizeof(ctrl) + data_size, - }; - const struct iovec in = { - .iov_base = s->status, - .iov_len = sizeof(*s->status), - }; + struct iovec out, in; ssize_t r; assert(data_size < vhost_vdpa_net_cvq_cmd_page_len() - sizeof(ctrl)); /* pack the CVQ command header */ - memcpy(s->cvq_cmd_out_buffer, &ctrl, sizeof(ctrl)); - + iov_from_buf(out_cursor, 1, 0, &ctrl, sizeof(ctrl)); /* pack the CVQ command command-specific-data */ iov_to_buf(data_sg, data_num, 0, - s->cvq_cmd_out_buffer + sizeof(ctrl), data_size); + out_cursor->iov_base + sizeof(ctrl), data_size); + + /* extract the required buffer from the cursor for output */ + iov_copy(&out, 1, out_cursor, 1, 0, sizeof(ctrl) + data_size); + /* extract the required buffer from the cursor for input */ + iov_copy(&in, 1, in_cursor, 1, 0, sizeof(*s->status)); r = vhost_vdpa_net_cvq_add(s, &out, 1, &in, 1); if (unlikely(r < 0)) { @@ -689,14 +700,17 @@ static ssize_t vhost_vdpa_net_load_cmd(VhostVDPAState *s, uint8_t class, return vhost_vdpa_net_svq_poll(s, 1); } -static int vhost_vdpa_net_load_mac(VhostVDPAState *s, const VirtIONet *n) +static int vhost_vdpa_net_load_mac(VhostVDPAState *s, const VirtIONet *n, + struct iovec *out_cursor, + struct iovec *in_cursor) { if (virtio_vdev_has_feature(&n->parent_obj, VIRTIO_NET_F_CTRL_MAC_ADDR)) { const struct iovec data = { .iov_base = (void *)n->mac, .iov_len = sizeof(n->mac), }; - ssize_t dev_written = vhost_vdpa_net_load_cmd(s, VIRTIO_NET_CTRL_MAC, + ssize_t dev_written = vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor, + VIRTIO_NET_CTRL_MAC, VIRTIO_NET_CTRL_MAC_ADDR_SET, &data, 1); if (unlikely(dev_written < 0)) { @@ -748,7 +762,7 @@ static int vhost_vdpa_net_load_mac(VhostVDPAState *s, const VirtIONet *n) .iov_len = mul_macs_size, }, }; - ssize_t dev_written = vhost_vdpa_net_load_cmd(s, + ssize_t dev_written = vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor, VIRTIO_NET_CTRL_MAC, VIRTIO_NET_CTRL_MAC_TABLE_SET, data, ARRAY_SIZE(data)); @@ -763,7 +777,9 @@ static int vhost_vdpa_net_load_mac(VhostVDPAState *s, const VirtIONet *n) } static int vhost_vdpa_net_load_mq(VhostVDPAState *s, - const VirtIONet *n) + const VirtIONet *n, + struct iovec *out_cursor, + struct iovec *in_cursor) { struct virtio_net_ctrl_mq mq; ssize_t dev_written; @@ -777,7 +793,8 @@ static int vhost_vdpa_net_load_mq(VhostVDPAState *s, .iov_base = &mq, .iov_len = sizeof(mq), }; - dev_written = vhost_vdpa_net_load_cmd(s, VIRTIO_NET_CTRL_MQ, + dev_written = vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor, + VIRTIO_NET_CTRL_MQ, VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET, &data, 1); if (unlikely(dev_written < 0)) { @@ -791,7 +808,9 @@ static int vhost_vdpa_net_load_mq(VhostVDPAState *s, } static int vhost_vdpa_net_load_offloads(VhostVDPAState *s, - const VirtIONet *n) + const VirtIONet *n, + struct iovec *out_cursor, + struct iovec *in_cursor) { uint64_t offloads; ssize_t dev_written; @@ -822,7 +841,8 @@ static int vhost_vdpa_net_load_offloads(VhostVDPAState *s, .iov_base = &offloads, .iov_len = sizeof(offloads), }; - dev_written = vhost_vdpa_net_load_cmd(s, VIRTIO_NET_CTRL_GUEST_OFFLOADS, + dev_written = vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor, + VIRTIO_NET_CTRL_GUEST_OFFLOADS, VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET, &data, 1); if (unlikely(dev_written < 0)) { @@ -836,6 +856,8 @@ static int vhost_vdpa_net_load_offloads(VhostVDPAState *s, } static int vhost_vdpa_net_load_rx_mode(VhostVDPAState *s, + struct iovec *out_cursor, + struct iovec *in_cursor, uint8_t cmd, uint8_t on) { @@ -845,7 +867,8 @@ static int vhost_vdpa_net_load_rx_mode(VhostVDPAState *s, }; ssize_t dev_written; - dev_written = vhost_vdpa_net_load_cmd(s, VIRTIO_NET_CTRL_RX, + dev_written = vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor, + VIRTIO_NET_CTRL_RX, cmd, &data, 1); if (unlikely(dev_written < 0)) { return dev_written; @@ -858,7 +881,9 @@ static int vhost_vdpa_net_load_rx_mode(VhostVDPAState *s, } static int vhost_vdpa_net_load_rx(VhostVDPAState *s, - const VirtIONet *n) + const VirtIONet *n, + struct iovec *out_cursor, + struct iovec *in_cursor) { ssize_t r; @@ -885,7 +910,8 @@ static int vhost_vdpa_net_load_rx(VhostVDPAState *s, * configuration only at live migration. */ if (!n->mac_table.uni_overflow && !n->promisc) { - r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_PROMISC, 0); + r = vhost_vdpa_net_load_rx_mode(s, out_cursor, in_cursor, + VIRTIO_NET_CTRL_RX_PROMISC, 0); if (unlikely(r < 0)) { return r; } @@ -909,7 +935,8 @@ static int vhost_vdpa_net_load_rx(VhostVDPAState *s, * configuration only at live migration. */ if (n->mac_table.multi_overflow || n->allmulti) { - r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_ALLMULTI, 1); + r = vhost_vdpa_net_load_rx_mode(s, out_cursor, in_cursor, + VIRTIO_NET_CTRL_RX_ALLMULTI, 1); if (unlikely(r < 0)) { return r; } @@ -930,7 +957,8 @@ static int vhost_vdpa_net_load_rx(VhostVDPAState *s, * configuration only at live migration. */ if (n->alluni) { - r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_ALLUNI, 1); + r = vhost_vdpa_net_load_rx_mode(s, out_cursor, in_cursor, + VIRTIO_NET_CTRL_RX_ALLUNI, 1); if (r < 0) { return r; } @@ -947,7 +975,8 @@ static int vhost_vdpa_net_load_rx(VhostVDPAState *s, * configuration only at live migration. */ if (n->nomulti) { - r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_NOMULTI, 1); + r = vhost_vdpa_net_load_rx_mode(s, out_cursor, in_cursor, + VIRTIO_NET_CTRL_RX_NOMULTI, 1); if (r < 0) { return r; } @@ -964,7 +993,8 @@ static int vhost_vdpa_net_load_rx(VhostVDPAState *s, * configuration only at live migration. */ if (n->nouni) { - r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_NOUNI, 1); + r = vhost_vdpa_net_load_rx_mode(s, out_cursor, in_cursor, + VIRTIO_NET_CTRL_RX_NOUNI, 1); if (r < 0) { return r; } @@ -981,7 +1011,8 @@ static int vhost_vdpa_net_load_rx(VhostVDPAState *s, * configuration only at live migration. */ if (n->nobcast) { - r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_NOBCAST, 1); + r = vhost_vdpa_net_load_rx_mode(s, out_cursor, in_cursor, + VIRTIO_NET_CTRL_RX_NOBCAST, 1); if (r < 0) { return r; } @@ -992,13 +1023,16 @@ static int vhost_vdpa_net_load_rx(VhostVDPAState *s, static int vhost_vdpa_net_load_single_vlan(VhostVDPAState *s, const VirtIONet *n, + struct iovec *out_cursor, + struct iovec *in_cursor, uint16_t vid) { const struct iovec data = { .iov_base = &vid, .iov_len = sizeof(vid), }; - ssize_t dev_written = vhost_vdpa_net_load_cmd(s, VIRTIO_NET_CTRL_VLAN, + ssize_t dev_written = vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor, + VIRTIO_NET_CTRL_VLAN, VIRTIO_NET_CTRL_VLAN_ADD, &data, 1); if (unlikely(dev_written < 0)) { @@ -1012,7 +1046,9 @@ static int vhost_vdpa_net_load_single_vlan(VhostVDPAState *s, } static int vhost_vdpa_net_load_vlan(VhostVDPAState *s, - const VirtIONet *n) + const VirtIONet *n, + struct iovec *out_cursor, + struct iovec *in_cursor) { int r; @@ -1023,7 +1059,8 @@ static int vhost_vdpa_net_load_vlan(VhostVDPAState *s, for (int i = 0; i < MAX_VLAN >> 5; i++) { for (int j = 0; n->vlans[i] && j <= 0x1f; j++) { if (n->vlans[i] & (1U << j)) { - r = vhost_vdpa_net_load_single_vlan(s, n, (i << 5) + j); + r = vhost_vdpa_net_load_single_vlan(s, n, out_cursor, + in_cursor, (i << 5) + j); if (unlikely(r != 0)) { return r; } @@ -1040,6 +1077,7 @@ static int vhost_vdpa_net_cvq_load(NetClientState *nc) struct vhost_vdpa *v = &s->vhost_vdpa; const VirtIONet *n; int r; + struct iovec out_cursor, in_cursor; assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_VDPA); @@ -1047,23 +1085,24 @@ static int vhost_vdpa_net_cvq_load(NetClientState *nc) if (v->shadow_vqs_enabled) { n = VIRTIO_NET(v->dev->vdev); - r = vhost_vdpa_net_load_mac(s, n); + vhost_vdpa_net_load_cursor_reset(s, &out_cursor, &in_cursor); + r = vhost_vdpa_net_load_mac(s, n, &out_cursor, &in_cursor); if (unlikely(r < 0)) { return r; } - r = vhost_vdpa_net_load_mq(s, n); + r = vhost_vdpa_net_load_mq(s, n, &out_cursor, &in_cursor); if (unlikely(r)) { return r; } - r = vhost_vdpa_net_load_offloads(s, n); + r = vhost_vdpa_net_load_offloads(s, n, &out_cursor, &in_cursor); if (unlikely(r)) { return r; } - r = vhost_vdpa_net_load_rx(s, n); + r = vhost_vdpa_net_load_rx(s, n, &out_cursor, &in_cursor); if (unlikely(r)) { return r; } - r = vhost_vdpa_net_load_vlan(s, n); + r = vhost_vdpa_net_load_vlan(s, n, &out_cursor, &in_cursor); if (unlikely(r)) { return r; } From patchwork Wed Oct 18 15:53:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1850981 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=R4JhmTo0; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9b4q0sK8z20Zj for ; Thu, 19 Oct 2023 02:54:19 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8rp-0004vo-FH; Wed, 18 Oct 2023 11:53:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8ro-0004vO-BL for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:53:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8rm-0006Mp-TB for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:53:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644429; 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=thscQjX5d6rsLU3psVlcnXGZdg35cG2DFqaiwAr/Wqo=; b=R4JhmTo0zSgL9+j/en6NCjQYAdLPKExfcBU4g34X53605SFIx6Oq7/VJ4rih/cVUq6NQN+ 9kfd6LamXNEVqPJ8UZB7kiV/h/FeCuUBe7tMmN31JHI1LZajRPxB2dKmX63bHlUFQN2czy DSFwUhY2MGWFT554Yj+Wz6Rs6TtMGPQ= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-184-1GULOs7vP-mcXnBW2rj2Eg-1; Wed, 18 Oct 2023 11:53:45 -0400 X-MC-Unique: 1GULOs7vP-mcXnBW2rj2Eg-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-32db9cd71d7so1648395f8f.0 for ; Wed, 18 Oct 2023 08:53:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644423; x=1698249223; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=thscQjX5d6rsLU3psVlcnXGZdg35cG2DFqaiwAr/Wqo=; b=WOJiC/S2jb33VtgZH1hqlDEIjjIRdwNPPGmZNz1usfBymsBveCZO0kVh26z1I7Wo1B kPQVGNY7ZdJY5o5PglBozC75tmXez2r6FPOpEmZGO1W0LnwWIljCf5MVMXYQFgL/8Vxm lXkJVZxTiqQK54CuEYbDCmFlagDxlKF3t4e8E6vMVk9OXsQguv8BOPIrOGj48JeF0VzW ugJInCnxZlUX5xVO9pGjNbvcHCCFaec6xKwbfBs3yFbHeDIw6VsHSGWzJgMc6TEnqfTT 8afcGg51XJjLSmCp6cGi4cgOVtHCbxwUdfwXRj4v3NZUcuyY/bTvAOct6rLLZefmjYjk dNNw== X-Gm-Message-State: AOJu0YxVS+/wit+l2FCfCjmYYqkXLMVo0Etf19XsID9KE5kPyNv2AfbS XFXBilH2S5fIzMr8DQsvc/19ozuPtUF3q6BPTn2MoFVLO/yhQ0I3y5BbvayBzYxk4u86E6UlWd/ zyBzjyhrZVMn6Ee2fLxH72Lrw0nG83ur/Oz0Zs9aTvlMVVhiN4e/FWEKWQO7g6C/1JvQE4Bk= X-Received: by 2002:adf:a29c:0:b0:32d:a431:9045 with SMTP id s28-20020adfa29c000000b0032da4319045mr4707444wra.30.1697644422845; Wed, 18 Oct 2023 08:53:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEf2j6pizQYXlznqRKiP3MuRvUmFArvLb8S2+NTOyoOL4BxBb9053iTrLh17NG54xuimXNmaw== X-Received: by 2002:adf:a29c:0:b0:32d:a431:9045 with SMTP id s28-20020adfa29c000000b0032da4319045mr4707429wra.30.1697644422572; Wed, 18 Oct 2023 08:53:42 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id e7-20020a05600c218700b00407efbc4361sm1995276wme.9.2023.10.18.08.53.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:53:41 -0700 (PDT) Date: Wed, 18 Oct 2023 11:53:38 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Hawkins Jiawei , Eugenio =?utf-8?b?UMOpcmV6?= Subject: [PULL 06/83] vhost: Expose vhost_svq_available_slots() Message-ID: <99d6a32469debf1a48921125879b614d15acfb7a.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Hawkins Jiawei Next patches in this series will delay the polling and checking of buffers until either the SVQ is full or control commands shadow buffers are full, no longer perform an immediate poll and check of the device's used buffers for each CVQ state load command. To achieve this, this patch exposes vhost_svq_available_slots(), allowing QEMU to know whether the SVQ is full. Signed-off-by: Hawkins Jiawei Acked-by: Eugenio Pérez Message-Id: <25938079f0bd8185fd664c64e205e629f7a966be.1697165821.git.yin31149@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-shadow-virtqueue.h | 1 + hw/virtio/vhost-shadow-virtqueue.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-shadow-virtqueue.h b/hw/virtio/vhost-shadow-virtqueue.h index 5bce67837b..19c842a15b 100644 --- a/hw/virtio/vhost-shadow-virtqueue.h +++ b/hw/virtio/vhost-shadow-virtqueue.h @@ -114,6 +114,7 @@ typedef struct VhostShadowVirtqueue { bool vhost_svq_valid_features(uint64_t features, Error **errp); +uint16_t vhost_svq_available_slots(const VhostShadowVirtqueue *svq); void vhost_svq_push_elem(VhostShadowVirtqueue *svq, const VirtQueueElement *elem, uint32_t len); int vhost_svq_add(VhostShadowVirtqueue *svq, const struct iovec *out_sg, diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vhost-shadow-virtqueue.c index e731b1d2ea..fc5f408f77 100644 --- a/hw/virtio/vhost-shadow-virtqueue.c +++ b/hw/virtio/vhost-shadow-virtqueue.c @@ -66,7 +66,7 @@ bool vhost_svq_valid_features(uint64_t features, Error **errp) * * @svq: The svq */ -static uint16_t vhost_svq_available_slots(const VhostShadowVirtqueue *svq) +uint16_t vhost_svq_available_slots(const VhostShadowVirtqueue *svq) { return svq->num_free; } From patchwork Wed Oct 18 15:53:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1850991 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Hj1WR7DJ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9b8Z02gxz20Pd for ; Thu, 19 Oct 2023 02:57:33 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8rr-0004wz-Io; Wed, 18 Oct 2023 11:53:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8ro-0004vQ-FM for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:53:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8rm-0006Mt-Gp for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:53:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644430; 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=ichudybxzU8iz9vDb7x7lgGWFY23q5nvCS0lnP0+5LI=; b=Hj1WR7DJ6gXF0EW3f1TzHHS6/kbqUST6wpFLaxNFcgDxO9FlH9HFU4ii3ttEjlKoSSO4kG oc4Bmdn9w9NyYCDDwCzokl5ZGK4sO18dCsk+KKHvln75NHPqRqno+cs8x7UidTB/DXvKwi XJ/3BmGo4eAZR0Ke/sHkx015kqivZgo= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-696-9m6Qtx8kM0O-YYXgNgzdTw-1; Wed, 18 Oct 2023 11:53:48 -0400 X-MC-Unique: 9m6Qtx8kM0O-YYXgNgzdTw-1 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2c2845cc163so66947581fa.2 for ; Wed, 18 Oct 2023 08:53:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644427; x=1698249227; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ichudybxzU8iz9vDb7x7lgGWFY23q5nvCS0lnP0+5LI=; b=sl+j0ChSdUVQWYD0IVt9GUwxusu6Ux35YlczYQoXTv0u8qlKBAo6MgR+2xxa1My2Ya 90hEc9FIPrw7cqxX8DOaVbwHfJT9RSWLbdDmgUiYyyO5DEWmAfZWoUHBK1aVDQqQEtxX NDJSLsunPdqTjulOmdcrFvCY9nilyc1XT0Bug+EVJ+fkWSysNR2M9bYnlaAviCQh1rtm 2qBpxFUyoW1QIcYQsW1tSZQAEZaRFMWdsxQROxXw9cMdA4UcQRBOXADDjnLTo2SL9a9Q GI/QlNMV09lgz3SSM0Lv135OssfgxN3x57vMVHMwXGSykKKpTlNno8HA1Mo9bkunk+2K mjkw== X-Gm-Message-State: AOJu0Yz60ZU065yfWCxTj0NWUe44/86dcdqDNfDGbLBNfgxv2UB2X+i3 q/SCBrCqAutaNo63o82L9zs+AjpBprfEwuMilGPlg5kB6NlB+VUyGHV1tfA0lDTjygWfESx1pRx LgDBzSbI9nInsCu+XOFfFmZPQbHcXKXcr8nZUBzw1cirT5EKNGgc5IsFTqYUA22oncrKW4W8= X-Received: by 2002:a2e:7e0f:0:b0:2c5:2d16:6d94 with SMTP id z15-20020a2e7e0f000000b002c52d166d94mr3997979ljc.47.1697644426770; Wed, 18 Oct 2023 08:53:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLSVGWQiLJAYt3C9lUFLju8yoXVJ6khmvrxCWxvOHZX/Nc77ot/mDaBJaUp4OiNU+lXMb0DQ== X-Received: by 2002:a2e:7e0f:0:b0:2c5:2d16:6d94 with SMTP id z15-20020a2e7e0f000000b002c52d166d94mr3997967ljc.47.1697644426343; Wed, 18 Oct 2023 08:53:46 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id o30-20020a05600c511e00b004063cd8105csm2039098wms.22.2023.10.18.08.53.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:53:45 -0700 (PDT) Date: Wed, 18 Oct 2023 11:53:42 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Hawkins Jiawei , Eugenio =?utf-8?b?UMOpcmV6?= , Jason Wang Subject: [PULL 07/83] vdpa: Send cvq state load commands in parallel Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Hawkins Jiawei This patch enables sending CVQ state load commands in parallel at device startup by following steps: * Refactor vhost_vdpa_net_load_cmd() to iterate through the control commands shadow buffers. This allows different CVQ state load commands to use their own unique buffers. * Delay the polling and checking of buffers until either the SVQ is full or control commands shadow buffers are full. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1578 Signed-off-by: Hawkins Jiawei Acked-by: Eugenio Pérez Message-Id: <9350f32278e39f7bce297b8f2d82dac27c6f8c9a.1697165821.git.yin31149@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 165 +++++++++++++++++++++++++++++------------------ 1 file changed, 102 insertions(+), 63 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index ef4d242811..4b7c3b81b8 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -661,6 +661,31 @@ static void vhost_vdpa_net_load_cursor_reset(VhostVDPAState *s, in_cursor->iov_len = vhost_vdpa_net_cvq_cmd_page_len(); } +/* + * Poll SVQ for multiple pending control commands and check the device's ack. + * + * Caller should hold the BQL when invoking this function. + * + * @s: The VhostVDPAState + * @len: The length of the pending status shadow buffer + */ +static ssize_t vhost_vdpa_net_svq_flush(VhostVDPAState *s, size_t len) +{ + /* device uses a one-byte length ack for each control command */ + ssize_t dev_written = vhost_vdpa_net_svq_poll(s, len); + if (unlikely(dev_written != len)) { + return -EIO; + } + + /* check the device's ack */ + for (int i = 0; i < len; ++i) { + if (s->status[i] != VIRTIO_NET_OK) { + return -EIO; + } + } + return 0; +} + static ssize_t vhost_vdpa_net_load_cmd(VhostVDPAState *s, struct iovec *out_cursor, struct iovec *in_cursor, uint8_t class, @@ -671,11 +696,31 @@ static ssize_t vhost_vdpa_net_load_cmd(VhostVDPAState *s, .class = class, .cmd = cmd, }; - size_t data_size = iov_size(data_sg, data_num); + size_t data_size = iov_size(data_sg, data_num), cmd_size; struct iovec out, in; ssize_t r; + unsigned dummy_cursor_iov_cnt; + VhostShadowVirtqueue *svq = g_ptr_array_index(s->vhost_vdpa.shadow_vqs, 0); assert(data_size < vhost_vdpa_net_cvq_cmd_page_len() - sizeof(ctrl)); + cmd_size = sizeof(ctrl) + data_size; + if (vhost_svq_available_slots(svq) < 2 || + iov_size(out_cursor, 1) < cmd_size) { + /* + * It is time to flush all pending control commands if SVQ is full + * or control commands shadow buffers are full. + * + * We can poll here since we've had BQL from the time + * we sent the descriptor. + */ + r = vhost_vdpa_net_svq_flush(s, in_cursor->iov_base - + (void *)s->status); + if (unlikely(r < 0)) { + return r; + } + + vhost_vdpa_net_load_cursor_reset(s, out_cursor, in_cursor); + } /* pack the CVQ command header */ iov_from_buf(out_cursor, 1, 0, &ctrl, sizeof(ctrl)); @@ -684,7 +729,7 @@ static ssize_t vhost_vdpa_net_load_cmd(VhostVDPAState *s, out_cursor->iov_base + sizeof(ctrl), data_size); /* extract the required buffer from the cursor for output */ - iov_copy(&out, 1, out_cursor, 1, 0, sizeof(ctrl) + data_size); + iov_copy(&out, 1, out_cursor, 1, 0, cmd_size); /* extract the required buffer from the cursor for input */ iov_copy(&in, 1, in_cursor, 1, 0, sizeof(*s->status)); @@ -693,11 +738,13 @@ static ssize_t vhost_vdpa_net_load_cmd(VhostVDPAState *s, return r; } - /* - * We can poll here since we've had BQL from the time - * we sent the descriptor. - */ - return vhost_vdpa_net_svq_poll(s, 1); + /* iterate the cursors */ + dummy_cursor_iov_cnt = 1; + iov_discard_front(&out_cursor, &dummy_cursor_iov_cnt, cmd_size); + dummy_cursor_iov_cnt = 1; + iov_discard_front(&in_cursor, &dummy_cursor_iov_cnt, sizeof(*s->status)); + + return 0; } static int vhost_vdpa_net_load_mac(VhostVDPAState *s, const VirtIONet *n, @@ -709,15 +756,12 @@ static int vhost_vdpa_net_load_mac(VhostVDPAState *s, const VirtIONet *n, .iov_base = (void *)n->mac, .iov_len = sizeof(n->mac), }; - ssize_t dev_written = vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor, - VIRTIO_NET_CTRL_MAC, - VIRTIO_NET_CTRL_MAC_ADDR_SET, - &data, 1); - if (unlikely(dev_written < 0)) { - return dev_written; - } - if (*s->status != VIRTIO_NET_OK) { - return -EIO; + ssize_t r = vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor, + VIRTIO_NET_CTRL_MAC, + VIRTIO_NET_CTRL_MAC_ADDR_SET, + &data, 1); + if (unlikely(r < 0)) { + return r; } } @@ -762,15 +806,12 @@ static int vhost_vdpa_net_load_mac(VhostVDPAState *s, const VirtIONet *n, .iov_len = mul_macs_size, }, }; - ssize_t dev_written = vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor, - VIRTIO_NET_CTRL_MAC, - VIRTIO_NET_CTRL_MAC_TABLE_SET, - data, ARRAY_SIZE(data)); - if (unlikely(dev_written < 0)) { - return dev_written; - } - if (*s->status != VIRTIO_NET_OK) { - return -EIO; + ssize_t r = vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor, + VIRTIO_NET_CTRL_MAC, + VIRTIO_NET_CTRL_MAC_TABLE_SET, + data, ARRAY_SIZE(data)); + if (unlikely(r < 0)) { + return r; } return 0; @@ -782,7 +823,7 @@ static int vhost_vdpa_net_load_mq(VhostVDPAState *s, struct iovec *in_cursor) { struct virtio_net_ctrl_mq mq; - ssize_t dev_written; + ssize_t r; if (!virtio_vdev_has_feature(&n->parent_obj, VIRTIO_NET_F_MQ)) { return 0; @@ -793,15 +834,12 @@ static int vhost_vdpa_net_load_mq(VhostVDPAState *s, .iov_base = &mq, .iov_len = sizeof(mq), }; - dev_written = vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor, - VIRTIO_NET_CTRL_MQ, - VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET, - &data, 1); - if (unlikely(dev_written < 0)) { - return dev_written; - } - if (*s->status != VIRTIO_NET_OK) { - return -EIO; + r = vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor, + VIRTIO_NET_CTRL_MQ, + VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET, + &data, 1); + if (unlikely(r < 0)) { + return r; } return 0; @@ -813,7 +851,7 @@ static int vhost_vdpa_net_load_offloads(VhostVDPAState *s, struct iovec *in_cursor) { uint64_t offloads; - ssize_t dev_written; + ssize_t r; if (!virtio_vdev_has_feature(&n->parent_obj, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) { @@ -841,15 +879,12 @@ static int vhost_vdpa_net_load_offloads(VhostVDPAState *s, .iov_base = &offloads, .iov_len = sizeof(offloads), }; - dev_written = vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor, - VIRTIO_NET_CTRL_GUEST_OFFLOADS, - VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET, - &data, 1); - if (unlikely(dev_written < 0)) { - return dev_written; - } - if (*s->status != VIRTIO_NET_OK) { - return -EIO; + r = vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor, + VIRTIO_NET_CTRL_GUEST_OFFLOADS, + VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET, + &data, 1); + if (unlikely(r < 0)) { + return r; } return 0; @@ -865,16 +900,12 @@ static int vhost_vdpa_net_load_rx_mode(VhostVDPAState *s, .iov_base = &on, .iov_len = sizeof(on), }; - ssize_t dev_written; + ssize_t r; - dev_written = vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor, - VIRTIO_NET_CTRL_RX, - cmd, &data, 1); - if (unlikely(dev_written < 0)) { - return dev_written; - } - if (*s->status != VIRTIO_NET_OK) { - return -EIO; + r = vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor, + VIRTIO_NET_CTRL_RX, cmd, &data, 1); + if (unlikely(r < 0)) { + return r; } return 0; @@ -1031,15 +1062,12 @@ static int vhost_vdpa_net_load_single_vlan(VhostVDPAState *s, .iov_base = &vid, .iov_len = sizeof(vid), }; - ssize_t dev_written = vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor, - VIRTIO_NET_CTRL_VLAN, - VIRTIO_NET_CTRL_VLAN_ADD, - &data, 1); - if (unlikely(dev_written < 0)) { - return dev_written; - } - if (unlikely(*s->status != VIRTIO_NET_OK)) { - return -EIO; + ssize_t r = vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor, + VIRTIO_NET_CTRL_VLAN, + VIRTIO_NET_CTRL_VLAN_ADD, + &data, 1); + if (unlikely(r < 0)) { + return r; } return 0; @@ -1106,6 +1134,17 @@ static int vhost_vdpa_net_cvq_load(NetClientState *nc) if (unlikely(r)) { return r; } + + /* + * We need to poll and check all pending device's used buffers. + * + * We can poll here since we've had BQL from the time + * we sent the descriptor. + */ + r = vhost_vdpa_net_svq_flush(s, in_cursor.iov_base - (void *)s->status); + if (unlikely(r)) { + return r; + } } for (int i = 0; i < v->dev->vq_index; ++i) { From patchwork Wed Oct 18 15:53:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1850984 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VahAxSI1; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9b5112VBz20Zj for ; Thu, 19 Oct 2023 02:54:29 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8rt-00059p-9l; Wed, 18 Oct 2023 11:53:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8rr-0004yi-VQ for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:53:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8rq-0006NU-Cb for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:53:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644433; 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=WotlR6MwHv4Nd3GfFkTO3DbeM+x4JzncXWx5AQNhzFU=; b=VahAxSI1X44TbNgg8hmjgSxc1bnv9clEzns+konnl3+A5H4h4z4K7UQ4aDqmZhp7jOn1S+ tiEiZL2gXUozfwDssmqduPBd/8RMQOD34OryGcL9dWbD/6WBDOCD14OsPik25DndWLN+HI PfBpQW/ahIv6BpqVPgqXnsF6/9/Kkt0= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-314--brqh_OmNhuxMj5CfVFK5w-1; Wed, 18 Oct 2023 11:53:52 -0400 X-MC-Unique: -brqh_OmNhuxMj5CfVFK5w-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-32db6a28e24so1978508f8f.0 for ; Wed, 18 Oct 2023 08:53:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644430; x=1698249230; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WotlR6MwHv4Nd3GfFkTO3DbeM+x4JzncXWx5AQNhzFU=; b=hpzGh/bQZGwVjhKntgcYlCJ5qX5EHHh5PIPZMj75mVPN3haoi417O7timgMeGOSA2O 4i7nUr4xXPIPL/mLUVvqMrnR405EkgwlYx8KjSa/mf2uLI+/gcyqDOcb0gCB+qWjkbCb rhBGbl6x//qLbwXJrg43vqnH+Q2YqiLm2dB3X/+/CNqQAfothSCpDJeJl/cX2t8fDnn2 kWF27My5uYMPMDNc3ZBapxzUBvgaWM8hzbFKxzDeyHnKya4Pujsj1AGtPg+e5oKDy5Hg cX3xv71sMG19EYdtfYEeH1A6Z2DJ2gk15T/t+4N3lX5Rf4LS41q5f0JQ541bnmUzZpja H5NQ== X-Gm-Message-State: AOJu0YyaVvEyFODD+lrUBtsuo8UyOPnsVpQELa88IyEatKuBoxdPHhLk kEbSifUbv49CvXv/iS0XqJJL43qh7GwKDN43xQwMVLK/lPSXf/YcGtSLqowAvcuC+fmRsDNoImH Xw5ECItnE+wOiXSb1bT3kaY0aRfKeFmBq+HwVDw8K2Y1NxJOz+X0GLMEudghCziNYKnbowDM= X-Received: by 2002:adf:e50f:0:b0:32d:9ce0:35ae with SMTP id j15-20020adfe50f000000b0032d9ce035aemr4535777wrm.52.1697644430657; Wed, 18 Oct 2023 08:53:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGHJqGoc1XIPGCONuT8NLbhVrhOScjtRChZVNVocjgIrfWJ1XZ/wkS1zHlwXAL9RsYBQfgXAQ== X-Received: by 2002:adf:e50f:0:b0:32d:9ce0:35ae with SMTP id j15-20020adfe50f000000b0032d9ce035aemr4535763wrm.52.1697644430379; Wed, 18 Oct 2023 08:53:50 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id l13-20020a5d480d000000b0032d9523de65sm2369456wrq.48.2023.10.18.08.53.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:53:49 -0700 (PDT) Date: Wed, 18 Oct 2023 11:53:46 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Hawkins Jiawei , Jason Wang Subject: [PULL 08/83] vdpa: Restore hash calculation state Message-ID: <1908cfd6e1748d94680e468b9df6321087b8fcf2.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Hawkins Jiawei This patch introduces vhost_vdpa_net_load_rss() to restore the hash calculation state at device's startup. Note that vhost_vdpa_net_load_rss() has `do_rss` argument, which allows future code to reuse this function to restore the receive-side scaling state when the VIRTIO_NET_F_RSS feature is enabled in SVQ. Currently, vhost_vdpa_net_load_rss() could only be invoked when `do_rss` is set to false. Signed-off-by: Hawkins Jiawei Message-Id: Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 4b7c3b81b8..40d0bcbc0b 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -817,6 +817,88 @@ static int vhost_vdpa_net_load_mac(VhostVDPAState *s, const VirtIONet *n, return 0; } +static int vhost_vdpa_net_load_rss(VhostVDPAState *s, const VirtIONet *n, + struct iovec *out_cursor, + struct iovec *in_cursor, bool do_rss) +{ + struct virtio_net_rss_config cfg; + ssize_t r; + g_autofree uint16_t *table = NULL; + + /* + * According to VirtIO standard, "Initially the device has all hash + * types disabled and reports only VIRTIO_NET_HASH_REPORT_NONE.". + * + * Therefore, there is no need to send this CVQ command if the + * driver disable the all hash types, which aligns with + * the device's defaults. + * + * Note that the device's defaults can mismatch the driver's + * configuration only at live migration. + */ + if (!n->rss_data.enabled || + n->rss_data.hash_types == VIRTIO_NET_HASH_REPORT_NONE) { + return 0; + } + + cfg.hash_types = cpu_to_le32(n->rss_data.hash_types); + + /* + * According to VirtIO standard, "Field reserved MUST contain zeroes. + * It is defined to make the structure to match the layout of + * virtio_net_rss_config structure, defined in 5.1.6.5.7.". + * + * Therefore, we need to zero the fields in struct virtio_net_rss_config, + * which corresponds the `reserved` field in + * struct virtio_net_hash_config. + */ + memset(&cfg.indirection_table_mask, 0, + sizeof_field(struct virtio_net_hash_config, reserved)); + + table = g_malloc_n(n->rss_data.indirections_len, + sizeof(n->rss_data.indirections_table[0])); + for (int i = 0; i < n->rss_data.indirections_len; ++i) { + table[i] = cpu_to_le16(n->rss_data.indirections_table[i]); + } + + /* + * Consider that virtio_net_handle_rss() currently does not restore the + * hash key length parsed from the CVQ command sent from the guest into + * n->rss_data and uses the maximum key length in other code, so we also + * employthe the maxium key length here. + */ + cfg.hash_key_length = sizeof(n->rss_data.key); + + const struct iovec data[] = { + { + .iov_base = &cfg, + .iov_len = offsetof(struct virtio_net_rss_config, + indirection_table), + }, { + .iov_base = table, + .iov_len = n->rss_data.indirections_len * + sizeof(n->rss_data.indirections_table[0]), + }, { + .iov_base = &cfg.max_tx_vq, + .iov_len = offsetof(struct virtio_net_rss_config, hash_key_data) - + offsetof(struct virtio_net_rss_config, max_tx_vq), + }, { + .iov_base = (void *)n->rss_data.key, + .iov_len = sizeof(n->rss_data.key), + } + }; + + r = vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor, + VIRTIO_NET_CTRL_MQ, + VIRTIO_NET_CTRL_MQ_HASH_CONFIG, + data, ARRAY_SIZE(data)); + if (unlikely(r < 0)) { + return r; + } + + return 0; +} + static int vhost_vdpa_net_load_mq(VhostVDPAState *s, const VirtIONet *n, struct iovec *out_cursor, @@ -842,6 +924,15 @@ static int vhost_vdpa_net_load_mq(VhostVDPAState *s, return r; } + if (!virtio_vdev_has_feature(&n->parent_obj, VIRTIO_NET_F_HASH_REPORT)) { + return 0; + } + + r = vhost_vdpa_net_load_rss(s, n, out_cursor, in_cursor, false); + if (unlikely(r < 0)) { + return r; + } + return 0; } From patchwork Wed Oct 18 15:53:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1850983 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZAW0jda/; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9b4x2DDsz20Zj for ; Thu, 19 Oct 2023 02:54:25 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8sB-0007dG-Vv; Wed, 18 Oct 2023 11:54:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8sA-0007LX-1V for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8s7-0006P7-MG for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644449; 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=7qr9joXptBLcHYoSU39OwUryohZJ26ZcaI8wb1rbBFY=; b=ZAW0jda/oOkYfhWgwnLttzORVEYWPvt/kFhW2/csYFYI7fVyJliKk91s86eQXmaIAkwgZR Kew/roGuCFDRQPyy7MVu1IffrXpqriJEAIR+tWAJ+6K1+RNA2yWMgA58VrNDQ0QX+IYhNp jlWI7NUtPG2kRIQeBja636YAfldL6js= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-441-M6AAiwabNYaGkapQKMIARg-1; Wed, 18 Oct 2023 11:54:01 -0400 X-MC-Unique: M6AAiwabNYaGkapQKMIARg-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-40647c6f71dso48836025e9.2 for ; Wed, 18 Oct 2023 08:53:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644434; x=1698249234; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=7qr9joXptBLcHYoSU39OwUryohZJ26ZcaI8wb1rbBFY=; b=NosjSYhZydEi9jflcPtCxV9oS8PypMIN9B3DKCImjjaUPgb8Vspz0KzrHnCQX5Wd8t YuoR/VsZUgUUhzmgE2hdaDM8ERwvoFxanOJXCxHAW32f6cCSgkgBfb+a7xBO/iWayJAh fa6hcDTeJUZOLnY2Cqt6RX2c/dyr89hvrOWjwFc0XkaVwfqShV5uujoCbS7aV3YoYMHA YgkCUehbJO3UwsCp677MvkSghT6jJTEm+GbU86tr0ITx3hEtNs8f1HFYkoGJfmHGj8Mg k56PDKXs6ixvkSM6H45LGeyjcgkQ39TAOVhInAYpqM87gsQ3KFlzFXamVjhBsdfctipz oK4g== X-Gm-Message-State: AOJu0YzqBDLl+rtGJrQj+z6VEjx6lHJS3lVOHf1zVHalSAs7wph0q9AY vjHZtNswMEd72g9M+H1gVYWkVPX+ikMMXJ41Muixri7daLZQPAfUt0bGuOUGXU2TpcmxXiLdfEE wReifjGjnY9HSfzR++iN2375DGWys2s70He7LMJ5ZKEaw9jzbWim0aIXVjBnjPRZ9KwbptEM= X-Received: by 2002:a05:600c:3590:b0:404:4b6f:d70d with SMTP id p16-20020a05600c359000b004044b6fd70dmr4387992wmq.17.1697644434754; Wed, 18 Oct 2023 08:53:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHKnf04l3FPWtfILw0BNHMCNpII4Q6wvb8wREj/6ensB4vC+TbbZNqwz/plyT97EarSDQ6GOQ== X-Received: by 2002:a05:600c:3590:b0:404:4b6f:d70d with SMTP id p16-20020a05600c359000b004044b6fd70dmr4387981wmq.17.1697644434470; Wed, 18 Oct 2023 08:53:54 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id 1-20020a05600c228100b0040596352951sm1953697wmf.5.2023.10.18.08.53.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:53:54 -0700 (PDT) Date: Wed, 18 Oct 2023 11:53:50 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Hawkins Jiawei , Jason Wang Subject: [PULL 09/83] vdpa: Allow VIRTIO_NET_F_HASH_REPORT in SVQ Message-ID: <8fa37f3529265496ffe6546105152b379ae222b8.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Hawkins Jiawei Enable SVQ with VIRTIO_NET_F_HASH_REPORT feature. Signed-off-by: Hawkins Jiawei Message-Id: Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 40d0bcbc0b..66afa34237 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -121,6 +121,7 @@ static const uint64_t vdpa_svq_device_features = BIT_ULL(VIRTIO_NET_F_CTRL_MAC_ADDR) | /* VHOST_F_LOG_ALL is exposed by SVQ */ BIT_ULL(VHOST_F_LOG_ALL) | + BIT_ULL(VIRTIO_NET_F_HASH_REPORT) | BIT_ULL(VIRTIO_NET_F_RSC_EXT) | BIT_ULL(VIRTIO_NET_F_STANDBY) | BIT_ULL(VIRTIO_NET_F_SPEED_DUPLEX); From patchwork Wed Oct 18 15:53:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1850980 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=WZ0n9Ah+; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9b4m4kZjz20Zj for ; Thu, 19 Oct 2023 02:54:16 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8s2-0006AF-4G; Wed, 18 Oct 2023 11:54:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8s0-0005yj-C0 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8ry-0006O5-Kx for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644441; 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=v3Kt9GF/nMSDGe9SBcVzHg8nLaKvLM1MYgeTx0Otwtk=; b=WZ0n9Ah+oBjL8zJfJtZysisDpw4+frdESf+4IZaY29nKgLnUJCjxntIruDBN7gC4vK6XjQ siqYOHRXM4PyBEUh/kIS8iyvcsWyF7nGvEEgP56giWeEmTPnEHnXKKsrpsjfknj5q0pzQb vpRpTO3ZBcfh19jIt0e4J9WlvoKFsKg= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-101-xgF5f9KFN8O3kUTJtUiI0Q-1; Wed, 18 Oct 2023 11:54:00 -0400 X-MC-Unique: xgF5f9KFN8O3kUTJtUiI0Q-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-32d83fd3765so4283280f8f.3 for ; Wed, 18 Oct 2023 08:54:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644439; x=1698249239; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=v3Kt9GF/nMSDGe9SBcVzHg8nLaKvLM1MYgeTx0Otwtk=; b=QkcMJR+vBp+QRLc4XBPjuoosc7iMEENhBx/UyEucYWRgR9B7cgQqpkWy9UR+tHYxS9 Jx/RAhTRfYQAER/XmBulfeZRwaoP2wUlkIG9+iPDCWs2WU7ggIx6sj/eeBivMCQDtBn7 chz4zHlakT42SDb36VPkBkDtv4scn4t63lNZPhS7Qx8xwzgZkZIRuiL/0xCbJlyRY7y8 JMqxnka0YMqYKLuEtEbOnLcFqmPNGBXrGcyWjYm6mSN3sQcD5ibD9Onn2FO/Ei1sdnNs yiiN1jYaWIEadSyI/J/ZE35Dz2/Q5rbXS5kpLZBnf60YuVqyO+XugEjSkFLCxKVgjnqQ Ebng== X-Gm-Message-State: AOJu0YxBsXS4oJyr3ayEDQBfE0Ho/I3VUVKjt+Y/YKaTTbCp9LYPrvxk e3F0jmOqcl6a6krP6jYjthUcSt7fssRyXe6k/kqH6/xzgv4EBr8W4BUFtL8wWfLtkXtM0Q5KayC LLGLWXj3iC0W/XRjWZobWZWvTI+SzB2Sgs/Ljt72vwNOWA4NWjkZ0pf0VJq8Ap7/BFon/BEs= X-Received: by 2002:a5d:608d:0:b0:32d:9d0e:7841 with SMTP id w13-20020a5d608d000000b0032d9d0e7841mr4365843wrt.6.1697644438854; Wed, 18 Oct 2023 08:53:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE4gbyRcdbIWFAgM5oZzVlppyniUdkgIa+YQxMhxD/p7e6jz4DPPW8BZ5vYyJnuYu9ibCJQeA== X-Received: by 2002:a5d:608d:0:b0:32d:9d0e:7841 with SMTP id w13-20020a5d608d000000b0032d9d0e7841mr4365825wrt.6.1697644438546; Wed, 18 Oct 2023 08:53:58 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id o1-20020adfcf01000000b0031c52e81490sm2424436wrj.72.2023.10.18.08.53.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:53:58 -0700 (PDT) Date: Wed, 18 Oct 2023 11:53:54 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Hawkins Jiawei , Eugenio =?utf-8?b?UMOpcmV6?= , Jason Wang Subject: [PULL 10/83] vdpa: Add SetSteeringEBPF method for NetClientState Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Hawkins Jiawei At present, to enable the VIRTIO_NET_F_RSS feature, eBPF must be loaded for the vhost backend. Given that vhost-vdpa is one of the vhost backend, we need to implement the SetSteeringEBPF method to support RSS for vhost-vdpa, even if vhost-vdpa calculates the rss hash in the hardware device instead of in the kernel by eBPF. Although this requires QEMU to be compiled with `--enable-bpf` configuration even if the vdpa device does not use eBPF to calculate the rss hash, this can avoid adding the specific conditional statements for vDPA case to enable the VIRTIO_NET_F_RSS feature, which reduces code maintainbility. Suggested-by: Eugenio Pérez Signed-off-by: Hawkins Jiawei Message-Id: <30509e3c3b07bcadd95d5932aeb16820cb022902.1693299194.git.yin31149@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 66afa34237..ef48b6e816 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -241,6 +241,12 @@ static void vhost_vdpa_cleanup(NetClientState *nc) } } +/** Dummy SetSteeringEBPF to support RSS for vhost-vdpa backend */ +static bool vhost_vdpa_set_steering_ebpf(NetClientState *nc, int prog_fd) +{ + return true; +} + static bool vhost_vdpa_has_vnet_hdr(NetClientState *nc) { assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_VDPA); @@ -422,6 +428,7 @@ static NetClientInfo net_vhost_vdpa_info = { .has_vnet_hdr = vhost_vdpa_has_vnet_hdr, .has_ufo = vhost_vdpa_has_ufo, .check_peer_type = vhost_vdpa_check_peer_type, + .set_steering_ebpf = vhost_vdpa_set_steering_ebpf, }; static int64_t vhost_vdpa_get_vring_group(int device_fd, unsigned vq_index, @@ -1257,6 +1264,7 @@ static NetClientInfo net_vhost_vdpa_cvq_info = { .has_vnet_hdr = vhost_vdpa_has_vnet_hdr, .has_ufo = vhost_vdpa_has_ufo, .check_peer_type = vhost_vdpa_check_peer_type, + .set_steering_ebpf = vhost_vdpa_set_steering_ebpf, }; /* From patchwork Wed Oct 18 15:53:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1850982 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=SFf8LXzz; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9b4v29fXz20Zj for ; Thu, 19 Oct 2023 02:54:23 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8s7-0006xN-S4; Wed, 18 Oct 2023 11:54:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8s5-0006hz-97 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8s3-0006Oj-10 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644446; 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=NnZ2s+L/b1HX9DHf9pBpEKpAVinEM8uC7IZ8jyp1dfs=; b=SFf8LXzzYnAJ3WAOczYKfwMEF0cklm5oWSsQ88ky9qKXUt0EyERmqfsFrt7vb//BeXOK9S MhOGXhxmbzeP7HY9/tv1x6o9XdoTxXruHMAlrV1KyuWw2/BMZbV8dwtYv1fIP67Zi+LgPc 8N5lohHwYex3P4kxLUddB86eNfbo0mU= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-313-VDvMAh-BNgm6T2Ye7aKSqg-1; Wed, 18 Oct 2023 11:54:04 -0400 X-MC-Unique: VDvMAh-BNgm6T2Ye7aKSqg-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-406710d9a4aso49922635e9.2 for ; Wed, 18 Oct 2023 08:54:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644443; x=1698249243; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=NnZ2s+L/b1HX9DHf9pBpEKpAVinEM8uC7IZ8jyp1dfs=; b=mbIVTWF1aanQAKfomHZQ0c5cz9Kj2BvSShNYZY1hGZrTmbgZRWTSS1bnYzAMHUnpmL 4VSxWWfS7vQhxH2GjkJK14rGIYa7ajHUyq67AfrkcH5X2aLu1vh10aVugA25GUWcgQm6 VqkZO/QKjRaS+PCy74g8d9r6QLqPKH6nVr3ijwbZWtdTxPi3CWdNdBUe41bQ5TBbh1nb PbKvhi0yjMABn1H/4xduhdctfmF41vufvJX9+EJrhTmm671DaifNwFcsG/KixNwdSryT XvQeC77HssEYvrwJb90qDpY6Q2nc+T/1L2kaFGBH3aEZZw20lG7ePsx72KJ9qnq/HcSq jANA== X-Gm-Message-State: AOJu0Ywe3dbV3kuV/YuiGdypYbNm5mNwShgApxn4P+lrh0oxw7OXyevC NIa4hFAqyA6HQS5nzJovKRWs6OW3aQ8gdB2KuOFc6rOOeFXW5tCpsxH4bGvdLoQ227JrvkXxTML bz7ctnQfBTKmbJF5DWGBpzaKfwAsENkcbRHuzTcHLFNXIkVWG6tOnBo8JxtZv0vbBczoctT8= X-Received: by 2002:a05:600c:1d22:b0:408:41b4:7fe0 with SMTP id l34-20020a05600c1d2200b0040841b47fe0mr540270wms.6.1697644442852; Wed, 18 Oct 2023 08:54:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGNNvqRufkYWgLCVMGAiH4zi1xx9tS7bzYRTiAW//xjGT/3weCrOaRyFc5BIYT1v4YpiRP3Vw== X-Received: by 2002:a05:600c:1d22:b0:408:41b4:7fe0 with SMTP id l34-20020a05600c1d2200b0040841b47fe0mr540257wms.6.1697644442550; Wed, 18 Oct 2023 08:54:02 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id h17-20020a05600c499100b0040772138bb7sm1962949wmp.2.2023.10.18.08.54.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:54:02 -0700 (PDT) Date: Wed, 18 Oct 2023 11:53:58 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Hawkins Jiawei , Jason Wang Subject: [PULL 11/83] vdpa: Restore receive-side scaling state Message-ID: <49f5836bacfb9d4bb96d29f16d04822d64e0ad52.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Hawkins Jiawei This patch reuses vhost_vdpa_net_load_rss() with some refactorings to restore the receive-side scaling state at device's startup. Signed-off-by: Hawkins Jiawei Message-Id: <47b17e160ba4e55b24790b7d73b22d2b437ebe3c.1693299194.git.yin31149@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 54 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index ef48b6e816..846457129d 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -851,17 +851,28 @@ static int vhost_vdpa_net_load_rss(VhostVDPAState *s, const VirtIONet *n, cfg.hash_types = cpu_to_le32(n->rss_data.hash_types); - /* - * According to VirtIO standard, "Field reserved MUST contain zeroes. - * It is defined to make the structure to match the layout of - * virtio_net_rss_config structure, defined in 5.1.6.5.7.". - * - * Therefore, we need to zero the fields in struct virtio_net_rss_config, - * which corresponds the `reserved` field in - * struct virtio_net_hash_config. - */ - memset(&cfg.indirection_table_mask, 0, - sizeof_field(struct virtio_net_hash_config, reserved)); + if (do_rss) { + /* + * According to VirtIO standard, "Number of entries in indirection_table + * is (indirection_table_mask + 1)". + */ + cfg.indirection_table_mask = cpu_to_le16(n->rss_data.indirections_len - + 1); + cfg.unclassified_queue = cpu_to_le16(n->rss_data.default_queue); + cfg.max_tx_vq = cpu_to_le16(n->curr_queue_pairs); + } else { + /* + * According to VirtIO standard, "Field reserved MUST contain zeroes. + * It is defined to make the structure to match the layout of + * virtio_net_rss_config structure, defined in 5.1.6.5.7.". + * + * Therefore, we need to zero the fields in + * struct virtio_net_rss_config, which corresponds the `reserved` field + * in struct virtio_net_hash_config. + */ + memset(&cfg.indirection_table_mask, 0, + sizeof_field(struct virtio_net_hash_config, reserved)); + } table = g_malloc_n(n->rss_data.indirections_len, sizeof(n->rss_data.indirections_table[0])); @@ -898,6 +909,7 @@ static int vhost_vdpa_net_load_rss(VhostVDPAState *s, const VirtIONet *n, r = vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor, VIRTIO_NET_CTRL_MQ, + do_rss ? VIRTIO_NET_CTRL_MQ_RSS_CONFIG : VIRTIO_NET_CTRL_MQ_HASH_CONFIG, data, ARRAY_SIZE(data)); if (unlikely(r < 0)) { @@ -932,13 +944,19 @@ static int vhost_vdpa_net_load_mq(VhostVDPAState *s, return r; } - if (!virtio_vdev_has_feature(&n->parent_obj, VIRTIO_NET_F_HASH_REPORT)) { - return 0; - } - - r = vhost_vdpa_net_load_rss(s, n, out_cursor, in_cursor, false); - if (unlikely(r < 0)) { - return r; + if (virtio_vdev_has_feature(&n->parent_obj, VIRTIO_NET_F_RSS)) { + /* load the receive-side scaling state */ + r = vhost_vdpa_net_load_rss(s, n, out_cursor, in_cursor, true); + if (unlikely(r < 0)) { + return r; + } + } else if (virtio_vdev_has_feature(&n->parent_obj, + VIRTIO_NET_F_HASH_REPORT)) { + /* load the hash calculation state */ + r = vhost_vdpa_net_load_rss(s, n, out_cursor, in_cursor, false); + if (unlikely(r < 0)) { + return r; + } } return 0; From patchwork Wed Oct 18 15:54:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1850987 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=huCeHZ/C; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9b5K59Ffz20Zj for ; Thu, 19 Oct 2023 02:54:44 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8sE-0007rK-W0; Wed, 18 Oct 2023 11:54:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8sD-0007oz-JQ for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8sC-0006Pf-6u for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644455; 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=m6cMudFJUQ+3yuyqk3PBF0ExHMQrvBzp4Se77OWthFE=; b=huCeHZ/CCHwxdjq6+jG9hB0WhsYAhc+2M1PKZ/uHkcbCVlMhqSdHIM6gMd96emwbPhLwos 5Zt8XpAU6+EMqzV8YyA2FM5LgzgzN9I6s/sj9q7QgmTjtMet6ef77SEX3z1iVwQkj/e2iX YAI7y9zasCiwlYfPCRq+LHqjfj6mZxQ= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-596-9YuwAtsPO-aJV5duiG1adw-1; Wed, 18 Oct 2023 11:54:09 -0400 X-MC-Unique: 9YuwAtsPO-aJV5duiG1adw-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2c504f93c4eso54844601fa.3 for ; Wed, 18 Oct 2023 08:54:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644447; x=1698249247; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=m6cMudFJUQ+3yuyqk3PBF0ExHMQrvBzp4Se77OWthFE=; b=UwuOcOpWd5lCnL/Nr8BdeIv7bbOJ+l3bOP2O7BD6OUdtAvBGmre400sArCDhUdasud fXm1v5TP4bcWFyJcAwsiiHW3OM1CGNdxXemMqbt6+ZC7Ij6ydNqaAGWEhhEASgcjmwlB yOPAIVq0iUgd8JclrXZ9bjZeb+ActhyYnSpGy/aAtBfOk8UeHoUV+x2PdgfNa1Xmc8sr vURKMTbyWD4U9wvZFT8njVn1cPE/DMv8BTOKbrkcTWOWNTdsv55hO5+NtfYywJJRjzCl i7XX7w9cYN78rceqaBpjkpwtseow3ebSz7zP0et0XKNhL+5DKvooKXYVksBzO1mTnGu0 SeJA== X-Gm-Message-State: AOJu0Yyz3OR37CSoAJxR5WJyXVuCdUTEyT5Wbr578+y/uGeB25P6NZXJ j4Vg/xfcF73Bndi0ALXthYq0MkulfN03rgngRkY5Lph6yjhegZFiOmz03XyvKzocvdBCFxRiORA WlKaaK8AMniE7695Fq8fn8HO6tZVc9os7AjBCKY4LzSSjneppSVO2Cl/CZZUvf1j6comvkpg= X-Received: by 2002:a2e:920b:0:b0:2c5:aff:f936 with SMTP id k11-20020a2e920b000000b002c50afff936mr3895536ljg.53.1697644446838; Wed, 18 Oct 2023 08:54:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHdTg+LWtmsQ+LOFs31BequBF8aMz2RnX499+nnOJOrvTv7AmD+Y7ypjf+DCZgQauGMPXltiA== X-Received: by 2002:a2e:920b:0:b0:2c5:aff:f936 with SMTP id k11-20020a2e920b000000b002c50afff936mr3895523ljg.53.1697644446559; Wed, 18 Oct 2023 08:54:06 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id r16-20020a05600c459000b00405391f485fsm2016052wmo.41.2023.10.18.08.54.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:54:06 -0700 (PDT) Date: Wed, 18 Oct 2023 11:54:02 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Hawkins Jiawei , Jason Wang Subject: [PULL 12/83] vdpa: Allow VIRTIO_NET_F_RSS in SVQ Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Hawkins Jiawei Enable SVQ with VIRTIO_NET_F_RSS feature. Signed-off-by: Hawkins Jiawei Message-Id: <2d2a378291bfac4144a0c0c473cf80415bb580b3.1693299194.git.yin31149@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 846457129d..b2ce6ef986 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -122,6 +122,7 @@ static const uint64_t vdpa_svq_device_features = /* VHOST_F_LOG_ALL is exposed by SVQ */ BIT_ULL(VHOST_F_LOG_ALL) | BIT_ULL(VIRTIO_NET_F_HASH_REPORT) | + BIT_ULL(VIRTIO_NET_F_RSS) | BIT_ULL(VIRTIO_NET_F_RSC_EXT) | BIT_ULL(VIRTIO_NET_F_STANDBY) | BIT_ULL(VIRTIO_NET_F_SPEED_DUPLEX); From patchwork Wed Oct 18 15:54:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1850988 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZeMljxQU; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9b5w1ndFz20Pd for ; Thu, 19 Oct 2023 02:55:16 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8sF-0007rx-MZ; Wed, 18 Oct 2023 11:54:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8sD-0007oQ-D2 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8sB-0006PW-J3 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644454; 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=HGbWylb8H+QpIrFYsSYMoQCOLgbUc7uDdWXTJl1zQX0=; b=ZeMljxQUsQQ9R1wCvlAzI7SSJL+lY0cewM4+qwjn9i/feT4OoSFQ2oAzb8yN1WfgpTPF/s fvI23KNIcI9ADUy3sRXcmlds1ijkC7L7nry5yPJ78tDSaZLhq4uMxBki/DI1RalgIQJW2l LnYmu+fzmTgX0tlZzR5PqN21+AF10BQ= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-15-Z1m2ZjZOOS2WqcjT2IR45A-1; Wed, 18 Oct 2023 11:54:13 -0400 X-MC-Unique: Z1m2ZjZOOS2WqcjT2IR45A-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-402cd372b8bso54051965e9.2 for ; Wed, 18 Oct 2023 08:54:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644451; x=1698249251; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=HGbWylb8H+QpIrFYsSYMoQCOLgbUc7uDdWXTJl1zQX0=; b=S1p7uxNu8rhVwgvf7NUowJPCdEmuehbDhXGdCoUA8UpeDtVKghtLOg3pxoFeVKA56h tXrZla6Y0Kf/lGIBhpjUp3IAs4zY13EEgMU5LI6EZVHfmSBvWWyEwMXqBDWiERzjIerh oAglAcUH0xZ0LBwQuVJvqkV+CAIQ+eQ100wfSNT8MNh4teC9XDhgFqSRppMk5WU/lB3Q QI9KdFvhGmJXJPoPrxwGLzFGJe6ysIWCTtggv470CuKcOXZTwDn6BcgrZKR6Sk/TKyDv aDEkyk5MeWvfvyyWsKuHy+DBQAwFmV9e0wobtSmIZ1LcD2fy2mrWyLPC6Dg3WtrQi3VN gOCw== X-Gm-Message-State: AOJu0YxZtQNzJ+jHNNetchp3JxiZpG5XTs1T3zCgrneDnc0u1Bq5VRBD 9dvrZmPII7wI57UfU5TLsMUN6/rsRhStPj8fmvcp1N+iaNQEFzq4flw/UWOg3QChpvhqiT1ZIoa iVSY/1k1Cx3CRUGu/OHLyjJ0RbaVrtiVeTG/jaGQZ8RWJLs0Ci3n3e3AkEhdAgE+m/Gy8BPs= X-Received: by 2002:a05:600c:524d:b0:405:1bbd:aa9c with SMTP id fc13-20020a05600c524d00b004051bbdaa9cmr4335881wmb.34.1697644451740; Wed, 18 Oct 2023 08:54:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH+Zg7TCOKY3RgV7a4OWMuk0PtF+D6hpxX4UgTpTnGgQTTATsQoRNFk3hE10vu3H4jrX5p9ZA== X-Received: by 2002:a05:600c:524d:b0:405:1bbd:aa9c with SMTP id fc13-20020a05600c524d00b004051bbdaa9cmr4335862wmb.34.1697644451453; Wed, 18 Oct 2023 08:54:11 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id z6-20020a05600c220600b00405c33a9a12sm1251228wml.0.2023.10.18.08.54.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:54:11 -0700 (PDT) Date: Wed, 18 Oct 2023 11:54:06 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhao Liu , Igor Mammedov , Eduardo Habkost , Marcel Apfelbaum , Philippe =?utf-8?q?Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Yanan Wang Subject: [PULL 13/83] tests: test-smp-parse: Add the test for cores/threads per socket helpers Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhao Liu Use the different ways to calculate cores/threads per socket, so that the new CPU topology levels won't be missed in these 2 helpes: * machine_topo_get_cores_per_socket() * machine_topo_get_threads_per_socket() Test the commit a1d027be95bc3 ("machine: Add helpers to get cores/ threads per socket"). Suggested-by: Igor Mammedov Signed-off-by: Zhao Liu Acked-by: Igor Mammedov Message-Id: <20230928125943.1816922-2-zhao1.liu@linux.intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/unit/test-smp-parse.c | 67 ++++++++++++++++++++++++++++++------- 1 file changed, 54 insertions(+), 13 deletions(-) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index fdc39a846c..24972666a7 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -394,20 +394,47 @@ static char *smp_config_to_string(const SMPConfiguration *config) config->has_maxcpus ? "true" : "false", config->maxcpus); } -static char *cpu_topology_to_string(const CpuTopology *topo) +/* Use the different calculation than machine_topo_get_threads_per_socket(). */ +static unsigned int cpu_topology_get_threads_per_socket(const CpuTopology *topo) +{ + /* Check the divisor to avoid invalid topology examples causing SIGFPE. */ + if (!topo->sockets) { + return 0; + } else { + return topo->max_cpus / topo->sockets; + } +} + +/* Use the different calculation than machine_topo_get_cores_per_socket(). */ +static unsigned int cpu_topology_get_cores_per_socket(const CpuTopology *topo) +{ + /* Check the divisor to avoid invalid topology examples causing SIGFPE. */ + if (!topo->threads) { + return 0; + } else { + return cpu_topology_get_threads_per_socket(topo) / topo->threads; + } +} + +static char *cpu_topology_to_string(const CpuTopology *topo, + unsigned int threads_per_socket, + unsigned int cores_per_socket) { return g_strdup_printf( "(CpuTopology) {\n" - " .cpus = %u,\n" - " .sockets = %u,\n" - " .dies = %u,\n" - " .clusters = %u,\n" - " .cores = %u,\n" - " .threads = %u,\n" - " .max_cpus = %u,\n" + " .cpus = %u,\n" + " .sockets = %u,\n" + " .dies = %u,\n" + " .clusters = %u,\n" + " .cores = %u,\n" + " .threads = %u,\n" + " .max_cpus = %u,\n" + " .threads_per_socket = %u,\n" + " .cores_per_socket = %u,\n" "}", topo->cpus, topo->sockets, topo->dies, topo->clusters, - topo->cores, topo->threads, topo->max_cpus); + topo->cores, topo->threads, topo->max_cpus, + threads_per_socket, cores_per_socket); } static void check_parse(MachineState *ms, const SMPConfiguration *config, @@ -415,14 +442,26 @@ static void check_parse(MachineState *ms, const SMPConfiguration *config, bool is_valid) { g_autofree char *config_str = smp_config_to_string(config); - g_autofree char *expect_topo_str = cpu_topology_to_string(expect_topo); - g_autofree char *output_topo_str = NULL; + g_autofree char *expect_topo_str = NULL, *output_topo_str = NULL; + unsigned int expect_threads_per_socket, expect_cores_per_socket; + unsigned int ms_threads_per_socket, ms_cores_per_socket; Error *err = NULL; + expect_threads_per_socket = + cpu_topology_get_threads_per_socket(expect_topo); + expect_cores_per_socket = + cpu_topology_get_cores_per_socket(expect_topo); + expect_topo_str = cpu_topology_to_string(expect_topo, + expect_threads_per_socket, + expect_cores_per_socket); + /* call the generic parser */ machine_parse_smp_config(ms, config, &err); - output_topo_str = cpu_topology_to_string(&ms->smp); + ms_threads_per_socket = machine_topo_get_threads_per_socket(ms); + ms_cores_per_socket = machine_topo_get_cores_per_socket(ms); + output_topo_str = cpu_topology_to_string(&ms->smp, ms_threads_per_socket, + ms_cores_per_socket); /* when the configuration is supposed to be valid */ if (is_valid) { @@ -433,7 +472,9 @@ static void check_parse(MachineState *ms, const SMPConfiguration *config, (ms->smp.clusters == expect_topo->clusters) && (ms->smp.cores == expect_topo->cores) && (ms->smp.threads == expect_topo->threads) && - (ms->smp.max_cpus == expect_topo->max_cpus)) { + (ms->smp.max_cpus == expect_topo->max_cpus) && + (ms_threads_per_socket == expect_threads_per_socket) && + (ms_cores_per_socket == expect_cores_per_socket)) { return; } From patchwork Wed Oct 18 15:54:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1850986 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hpX5ABc4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9b571Rd4z20Zj for ; Thu, 19 Oct 2023 02:54:35 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8sK-00082K-KZ; Wed, 18 Oct 2023 11:54:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8sJ-0007ya-1M for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8sH-0006RT-Fv for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644460; 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=fqm+3g2pVOW5m/nVt88A5JfMQVm/PoWF4WmYjiRU9/k=; b=hpX5ABc4q4ZjwU8nwOpB+NOGzEs6h3clbZcPAbJnSqTZGTrCdeY+Uiw8nLK2qiv/1jr/Ay I6xt19n7IjweOa4y6eLt6+li17CF3idrtbu9hEGp0Z0v9qH6Nb3wLMS8V/CbhOcuoLjEGE AcCZ3FfBngVE64rtWCM+lS0HUo5asdg= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-221-J1bwyj6HPAusUa3RC36h6Q-1; Wed, 18 Oct 2023 11:54:19 -0400 X-MC-Unique: J1bwyj6HPAusUa3RC36h6Q-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-40590e6bd67so51796485e9.2 for ; Wed, 18 Oct 2023 08:54:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644458; x=1698249258; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fqm+3g2pVOW5m/nVt88A5JfMQVm/PoWF4WmYjiRU9/k=; b=cToeOBxQ2Aw9PHdpGYjUhwbXr9QiubCaux0BRuLMS2cFEiDrhI46d+YWcjp24pwb5Y Xj3jiJBlthPsA8WmIna3FKrAd3r71wy+UzOgHtLmNofivdBT9hGAbwftPUjR3qJW4Eaz A4nTnXhhriAYbtOIrWHmNLLBn1k+xTo7p7Exb3ZDWbagyXJWAc888uHt2jGLnkZOGmxM YuJl3G4xE4VvAqEZDlMuDZHsILrMWswLyg15hAmoAjS9xElGC/CyoTCQfT+1wgd8cbIt f+5+el3StOKk+jhXANVrcVVuG/TwilZIVQy5+DQKMPnZ5h35tseaEZRYQOBkzybdyID6 dsJQ== X-Gm-Message-State: AOJu0YxJ0IsOYALSLZgh/bQzDiniKTHzyXdiMY23tCVrSvOhJCgs+ZrZ 101opvIOJlKfbWp+ykxNX4Ro3PsrLgL4V4lCU1A28LQN+xx8I6EyHwnfuaW2gx6xBRIDWn5FXz8 +nRddUAdm+ctM5eOePzQLbTAyap3DImR2tUK3XX47zNG8hT5kKWhGPuc3qRo1UYYXkhcPOzg= X-Received: by 2002:a05:600c:3ba8:b0:402:ea83:45cf with SMTP id n40-20020a05600c3ba800b00402ea8345cfmr4747209wms.2.1697644457931; Wed, 18 Oct 2023 08:54:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYLnTmVWTHJJ50DwAlFv3IxetsIVnH2hgB0/eVkbrFDsdSAFwOog0tEI1JKJKRwQBrB6nHEA== X-Received: by 2002:a05:600c:3ba8:b0:402:ea83:45cf with SMTP id n40-20020a05600c3ba800b00402ea8345cfmr4747189wms.2.1697644457554; Wed, 18 Oct 2023 08:54:17 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id l18-20020a05600c4f1200b00407752f5ab6sm2021363wmq.6.2023.10.18.08.54.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:54:17 -0700 (PDT) Date: Wed, 18 Oct 2023 11:54:11 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhao Liu , Igor Mammedov , Ani Sinha Subject: [PULL 14/83] tests: bios-tables-test: Prepare the ACPI table change for smbios type4 count test Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhao Liu Following the guidelines in tests/qtest/bios-tables-test.c, this is step 1 - 3. List the ACPI tables that will be added to test the type 4 count. Signed-off-by: Zhao Liu Message-Id: <20230928125943.1816922-3-zhao1.liu@linux.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/q35/APIC.type4-count | 0 tests/data/acpi/q35/DSDT.type4-count | 0 tests/data/acpi/q35/FACP.type4-count | 0 4 files changed, 3 insertions(+) create mode 100644 tests/data/acpi/q35/APIC.type4-count create mode 100644 tests/data/acpi/q35/DSDT.type4-count create mode 100644 tests/data/acpi/q35/FACP.type4-count diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..0ce6f8fc72 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/q35/APIC.type4-count", +"tests/data/acpi/q35/DSDT.type4-count", +"tests/data/acpi/q35/FACP.type4-count", diff --git a/tests/data/acpi/q35/APIC.type4-count b/tests/data/acpi/q35/APIC.type4-count new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/q35/DSDT.type4-count b/tests/data/acpi/q35/DSDT.type4-count new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/q35/FACP.type4-count b/tests/data/acpi/q35/FACP.type4-count new file mode 100644 index 0000000000..e69de29bb2 From patchwork Wed Oct 18 15:54:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1850989 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZehQEyar; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9b6P23JFz20Pd for ; Thu, 19 Oct 2023 02:55:41 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8sa-0001Pk-C7; Wed, 18 Oct 2023 11:54:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8sY-0001AA-79 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8sW-0006Tj-Ff for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644475; 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=NwMMcG5cEaHfQ2TgGjb60VwjA/LGsrSX8V2jHOn88fg=; b=ZehQEyar9JR4VHQY/Tecw8RRBTxSqVVeJDGUz5H1J8WRwtoOOsIiG4TZzWxdZEztPBpxni xnn9+xWqmWXa6yFnd1gqnKtc5t2bTIdaBk+fCfNIjQhkbcI59Nc4NIKqwq4O6Bx44k0he9 lMyQHaGSz/mKUnAR8/YnJ/YJztqoO5o= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-199-u9NN3IqVPo6Ikgacy4vdgw-1; Wed, 18 Oct 2023 11:54:24 -0400 X-MC-Unique: u9NN3IqVPo6Ikgacy4vdgw-1 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2b6ff15946fso66532031fa.2 for ; Wed, 18 Oct 2023 08:54:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644462; x=1698249262; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=NwMMcG5cEaHfQ2TgGjb60VwjA/LGsrSX8V2jHOn88fg=; b=D8DT64sWp8bGrqiJ0QVlUERvW38Qzcgn7/YLTOXdc2xyxIIkcpJ7pqO3S0W7InKV1k g+mSaUCHFVTY4bvYWadNxuA1+wSY3aXhbF9+ND8m1CD41gYxIvvNbAY8VK9U0c2pe2/c cYwwC5+LJ9g9KrXGp13zqZ5Mlo7VfVzBE+wQ87cVVoEsA3DmV6CCF7MN8UtkZV1rTle1 qvrFrJ/mXqP/X/h5BoIFc2jTiVN8teM8Nqh7672MLhJimWdd0qtZPg2EcoBYfZxgCnDS vpAApgmfDb+1JRa9zKBpBKW6eYlG8UFGZhPGK39bszNdk+gFmbsUYEI0xvXaiBzBy+Hs Gm5w== X-Gm-Message-State: AOJu0Yzw2QewA2uCtQQOv5DmjzVSdvQ1JE5+MgcbF3R8o/3MMGmf2N60 CYDrQ28IMKY4DDUB3ZKmSrfjNAwQOz3tpnRuDna7kSjQ58FOR4YrDv49upeFoN+6aFMhaiKdSf9 JjB0kto9F4c0jmYBtMKT7CJlWMVaQYHYLU3HA+OA+0OKaVLVfip0TgK0CygzICbHF7a/6Q5A= X-Received: by 2002:a2e:a178:0:b0:2c5:1ad3:7798 with SMTP id u24-20020a2ea178000000b002c51ad37798mr3914198ljl.52.1697644462354; Wed, 18 Oct 2023 08:54:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH+1a/J+T834ACXR4ZE3y99OajdE2j9O+kFSxbreOq+ZL0+apO6nEdsGJBICFMldX/3uZIlsQ== X-Received: by 2002:a2e:a178:0:b0:2c5:1ad3:7798 with SMTP id u24-20020a2ea178000000b002c51ad37798mr3914183ljl.52.1697644461992; Wed, 18 Oct 2023 08:54:21 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id a14-20020adfe5ce000000b003296b488961sm2405552wrn.31.2023.10.18.08.54.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:54:21 -0700 (PDT) Date: Wed, 18 Oct 2023 11:54:17 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhao Liu , Igor Mammedov , Ani Sinha Subject: [PULL 15/83] tests: bios-tables-test: Add test for smbios type4 count Message-ID: <335c9675408d8b72a31f5fd34ca7cdfc219968fe.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhao Liu This tests the commit d79a284a44bb7 ("hw/smbios: Fix smbios_smp_sockets calculation"). In smbios_get_tables() (hw/smbios/smbios.c), smbios type4 table is built for each socket, so the count of type4 tables should be equal to the number of sockets. Thus for the topology in this case, there're the following considerations: 1. The topology should include multiple sockets to ensure smbios could create type4 tables for each socket. 2. In addition to sockets, for the more general topology, we should also configure as many topology levels as possible (multiple dies, no module since x86 hasn't supported it), to ensure that smbios is able to exclude the effect of other topology levels to create the type4 tables only for sockets. 3. The original miscalculation bug also misused "smp.cpus", so it's necessary to configure "cpus" (presented threads for machine) and "maxcpus" (total threads for machine) as well to make sure that configuring unpluged CPUs in smp (cpus < maxcpus) does not affect the correctness of the count of type4 tables. Based on these considerations, select the topology as the follow: -smp cpus=100,maxcpus=120,sockets=5,dies=2,cores=4,threads=3 The expected count of type4 tables = sockets (5). Suggested-by: Igor Mammedov Signed-off-by: Zhao Liu Message-Id: <20230928125943.1816922-4-zhao1.liu@linux.intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 9f4bc15aab..cdbfb51559 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -97,6 +97,7 @@ typedef struct { uint16_t smbios_core_count2; uint8_t *required_struct_types; int required_struct_types_len; + int type4_count; QTestState *qts; } test_data; @@ -673,12 +674,21 @@ static void smbios_cpu_test(test_data *data, uint32_t addr, } } +static void smbios_type4_count_test(test_data *data, int type4_count) +{ + int expected_type4_count = data->type4_count; + + if (expected_type4_count) { + g_assert_cmpuint(type4_count, ==, expected_type4_count); + } +} + static void test_smbios_structs(test_data *data, SmbiosEntryPointType ep_type) { DECLARE_BITMAP(struct_bitmap, SMBIOS_MAX_TYPE+1) = { 0 }; SmbiosEntryPoint *ep_table = &data->smbios_ep_table; - int i = 0, len, max_len = 0; + int i = 0, len, max_len = 0, type4_count = 0; uint8_t type, prv, crt; uint64_t addr; @@ -704,6 +714,7 @@ static void test_smbios_structs(test_data *data, SmbiosEntryPointType ep_type) if (type == 4) { smbios_cpu_test(data, addr, ep_type); + type4_count++; } /* seek to end of unformatted string area of this struct ("\0\0") */ @@ -747,6 +758,8 @@ static void test_smbios_structs(test_data *data, SmbiosEntryPointType ep_type) for (i = 0; i < data->required_struct_types_len; i++) { g_assert(test_bit(data->required_struct_types[i], struct_bitmap)); } + + smbios_type4_count_test(data, type4_count); } static void test_acpi_load_tables(test_data *data) @@ -970,6 +983,22 @@ static void test_acpi_q35_tcg(void) free_test_data(&data); } +static void test_acpi_q35_tcg_type4_count(void) +{ + test_data data = { + .machine = MACHINE_Q35, + .variant = ".type4-count", + .required_struct_types = base_required_struct_types, + .required_struct_types_len = ARRAY_SIZE(base_required_struct_types), + .type4_count = 5, + }; + + test_acpi_one("-machine smbios-entry-point-type=64 " + "-smp cpus=100,maxcpus=120,sockets=5," + "dies=2,cores=4,threads=3", &data); + free_test_data(&data); +} + static void test_acpi_q35_tcg_core_count2(void) { test_data data = { @@ -2147,6 +2176,8 @@ int main(int argc, char *argv[]) if (has_kvm) { qtest_add_func("acpi/q35/kvm/xapic", test_acpi_q35_kvm_xapic); qtest_add_func("acpi/q35/kvm/dmar", test_acpi_q35_kvm_dmar); + qtest_add_func("acpi/q35/type4-count", + test_acpi_q35_tcg_type4_count); qtest_add_func("acpi/q35/core-count2", test_acpi_q35_tcg_core_count2); } From patchwork Wed Oct 18 15:54:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1850996 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=IITV2s/F; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9b9F0qMHz20Pd for ; Thu, 19 Oct 2023 02:58:09 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8sW-000152-Mo; Wed, 18 Oct 2023 11:54:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8sV-0000w4-7y for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8sR-0006TI-Ql for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644471; 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=/dyAdtMXs5MOlnY+c0RKRlUAiX3zrFFL27lez8xm9p4=; b=IITV2s/Fctrdu2HiYORqaSuxuS/lVho5OM5T5aumfNmebKi/x2HpqblxLU7IDWLrCZiylL TTqrqIIDZfSlKMbtzyC0khXEeSsKWSxiyt/y9VJ6vIlAHTuJ2FVzyPa6D8MLuZkGS+Qg/Y 7YfCnmECIoP4yzo1crRSAwa1r+FWYu0= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-657-u-ACO80uPMm_w1jH0Cz6Pw-1; Wed, 18 Oct 2023 11:54:29 -0400 X-MC-Unique: u-ACO80uPMm_w1jH0Cz6Pw-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-32db9cd71d7so1648704f8f.0 for ; Wed, 18 Oct 2023 08:54:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644468; x=1698249268; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/dyAdtMXs5MOlnY+c0RKRlUAiX3zrFFL27lez8xm9p4=; b=GCYO0Qm3cAfKPkUSb2clBFtQTfw9fWe73cv3B2+DZtXxk5bfzAI+XechG8K4PUOA0I 0Mwg919xKxA5z4c5g/Lv1JoEclz4bxiUuPovugDhm0tZwx47YnLYcD1Wc40OIu6dOPue 5swo/JR760PpIvMLyZBlQSAG8MO+Q+uXpFb8UjHnHZEmjEKrqhmaTb6ln0MWFPGLcKLH eLri0H7uUxqqcB//puRh8JEhE4B8jnzrUvgt+DcFQHp503H+ff3xgOW5pwJPHensw924 UbbZUwfsVPvR4xHBdrWeB4/Zwjp3lGkO+odx/umWecd7OT8+qPIkfSVxEXSXjaioobPm Xy0g== X-Gm-Message-State: AOJu0YzMXyuOYiyc3CYfflwpy8THUuDCkHHJC4mmizdH7/FE7EgbsMjT MBsCuPfW7e4o7TxoUY4FnTfydadDWt2k8ta8BRIvamIxU39wxIpHwrM79wKeQmSXEL4bXZ/KME4 +/hOKFlI6Y/BWS/Im92WzhYF0I6j3coPuwXnLu4nzs51EroFR7DeZrNBPRG41jyKN/tcFTJU= X-Received: by 2002:adf:f092:0:b0:32d:980e:ae7 with SMTP id n18-20020adff092000000b0032d980e0ae7mr5049939wro.2.1697644467714; Wed, 18 Oct 2023 08:54:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHHkr1l91JHNL+0ghIvw1XM8Cg6HmNsdltunMY9vKhCJL3FwUg3fdGvKfZNuE7+auqqb/ay3A== X-Received: by 2002:adf:f092:0:b0:32d:980e:ae7 with SMTP id n18-20020adff092000000b0032d980e0ae7mr5049906wro.2.1697644467059; Wed, 18 Oct 2023 08:54:27 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id y18-20020a5d4712000000b0031984b370f2sm2385245wrq.47.2023.10.18.08.54.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:54:26 -0700 (PDT) Date: Wed, 18 Oct 2023 11:54:22 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhao Liu , Igor Mammedov , Ani Sinha Subject: [PULL 16/83] tests: bios-tables-test: Add ACPI table binaries for smbios type4 count test Message-ID: <5b080806b8bdffca8952c2db89d1105b4df4e665.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhao Liu Following the guidelines in tests/qtest/bios-tables-test.c, this is step 5 and 6. Changes in the tables: FACP: +/* + * Intel ACPI Component Architecture + * AML/ASL+ Disassembler version 20200925 (64-bit version) + * Copyright (c) 2000 - 2020 Intel Corporation + * + * Disassembly of /tmp/aml-W37791, Wed Aug 23 10:36:32 2023 + * + * ACPI Data Table [FACP] + * + * Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue + */ + +[000h 0000 4] Signature : "FACP" [Fixed ACPI Description Table (FADT)] +[004h 0004 4] Table Length : 000000F4 +[008h 0008 1] Revision : 03 +[009h 0009 1] Checksum : B3 +[00Ah 0010 6] Oem ID : "BOCHS " +[010h 0016 8] Oem Table ID : "BXPC " +[018h 0024 4] Oem Revision : 00000001 +[01Ch 0028 4] Asl Compiler ID : "BXPC" +[020h 0032 4] Asl Compiler Revision : 00000001 + +[024h 0036 4] FACS Address : 00000000 +[028h 0040 4] DSDT Address : 00000000 +[02Ch 0044 1] Model : 01 +[02Dh 0045 1] PM Profile : 00 [Unspecified] +[02Eh 0046 2] SCI Interrupt : 0009 +[030h 0048 4] SMI Command Port : 000000B2 +[034h 0052 1] ACPI Enable Value : 02 +[035h 0053 1] ACPI Disable Value : 03 +[036h 0054 1] S4BIOS Command : 00 +[037h 0055 1] P-State Control : 00 +[038h 0056 4] PM1A Event Block Address : 00000600 +[03Ch 0060 4] PM1B Event Block Address : 00000000 +[040h 0064 4] PM1A Control Block Address : 00000604 +[044h 0068 4] PM1B Control Block Address : 00000000 +[048h 0072 4] PM2 Control Block Address : 00000000 +[04Ch 0076 4] PM Timer Block Address : 00000608 +[050h 0080 4] GPE0 Block Address : 00000620 +[054h 0084 4] GPE1 Block Address : 00000000 +[058h 0088 1] PM1 Event Block Length : 04 +[059h 0089 1] PM1 Control Block Length : 02 +[05Ah 0090 1] PM2 Control Block Length : 00 +[05Bh 0091 1] PM Timer Block Length : 04 +[05Ch 0092 1] GPE0 Block Length : 10 +[05Dh 0093 1] GPE1 Block Length : 00 +[05Eh 0094 1] GPE1 Base Offset : 00 +[05Fh 0095 1] _CST Support : 00 +[060h 0096 2] C2 Latency : 0FFF +[062h 0098 2] C3 Latency : 0FFF +[064h 0100 2] CPU Cache Size : 0000 +[066h 0102 2] Cache Flush Stride : 0000 +[068h 0104 1] Duty Cycle Offset : 00 +[069h 0105 1] Duty Cycle Width : 00 +[06Ah 0106 1] RTC Day Alarm Index : 00 +[06Bh 0107 1] RTC Month Alarm Index : 00 +[06Ch 0108 1] RTC Century Index : 32 +[06Dh 0109 2] Boot Flags (decoded below) : 0002 + Legacy Devices Supported (V2) : 0 + 8042 Present on ports 60/64 (V2) : 1 + VGA Not Present (V4) : 0 + MSI Not Supported (V4) : 0 + PCIe ASPM Not Supported (V4) : 0 + CMOS RTC Not Present (V5) : 0 +[06Fh 0111 1] Reserved : 00 +[070h 0112 4] Flags (decoded below) : 000484A5 + WBINVD instruction is operational (V1) : 1 + WBINVD flushes all caches (V1) : 0 + All CPUs support C1 (V1) : 1 + C2 works on MP system (V1) : 0 + Control Method Power Button (V1) : 0 + Control Method Sleep Button (V1) : 1 + RTC wake not in fixed reg space (V1) : 0 + RTC can wake system from S4 (V1) : 1 + 32-bit PM Timer (V1) : 0 + Docking Supported (V1) : 0 + Reset Register Supported (V2) : 1 + Sealed Case (V3) : 0 + Headless - No Video (V3) : 0 + Use native instr after SLP_TYPx (V3) : 0 + PCIEXP_WAK Bits Supported (V4) : 0 + Use Platform Timer (V4) : 1 + RTC_STS valid on S4 wake (V4) : 0 + Remote Power-on capable (V4) : 0 + Use APIC Cluster Model (V4) : 1 + Use APIC Physical Destination Mode (V4) : 0 + Hardware Reduced (V5) : 0 + Low Power S0 Idle (V5) : 0 + +[074h 0116 12] Reset Register : [Generic Address Structure] +[074h 0116 1] Space ID : 01 [SystemIO] +[075h 0117 1] Bit Width : 08 +[076h 0118 1] Bit Offset : 00 +[077h 0119 1] Encoded Access Width : 00 [Undefined/Legacy] +[078h 0120 8] Address : 0000000000000CF9 + +[080h 0128 1] Value to cause reset : 0F +[081h 0129 2] ARM Flags (decoded below) : 0000 + PSCI Compliant : 0 + Must use HVC for PSCI : 0 + +[083h 0131 1] FADT Minor Revision : 00 +[084h 0132 8] FACS Address : 0000000000000000 +[08Ch 0140 8] DSDT Address : 0000000000000000 +[094h 0148 12] PM1A Event Block : [Generic Address Structure] +[094h 0148 1] Space ID : 01 [SystemIO] +[095h 0149 1] Bit Width : 20 +[096h 0150 1] Bit Offset : 00 +[097h 0151 1] Encoded Access Width : 00 [Undefined/Legacy] +[098h 0152 8] Address : 0000000000000600 + +[0A0h 0160 12] PM1B Event Block : [Generic Address Structure] +[0A0h 0160 1] Space ID : 00 [SystemMemory] +[0A1h 0161 1] Bit Width : 00 +[0A2h 0162 1] Bit Offset : 00 +[0A3h 0163 1] Encoded Access Width : 00 [Undefined/Legacy] +[0A4h 0164 8] Address : 0000000000000000 + +[0ACh 0172 12] PM1A Control Block : [Generic Address Structure] +[0ACh 0172 1] Space ID : 01 [SystemIO] +[0ADh 0173 1] Bit Width : 10 +[0AEh 0174 1] Bit Offset : 00 +[0AFh 0175 1] Encoded Access Width : 00 [Undefined/Legacy] +[0B0h 0176 8] Address : 0000000000000604 + +[0B8h 0184 12] PM1B Control Block : [Generic Address Structure] +[0B8h 0184 1] Space ID : 00 [SystemMemory] +[0B9h 0185 1] Bit Width : 00 +[0BAh 0186 1] Bit Offset : 00 +[0BBh 0187 1] Encoded Access Width : 00 [Undefined/Legacy] +[0BCh 0188 8] Address : 0000000000000000 + +[0C4h 0196 12] PM2 Control Block : [Generic Address Structure] +[0C4h 0196 1] Space ID : 00 [SystemMemory] +[0C5h 0197 1] Bit Width : 00 +[0C6h 0198 1] Bit Offset : 00 +[0C7h 0199 1] Encoded Access Width : 00 [Undefined/Legacy] +[0C8h 0200 8] Address : 0000000000000000 + +[0D0h 0208 12] PM Timer Block : [Generic Address Structure] +[0D0h 0208 1] Space ID : 01 [SystemIO] +[0D1h 0209 1] Bit Width : 20 +[0D2h 0210 1] Bit Offset : 00 +[0D3h 0211 1] Encoded Access Width : 00 [Undefined/Legacy] +[0D4h 0212 8] Address : 0000000000000608 + +[0DCh 0220 12] GPE0 Block : [Generic Address Structure] +[0DCh 0220 1] Space ID : 01 [SystemIO] +[0DDh 0221 1] Bit Width : 80 +[0DEh 0222 1] Bit Offset : 00 +[0DFh 0223 1] Encoded Access Width : 00 [Undefined/Legacy] +[0E0h 0224 8] Address : 0000000000000620 + +[0E8h 0232 12] GPE1 Block : [Generic Address Structure] +[0E8h 0232 1] Space ID : 00 [SystemMemory] +[0E9h 0233 1] Bit Width : 00 +[0EAh 0234 1] Bit Offset : 00 +[0EBh 0235 1] Encoded Access Width : 00 [Undefined/Legacy] +[0ECh 0236 8] Address : 0000000000000000 + ... APIC: +/* + * Intel ACPI Component Architecture + * AML/ASL+ Disassembler version 20200925 (64-bit version) + * Copyright (c) 2000 - 2020 Intel Corporation + * + * Disassembly of /tmp/aml-687791, Wed Aug 23 10:36:32 2023 + * + * ACPI Data Table [APIC] + * + * Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue + */ + +[000h 0000 4] Signature : "APIC" [Multiple APIC Description Table (MADT)] +[004h 0004 4] Table Length : 00000430 +[008h 0008 1] Revision : 03 +[009h 0009 1] Checksum : C5 +[00Ah 0010 6] Oem ID : "BOCHS " +[010h 0016 8] Oem Table ID : "BXPC " +[018h 0024 4] Oem Revision : 00000001 +[01Ch 0028 4] Asl Compiler ID : "BXPC" +[020h 0032 4] Asl Compiler Revision : 00000001 + +[024h 0036 4] Local Apic Address : FEE00000 +[028h 0040 4] Flags (decoded below) : 00000001 + PC-AT Compatibility : 1 + +[02Ch 0044 1] Subtable Type : 00 [Processor Local APIC] +[02Dh 0045 1] Length : 08 +[02Eh 0046 1] Processor ID : 00 +[02Fh 0047 1] Local Apic ID : 00 +[030h 0048 4] Flags (decoded below) : 00000001 + Processor Enabled : 1 + Runtime Online Capable : 0 + +[034h 0052 1] Subtable Type : 00 [Processor Local APIC] +[035h 0053 1] Length : 08 +[036h 0054 1] Processor ID : 01 +[037h 0055 1] Local Apic ID : 01 +[038h 0056 4] Flags (decoded below) : 00000001 + Processor Enabled : 1 + Runtime Online Capable : 0 [snip] +[3E4h 0996 1] Subtable Type : 00 [Processor Local APIC] +[3E5h 0997 1] Length : 08 +[3E6h 0998 1] Processor ID : 77 +[3E7h 0999 1] Local Apic ID : 9E +[3E8h 1000 4] Flags (decoded below) : 00000000 + Processor Enabled : 0 + Runtime Online Capable : 0 + +[3ECh 1004 1] Subtable Type : 01 [I/O APIC] +[3EDh 1005 1] Length : 0C +[3EEh 1006 1] I/O Apic ID : 00 +[3EFh 1007 1] Reserved : 00 +[3F0h 1008 4] Address : FEC00000 +[3F4h 1012 4] Interrupt : 00000000 + +[3F8h 1016 1] Subtable Type : 02 [Interrupt Source Override] +[3F9h 1017 1] Length : 0A +[3FAh 1018 1] Bus : 00 +[3FBh 1019 1] Source : 00 +[3FCh 1020 4] Interrupt : 00000002 +[400h 1024 2] Flags (decoded below) : 0000 + Polarity : 0 + Trigger Mode : 0 + +[402h 1026 1] Subtable Type : 02 [Interrupt Source Override] +[403h 1027 1] Length : 0A +[404h 1028 1] Bus : 00 +[405h 1029 1] Source : 05 +[406h 1030 4] Interrupt : 00000005 +[40Ah 1034 2] Flags (decoded below) : 000D + Polarity : 1 + Trigger Mode : 3 + +[40Ch 1036 1] Subtable Type : 02 [Interrupt Source Override] +[40Dh 1037 1] Length : 0A +[40Eh 1038 1] Bus : 00 +[40Fh 1039 1] Source : 09 +[410h 1040 4] Interrupt : 00000009 +[414h 1044 2] Flags (decoded below) : 000D + Polarity : 1 + Trigger Mode : 3 + +[416h 1046 1] Subtable Type : 02 [Interrupt Source Override] +[417h 1047 1] Length : 0A +[418h 1048 1] Bus : 00 +[419h 1049 1] Source : 0A +[41Ah 1050 4] Interrupt : 0000000A +[41Eh 1054 2] Flags (decoded below) : 000D + Polarity : 1 + Trigger Mode : 3 + +[420h 1056 1] Subtable Type : 02 [Interrupt Source Override] +[421h 1057 1] Length : 0A +[422h 1058 1] Bus : 00 +[423h 1059 1] Source : 0B +[424h 1060 4] Interrupt : 0000000B +[428h 1064 2] Flags (decoded below) : 000D + Polarity : 1 + Trigger Mode : 3 + +[42Ah 1066 1] Subtable Type : 04 [Local APIC NMI] +[42Bh 1067 1] Length : 06 +[42Ch 1068 1] Processor ID : FF +[42Dh 1069 2] Flags (decoded below) : 0000 + Polarity : 0 + Trigger Mode : 0 +[42Fh 1071 1] Interrupt Input LINT : 01 + ... DSDT: +/* + * Intel ACPI Component Architecture + * AML/ASL+ Disassembler version 20200925 (64-bit version) + * Copyright (c) 2000 - 2020 Intel Corporation + * + * Disassembling to symbolic ASL+ operators + * + * Disassembly of /tmp/aml-8G8791, Wed Aug 23 10:36:32 2023 + * + * Original Table Header: + * Signature "DSDT" + * Length 0x0000489D (18589) + * Revision 0x01 **** 32-bit table (V1), no 64-bit math support + * Checksum 0xDB + * OEM ID "BOCHS " + * OEM Table ID "BXPC " + * OEM Revision 0x00000001 (1) + * Compiler ID "BXPC" + * Compiler Version 0x00000001 (1) + */ +DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ", 0x00000001) +{ + Scope (\) + { + OperationRegion (DBG, SystemIO, 0x0402, One) + Field (DBG, ByteAcc, NoLock, Preserve) + { + DBGB, 8 + } + + Method (DBUG, 1, NotSerialized) + { + ToHexString (Arg0, Local0) + ToBuffer (Local0, Local0) + Local1 = (SizeOf (Local0) - One) + Local2 = Zero + While ((Local2 < Local1)) + { + DBGB = DerefOf (Local0 [Local2]) + Local2++ + } + + DBGB = 0x0A + } + } + [snip] + + Processor (C000, 0x00, 0x00000000, 0x00) + { + Method (_STA, 0, Serialized) // _STA: Status + { + Return (CSTA (Zero)) + } + + Name (_MAT, Buffer (0x08) // _MAT: Multiple APIC Table Entry + { + 0x00, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 // ........ + }) + Method (_OST, 3, Serialized) // _OST: OSPM Status Indication + { + COST (Zero, Arg0, Arg1, Arg2) + } + } + + Processor (C001, 0x01, 0x00000000, 0x00) + { + Method (_STA, 0, Serialized) // _STA: Status + { + Return (CSTA (One)) + } + + Name (_MAT, Buffer (0x08) // _MAT: Multiple APIC Table Entry + { + 0x00, 0x08, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00 // ........ + }) + Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device, x=0-9 + { + CEJ0 (One) + } + + Method (_OST, 3, Serialized) // _OST: OSPM Status Indication + { + COST (One, Arg0, Arg1, Arg2) + } + } [snip] + Processor (C077, 0x77, 0x00000000, 0x00) + { + Method (_STA, 0, Serialized) // _STA: Status + { + Return (CSTA (0x77)) + } + + Name (_MAT, Buffer (0x08) // _MAT: Multiple APIC Table Entry + { + 0x00, 0x08, 0x77, 0x9E, 0x01, 0x00, 0x00, 0x00 // ..w..... + }) + Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device, x=0-9 + { + CEJ0 (0x77) + } + + Method (_OST, 3, Serialized) // _OST: OSPM Status Indication + { + COST (0x77, Arg0, Arg1, Arg2) + } + } + } + } + ... Signed-off-by: Zhao Liu Message-Id: <20230928125943.1816922-5-zhao1.liu@linux.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/q35/APIC.type4-count | Bin 0 -> 1072 bytes tests/data/acpi/q35/DSDT.type4-count | Bin 0 -> 18589 bytes tests/data/acpi/q35/FACP.type4-count | Bin 0 -> 244 bytes 4 files changed, 3 deletions(-) diff --git a/tests/data/acpi/q35/APIC.type4-count b/tests/data/acpi/q35/APIC.type4-count index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..ab60a6ef065d8ce53ae93d311d3777d2d4afb9f6 100644 GIT binary patch literal 1072 zcmXxjX)mKu7{>9_YU}A{8~a-OZpzsAwwBgf>(n~-!C>rL5ClOG1VQjwyzxDJ5_Ev|p!(#Wi9Ts`1gb+$r6yp8Et0V-fRH#;?j|Meb z)apP55|BH3=GAfaQqR0!I2mejiE6Z7K`EDe+elf zo_%BjMkQf%GRCA}Y#PR;qa_35voIkW6LT=hipjZ{l834Jm{x%4g_u!{nI)K2irM9u zQ-MD#(OQkUHq5i*uNus+#ezC4bYhVUiyN?{2}_%?tOd*6SkZ=+?O4@`)m>=oM!N?c zJy_F=wf$H(fc1mu975MHHjH577&eV#^8~g`V(S#Tr?G7Y+h?(34m;8of!Q`;?#f0%hq@0RR91 literal 0 HcmV?d00001 diff --git a/tests/data/acpi/q35/DSDT.type4-count b/tests/data/acpi/q35/DSDT.type4-count index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..edc23198cdb47a981bcbc82bc8e392b815abb554 100644 GIT binary patch literal 18589 zcmb81No*V0c804+N}`ICL`n1{%eE}fGfB;!$s#FI5@m{%JW)2O!M5a)9%Q$>+4U|Byj2$2yloJ?UOnfWdvDb}b*~J>UQquj zp7Wh^io+pqT{B%yPyZ%o80PO%m+V}*Cv~-G_rO2XFbvfAHnGGDhW6p``HYB^P{ ztmfN_c0LxY=JM%q@<%HetlC`pgVmXQ+K5gxRWFt8z}tIc6)auroFKdPY2fEkpT21wi2A|Pl)Zi@KH;lRZ9KW-&I-D*gZPs~9 zak3b*V{rqzFO}Q(Slz$aW*A{S<@oO(-@kwVuUs0DmquhFdJ<0_p18{EqFtUgL+`>? zu<|B?h7HGOdf+DAQ+Zv^jKM?o?_nzdj};nrDwY|8J5rN{k{SAuhoNDoCT9vg#eDi| zPsL14*yBd@K+(>O`6~O+djGz@gdX*m=CXl|${{?wVMLE5A!ai#WYzJeCVXqrRCAG? z&vfHQolrPyn1r1`xG{}+co<%-%^Pd;VK_JMjaPH#+^e~lrqv`*@cIGI*;fGddHyg2 zi+MY1M8j41Yu1<0imYBX@%%>Y-?Qgtu{2%m7=QY@BNPZhu8GOA3oNB)GCjFfr1}5@3-|1pyZ6xCVHnQ#_co&jwGQ4J^`eZQzkk@nF(E z8$EqCvPj3Z(c34Ow9h6_pG}@Vo4kF3N&5_X`V4yd40`(nllIx{>9g6>XS26YFlnEb zr%%h%r{(PvOxkD2(`U%jXUN+pn6%HZr_Zpb&#<>oFlnDHo<3VVeYSY}1e5mJ>glu9 z(`T!pc6j>i z@b(EN?X%O2s^M zPcUhpFvj?M7JFCP=IL{rw@)x>pW8isZuj)L-P;N> zr1KuXn?*YB@w<7X^TrJ(Mmm#Zk0<9IPtHBwoM7^tK^UM(GC)Vmc}UHMsRxi5=^0ZLqPfO1zBi31c&r%xE5+?Ped041(CK)EZ6!~qJX(eOV+7P~wUMl)JJ>9H3x2eZm0czAO?3C~?IB%3WC`4p1vWsxvIi7O6J?#d!@fP(4t2?Lb-vPc-9#1#i9cV&?{ zK*4nSgaOKZStJZl;)(;5yRt|epkO+E!T{yIED{DNam4}3U0Ea!P%xc7VSsX976}8C zxZ(iit}GGBn(gzi35~G z;s7O)FhEHp3{Vn@1C&JK040$yKuIJFP!fp)ltkhHC6O>d!Ezp57@%OmBgRf94p1=R zVQ@^0bj~ddP_UeH3j-7^=iK4|1=BgVI6%RKHIS|BoisMEgkotb z8Evno^JU`|YU?#S(uNBf=wX+by{%d>?x8x#j>ZMKAJrh z-8_4$vRc62`C1IDLW$lj-$$gkNqU>5x0Uqv2h!UjeOhVWf)%j;_qk7#^l6qpt)x$X zAbnb-%GACW#o(q~xujFLX{f%F-XKC7m0_=xmbl0M7QXO;BX52VkE^rLF}#*aup zO45(A^rK4p(GR2_73p(o`lgRapCjpWEPYN%pZh@i9HbB6+mV_+!qYo%9`MlsUhaHx z(t9l0$X@dB2Vd6$r@oA>b}tS-FK9S^Y*U=}y6o`c;6sFlczna6Aj0YZHm*Lr`x{?ZNvxEZYARw!)P+ zhtWtHJ$5lOY1;Y8vT2tJmrYoDkKs+$H2k(*NW=1e2YUMLa%Q3j+|$YF9$2@|Pv(Pl z0}obKzxXHLEW0!S74a%XKk*pW!7r>dL^Idz>FhP%y0x}sd|^Yk%P38h@#Xc<+LGl% zo#5J!x{vDs>VB>pP!Dk3h1m-HdvKYYTOf>k#S`*J0E)*Da{iT(_dm zaNUMF%XI{F9LmR<+fj@9J5Y=IJ5h`Jqo_swTTqMox1tvHZ$mBW-;P?;zXP?XzYDdf zeZAT|1Q*`{@tiW{d-W0`g=epME!eFi~4&}i~9GW7WMB(E$TmjTGW3KwW$9P zYEl1T)S~_)s73upQH%PIp%(QYM=k0 z??)}_A3!bYA4DzcA3`naA4Vs6T^R)SpEy>K{cd>d&DT_2*HG`o~a<`o~d=`X^9}`U|K< z{gbFg{g+US`ir0kMEz5!Mg1kzqW&^!QU5e*QU45TQU7JsqW&wWMg3P%i~6sj7WH38 zE$XkJ7WL1f7WLmiE$Y9CTGU@fE$Xj<9u)P@p%(SeqZaiqpceHnq89bvLM`gQjat-y z2eqhw3ALzy8MUbYE^1N#J=CK9`=~|z4^WHxAEFlZKSC|)uY(>E^*=@}>VJY-)c+K< zsQ(#iQU3~RQU7z)qW%}ChnAzcM!1-pY_9B^Jr$tS2d4^Nja3iB1gPWn={5BZoGW#! z4X(m!_e_j$)S`t3oHZYp$W&24*pwd~-D;QZ$>0at2-=gGD;>V~bz`A!F8+||SX(sf z#$w&9)s49y3gKU_)y!`ftWTh``huF1b*vtQQMtbDTlFXm%Z1;rH?PfE?;+1`>zm!b zzF#|aIF0KIUt*DS#>yO&_5INLfab>LHH_2+%U{>d4BQEED+{MEZP z!_bc5hb{vzw!;%UxPeb^_*ha%PPd1wpaJX2xJnUih5a7WA#BE2TE1KPJQIM>I9tH* zgu>#08)}*?G*lHInqnrwm<*FcOad+lV2&190e;JOIX)lbgk6s1gRfFfJ(f?B`rrz? zN`g&te4639?N@|p(A-KSxlHkj&OKM_EQ}C2<9yzOtlA0uG7@i<13APKlq@bnN z6r`k}B#p37|K4XoGa)szoj0_mW=d+7q$DneDQDawB&$WO$)Y4nl2W*&rjSB}6lzsT zAxa8Kk_}&*R8p9b!V#4erlhbWrQrgGN@^jbmUflYLP;%>lz|HxDyfx_T02xyD6cVg)xTI*8 zN{UiaRFVd8p+X_S@`g*=(yfxVP|_Aj8pJgUg#;@bE@|s7m9&+Two1|vE>9>VSk!Py z+jgs@ZIrZ4l7``ei%Qx~NZZ*~O8Ty{oszao(g<9DQAs-pX~$l*rX7^DLz0rPqd_Hg z5mHyLO6sDdE=fwk1savKlaO}qS4lf5X{RLFaKT0;brVwe0hQEEN!^l^h6^|l+-IpefxCMK0?}eQYG!9qFn2-(+sHDS`bXbx`j_9N#gmh$3B^{xpBa)Ons*{cq($Qg+ zbd-{gN>b{WPC7n z*K3LsQaq`W;*=DZq(nj|B?u{zQb`F)N=Q;)pHAu{q`tID>Z7DSN$T&{N&SS>pHWHu zl+-Ut0|Po~fRF~@S^<2NA>XA2C}}{F1_yQ0AR!IrRMH?N4NB6`kWLyRq@lb@8lt2j zNg5v3NyCIRJf@O{DQQ@eMn-hf2qBG3sH71}8j+;rX`OVMkWLp=(rHRMElH^}I_V4{ zotacgXDI26B-v+m(pf?}TU1GBDe0^vrO)Z4bA)tmN+q46q;ry#Ij@t>6VmyTN;*$T z=Orn7K_^`xqzlt3=>jEPa7q2Ki#q8dAzhqNNf#;Uq9nzWItebByYF<#%PJ{JNl8gc zq;wKoEq6(&t11aMvAF9`DM{+HbrM`CcS-g&m4y3IT#_wG{b`*9*T`K``npQOttBog zElC3zodlOvT~cONCE+d+mz0sD!K_Y#E8{LHdqXARh7XsNm879jodg%fUDD`Hm4tgY zT+*l{4d-+cTn~3ixtdDCZ5S>oCrKlDos=h}{G3Y4Q&L`%l4Ck)jF86WRnizGjY(2! zTqlha()glE8mFXjNwOz&(gYz*+)_yslr$kp>4HvzjRWo(FWgp11xhMNQf5*oO%l@N zl1iGSq)AE2UeZaI2V7 zlr$wtiIPq#5mM=aN-9xONs{`?ItjKUxQ|`=p-L)KQdyGvr*#tS7;#C{b(J(tNz;-v zFr$-Z2x;cAN}8dh8A%$vtdlMi(&Z;A=`tlx6Xu6P0wGlCDcqs-lxBgj9K{k}8x` zktBOoC(RPl?58SemXc;ADSbmH-5{hJf1;9ZP|^)a%G}gRHwo$HE0uJUl5R>;wyKk= zgjD@gl~kpqs!JM-)pSygkZP}0QjL;ok`$lQNpplW_eLenQPP|wCFXU~JR!}ms-$^J znwO-$1)a1&NDF_ak`^dwL6Z6xbF!^uq`Q=KSCUfqbkaRSy7yNq=^iEBlO+4TPP$J>_kXF9?o-lz zNlHJ^Ne>9=!PhG30VO?WnB|V{}Cz90nR3|+pq^Eza zlAco1Q%UN7rjwo#(zCx&NzW+hnIsLY=%f`wTKQX*v_eTMk~H{SCp{;m=f6=&&nfA- zBn`dLNiPWL#owu<7nJk@NYS0JX%;pBS2MAMA-4MB23p*=6e(=sJ8Ic4L9p$^V~pTH z+5zYj7HQ$vR@iTjBw?d7-@}Z@$>wF)o;{tkU;_efm}Z-odm4KhP5AYZ%Ia94m@C4! z0v!S;X_Jl6I_q8dUD(_X8?TSdLi%!FwWBd$LhYdYs~y3B<+EU;4p;+t54I6GBOiv! z>dEXC8Jj26h%D&|9fE(hzCD?beaZ&RN_*7b$e%qgYuDm18mZOq5KQpqr!R z*f2NX5i0p@7b#<*anxgB!W?r753Pv%(QOz>-wnoId5pH0X)< zn)v^l;QwMxrSQhan{?2CZR}GS)LFb4#hYBPvf4kMN<%UH$8h|xp9p(`?G5-SY`3#&E4 z_(rUjQS%f3C;nit_cbFY>`MhVrUAS+kNMgEv)>5zMp(>&(zNYX6M{TgJVV!wx?u); k4HL_0D`%79y!#9|m3SZ}4*20fB#f^~_-_Ll_+6a;1CLN!@c;k- literal 0 HcmV?d00001 diff --git a/tests/data/acpi/q35/FACP.type4-count b/tests/data/acpi/q35/FACP.type4-count index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..31fa5dd19c213034eef4eeefa6a04e61dadd8a2a 100644 GIT binary patch literal 244 zcmZ>BbPo8!z`($~*~#D8BUr&HBEVSz2pEB4AU24G0Y(N+hD|^Y6El!tgNU*~X%LSC z$X0-fGcm9T0LA|E|L2FOWMD92VqjR>!otAF!NBm72Obk1 YBHITON2VDSAnpK(F*YFF1LDH~0O^Si0RR91 literal 0 HcmV?d00001 diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index 0ce6f8fc72..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/q35/APIC.type4-count", -"tests/data/acpi/q35/DSDT.type4-count", -"tests/data/acpi/q35/FACP.type4-count", From patchwork Wed Oct 18 15:54:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851034 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gcavAWjn; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bpH2pzZz20cx for ; Thu, 19 Oct 2023 03:26:47 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8sZ-0001KA-Ev; Wed, 18 Oct 2023 11:54:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8sX-00018N-TQ for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8sW-0006Th-B6 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644475; 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=2FZerVplP7gF2hzMNBoK9F/KJJRCWXJvDhhnD1MB+o4=; b=gcavAWjnhpf8q6zNegCd42/JFDOITRHC5iFOzMqbjSpW3beebbfrJfXs3sfqI9MWNDIQ0m xLuaDqXy7P7+9c9CdPqEHVvqAem2Bj72zJ6h4+eZNZ4dtddhyNzxX1oP8hy3n1vcfiKG8s VM6K6o1/ygtC+KAAeUu0nZayPcgMzek= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-662-mT8JcWc0PP-zxQST3Q7WQg-1; Wed, 18 Oct 2023 11:54:33 -0400 X-MC-Unique: mT8JcWc0PP-zxQST3Q7WQg-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-32db43129c6so2127029f8f.1 for ; Wed, 18 Oct 2023 08:54:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644471; x=1698249271; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=2FZerVplP7gF2hzMNBoK9F/KJJRCWXJvDhhnD1MB+o4=; b=FX5D+3pEbt07sReJe1vzKVypwnMAiPvph11/b7Aaq/A3JVbmmjHYDEQwig6xOrU9BZ Rx+HlAO/zyXMvatNKFTEf42dc5BiHA6bGvn/uelWa61Oz0+SS7cH1GPzauEOi5WPFgmx vhMU11KsdprUFpnXGz9jSXKGE14bsNTq6u1MBbIaB00jcyHMzomRSzTCtUa2afg0N/vO z/vxXe4MBB0obCVJj0h9M1rFWcY0bWCyciJ3h5iJ6qAWXMxgIw9CQ3rUQlQCVY/+Wij/ VyWhExOYupeZlGy3+BJ2N+4h0JSc4oawcpWw3e8D0clmB8Tp2GlBhb2sEH6MYGsfYfmE 479g== X-Gm-Message-State: AOJu0YxP7JQ3+tVyCl4nkpWgNSA7V4Sf0S7GthGhV32bl9iaC4ohD5oQ DdJw402+TRWwcQoLmYkGqTj4t/PqTbeOzZmDkhhROZFSdsWKZFNX/lvCRLVPIF0cZn43ma9FLFV 8rlpVBEFFvLm2u/zAIAKj0caGQy3/lxKQCox5RWADoIi2LkI+S3H3L9K1+BPaso39Md2OK0o= X-Received: by 2002:a5d:4390:0:b0:32d:857c:d546 with SMTP id i16-20020a5d4390000000b0032d857cd546mr4683009wrq.64.1697644471747; Wed, 18 Oct 2023 08:54:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFW/p2zYE9RznmzeGGNWUqxfAel3ynd4jzso9lHf9ymaLOvcjkt+EwoGjPh03Dz0yDw6+k2MA== X-Received: by 2002:a5d:4390:0:b0:32d:857c:d546 with SMTP id i16-20020a5d4390000000b0032d857cd546mr4682994wrq.64.1697644471268; Wed, 18 Oct 2023 08:54:31 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id x8-20020adfec08000000b00326f0ca3566sm2392180wrn.50.2023.10.18.08.54.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:54:30 -0700 (PDT) Date: Wed, 18 Oct 2023 11:54:27 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhao Liu , Igor Mammedov , Ani Sinha Subject: [PULL 17/83] tests: bios-tables-test: Prepare the ACPI table change for smbios type4 core count test Message-ID: <7b2522a83f744f8fbadfa03c05c2076b5d12535c.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhao Liu Following the guidelines in tests/qtest/bios-tables-test.c, this is step 1 - 3. List the ACPI tables that will be added to test the type 4 core count field. Signed-off-by: Zhao Liu Message-Id: <20230928125943.1816922-6-zhao1.liu@linux.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/q35/APIC.core-count | 0 tests/data/acpi/q35/DSDT.core-count | 0 tests/data/acpi/q35/FACP.core-count | 0 4 files changed, 3 insertions(+) create mode 100644 tests/data/acpi/q35/APIC.core-count create mode 100644 tests/data/acpi/q35/DSDT.core-count create mode 100644 tests/data/acpi/q35/FACP.core-count diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..b9bc196130 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/q35/APIC.core-count", +"tests/data/acpi/q35/DSDT.core-count", +"tests/data/acpi/q35/FACP.core-count", diff --git a/tests/data/acpi/q35/APIC.core-count b/tests/data/acpi/q35/APIC.core-count new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/q35/DSDT.core-count b/tests/data/acpi/q35/DSDT.core-count new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/q35/FACP.core-count b/tests/data/acpi/q35/FACP.core-count new file mode 100644 index 0000000000..e69de29bb2 From patchwork Wed Oct 18 15:54:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851001 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=jJeZ+7Pn; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bCq0wsFz20cx for ; Thu, 19 Oct 2023 03:00:23 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8sb-0001VF-5N; Wed, 18 Oct 2023 11:54:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8sa-0001O6-7Y for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8sY-0006U2-Is for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644478; 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=e8B8UMg5FgaD2nE0alqJMY1VMfzRw0D7N1lubTBicmU=; b=jJeZ+7PnZ6jHDFOKAKm/5dDJsKAm1c2zVZDQc1f+TgwIMVlQ3fb45U40L39mzdAs3TDyRr +oS/dNVbhsFEe87MsQ8xxRdgIthf/BdyWrzzxSif4oqoOVNQcyKa/4Q8T8pRu91SD9VgIw 8NWFwn/1IOBmKSVGNNwqVornJOUQQak= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-376--USTYwS0P2WwNp2i2xZ_3w-1; Wed, 18 Oct 2023 11:54:36 -0400 X-MC-Unique: -USTYwS0P2WwNp2i2xZ_3w-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-40839252e81so7339985e9.3 for ; Wed, 18 Oct 2023 08:54:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644475; x=1698249275; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=e8B8UMg5FgaD2nE0alqJMY1VMfzRw0D7N1lubTBicmU=; b=uSzN6ctJCAEt1AfPXmlKNZVIl2VIQYrGIjaJbRBg+PwNHchGbRzBsPwDXjmIjNVa5/ JOrEY6WQdUt9+1WUuiKpMoAt0zVsk1wMWpAYesGo68dO0i2xmN7mLpqVGctQ6a9oSl1u Ie582ICOJpB7RWqk2me2QMJR8AwFo0gYRyaSiwUNCmwu4AMLAjTgsKkkAx1UDh3Bm1Sy 6RBf0iWpeTnW5G1cpuRZonfe3sRGJuQoHGR0W4W7+n3GmrSV/f4Sm7fikB0DcvmoipnO tArzknaxO4ISs384T4XfFhW9D0iYgzS5eXpfYNuQUXet85ry5NWx3eCArkoK75o2Ru5v l0fQ== X-Gm-Message-State: AOJu0Ywrqyl7aYOsvR4qE2VRQtmKSnZ5OBDgZMq/eVZhuXpXSwWOVN6s odaWATYeNXADAAfaVLY7fIZ+r452cXu0gggjMp+qgo3HMvDDXOCs0pj/nG9twtzfYI4R6ny5scr c7KibOPwzUayKQVkiIZQ20BiRROHJufp9+FUSILIHxODCH2guKl9dsD3gHXZVnBk4U3ySrmo= X-Received: by 2002:a05:600c:190e:b0:401:c52c:5ed9 with SMTP id j14-20020a05600c190e00b00401c52c5ed9mr4618788wmq.32.1697644475185; Wed, 18 Oct 2023 08:54:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHU5H/TvLi3LaLGdItcMFH0JQa6H2+cKVh17m5tlMNI2Nu/v2t2i/w0XUMdOH+iD7ryMrpehw== X-Received: by 2002:a05:600c:190e:b0:401:c52c:5ed9 with SMTP id j14-20020a05600c190e00b00401c52c5ed9mr4618776wmq.32.1697644474927; Wed, 18 Oct 2023 08:54:34 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id r16-20020a05600c459000b00405391f485fsm2017076wmo.41.2023.10.18.08.54.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:54:34 -0700 (PDT) Date: Wed, 18 Oct 2023 11:54:31 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhao Liu , Igor Mammedov , Ani Sinha Subject: [PULL 18/83] tests: bios-tables-test: Add test for smbios type4 core count Message-ID: <91320097ee799a31facb8c6d16efacd4ddc41a3f.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhao Liu This tests the commit 196ea60a734c3 ("hw/smbios: Fix core count in type4"). In smbios_build_type_4_table() (hw/smbios/smbios.c), if the number of cores in the socket is not more than 255, then smbios type4 table encodes cores per socket into the core count field. So for the topology in this case, there're the following considerations: 1. cores per socket should be not more than 255 to ensure we could cover the core count field. 2. The original bug was that cores per socket was miscalculated, so now we should include as many topology levels as possible (mutiple sockets & dies, no module since x86 hasn't supported it) to cover more general topology scenarios, to ensure that the cores per socket encoded in the core count field is correct. Based on these considerations, select the topology with multiple sockets and dies: -smp 54,sockets=2,dies=3,cores=3,threads=3 The expected core count = cores per socket = cores (3) * dies (3) = 9. Suggested-by: Igor Mammedov Signed-off-by: Zhao Liu Message-Id: <20230928125943.1816922-7-zhao1.liu@linux.intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index cdbfb51559..c20f6f73d0 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -999,6 +999,23 @@ static void test_acpi_q35_tcg_type4_count(void) free_test_data(&data); } +static void test_acpi_q35_tcg_core_count(void) +{ + test_data data = { + .machine = MACHINE_Q35, + .variant = ".core-count", + .required_struct_types = base_required_struct_types, + .required_struct_types_len = ARRAY_SIZE(base_required_struct_types), + .smbios_core_count = 9, + .smbios_core_count2 = 9, + }; + + test_acpi_one("-machine smbios-entry-point-type=64 " + "-smp 54,sockets=2,dies=3,cores=3,threads=3", + &data); + free_test_data(&data); +} + static void test_acpi_q35_tcg_core_count2(void) { test_data data = { @@ -2178,6 +2195,8 @@ int main(int argc, char *argv[]) qtest_add_func("acpi/q35/kvm/dmar", test_acpi_q35_kvm_dmar); qtest_add_func("acpi/q35/type4-count", test_acpi_q35_tcg_type4_count); + qtest_add_func("acpi/q35/core-count", + test_acpi_q35_tcg_core_count); qtest_add_func("acpi/q35/core-count2", test_acpi_q35_tcg_core_count2); } From patchwork Wed Oct 18 15:54:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851033 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MgNJCo3G; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bnw5Zp8z20cx for ; Thu, 19 Oct 2023 03:26:28 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8tn-0002yU-Sn; Wed, 18 Oct 2023 11:55:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8ss-0002Jz-E3 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8sp-0006VN-Ad for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644494; 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=cibLSC4g5DfzF1uzGTZFBiDGn6bu3Z5ynQe7SZ/WaQs=; b=MgNJCo3GljaEUuoylx0WkU09Qit23a8livY1CHnO1AXAJBBkjPdDAN2s3QIBPkuNC6vJdy RLI9IfozYBB3NGvK4HXfHRXcvDdpjj8tMms09k4ajdeiZiLLFuIKD8uw+3NFjZzWhwDZDR ZfB+8FCq5iVVew/RhWIhB9CkiLij988= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-149-4VUiYVngOPmbMYvXNeW7hA-1; Wed, 18 Oct 2023 11:54:42 -0400 X-MC-Unique: 4VUiYVngOPmbMYvXNeW7hA-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-32da215295fso2777508f8f.2 for ; Wed, 18 Oct 2023 08:54:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644480; x=1698249280; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=cibLSC4g5DfzF1uzGTZFBiDGn6bu3Z5ynQe7SZ/WaQs=; b=L2F9Wv9fyVQzQMWVmfb3PySGUvbPNDQsHgITyKUnCj0F0d708adGamiNZgxwKsL44U o3K/7HK5oVnVwKw6yRB4Be5m6UdZSHq4JvA+UePIhVbQgkvMWYOlIOb5o2u6NUeUG+DM 3FH890bDbeaV7/jiVDkaXWl8SsgIgQHKNDtxQHh+DRWc80lNfNO4x8Fv8V/BUpdgpehQ yTicBs99C/i/O4GTlmjM4JvLO/CN+umVZz7GOK10dWPwTzrmx+FH68Z3rfgHjdqCuC0P VEFFbNE2Y1RXnV4DC3ZHYaRVnSjWwZdRfhgqi8bM4Vui90pSTpx2hQU0CyyMZhJnVkep CvJA== X-Gm-Message-State: AOJu0YzVC0pxYv0+1oWG+KR5gHvxPEBis7XZZ/avMLqkBrTB2+qyx9rl 01rxRGsdXE06mY52Q2LV1R5m8qXq5a5ZCboAUcJzETao2FRrd5WgzpkCKE/5+t/TMHbbJJCchuJ 2S1nBGKXE7WwWrzS78sXkb9Y3G+PrddV+6ngvNpN5ddj4nDqtRR9Gyu3FTmWhJNQqn5isM1o= X-Received: by 2002:adf:f551:0:b0:32d:a688:8814 with SMTP id j17-20020adff551000000b0032da6888814mr4860676wrp.19.1697644479469; Wed, 18 Oct 2023 08:54:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFqFzTrslzd28d9teRV+8DRnGyjTD8Dx+wk94jQ27iBBScE6cVsyKu7HjXKwOIH4EEyKFuauQ== X-Received: by 2002:adf:f551:0:b0:32d:a688:8814 with SMTP id j17-20020adff551000000b0032da6888814mr4860654wrp.19.1697644478916; Wed, 18 Oct 2023 08:54:38 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id d14-20020a056000114e00b003232380ffd5sm2361623wrx.106.2023.10.18.08.54.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:54:38 -0700 (PDT) Date: Wed, 18 Oct 2023 11:54:35 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhao Liu , Igor Mammedov , Ani Sinha Subject: [PULL 19/83] tests: bios-tables-test: Add ACPI table binaries for smbios type4 core count test Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhao Liu Following the guidelines in tests/qtest/bios-tables-test.c, this is step 5 and 6. Changes in the tables: FACP: +/* + * Intel ACPI Component Architecture + * AML/ASL+ Disassembler version 20200925 (64-bit version) + * Copyright (c) 2000 - 2020 Intel Corporation + * + * Disassembly of /tmp/aml-Y6WW91, Wed Aug 23 15:43:43 2023 + * + * ACPI Data Table [FACP] + * + * Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue + */ + +[000h 0000 4] Signature : "FACP" [Fixed ACPI Description Table (FADT)] +[004h 0004 4] Table Length : 000000F4 +[008h 0008 1] Revision : 03 +[009h 0009 1] Checksum : B3 +[00Ah 0010 6] Oem ID : "BOCHS " +[010h 0016 8] Oem Table ID : "BXPC " +[018h 0024 4] Oem Revision : 00000001 +[01Ch 0028 4] Asl Compiler ID : "BXPC" +[020h 0032 4] Asl Compiler Revision : 00000001 + +[024h 0036 4] FACS Address : 00000000 +[028h 0040 4] DSDT Address : 00000000 +[02Ch 0044 1] Model : 01 +[02Dh 0045 1] PM Profile : 00 [Unspecified] +[02Eh 0046 2] SCI Interrupt : 0009 +[030h 0048 4] SMI Command Port : 000000B2 +[034h 0052 1] ACPI Enable Value : 02 +[035h 0053 1] ACPI Disable Value : 03 +[036h 0054 1] S4BIOS Command : 00 +[037h 0055 1] P-State Control : 00 +[038h 0056 4] PM1A Event Block Address : 00000600 +[03Ch 0060 4] PM1B Event Block Address : 00000000 +[040h 0064 4] PM1A Control Block Address : 00000604 +[044h 0068 4] PM1B Control Block Address : 00000000 +[048h 0072 4] PM2 Control Block Address : 00000000 +[04Ch 0076 4] PM Timer Block Address : 00000608 +[050h 0080 4] GPE0 Block Address : 00000620 +[054h 0084 4] GPE1 Block Address : 00000000 +[058h 0088 1] PM1 Event Block Length : 04 +[059h 0089 1] PM1 Control Block Length : 02 +[05Ah 0090 1] PM2 Control Block Length : 00 +[05Bh 0091 1] PM Timer Block Length : 04 +[05Ch 0092 1] GPE0 Block Length : 10 +[05Dh 0093 1] GPE1 Block Length : 00 +[05Eh 0094 1] GPE1 Base Offset : 00 +[05Fh 0095 1] _CST Support : 00 +[060h 0096 2] C2 Latency : 0FFF +[062h 0098 2] C3 Latency : 0FFF +[064h 0100 2] CPU Cache Size : 0000 +[066h 0102 2] Cache Flush Stride : 0000 +[068h 0104 1] Duty Cycle Offset : 00 +[069h 0105 1] Duty Cycle Width : 00 +[06Ah 0106 1] RTC Day Alarm Index : 00 +[06Bh 0107 1] RTC Month Alarm Index : 00 +[06Ch 0108 1] RTC Century Index : 32 +[06Dh 0109 2] Boot Flags (decoded below) : 0002 + Legacy Devices Supported (V2) : 0 + 8042 Present on ports 60/64 (V2) : 1 + VGA Not Present (V4) : 0 + MSI Not Supported (V4) : 0 + PCIe ASPM Not Supported (V4) : 0 + CMOS RTC Not Present (V5) : 0 +[06Fh 0111 1] Reserved : 00 +[070h 0112 4] Flags (decoded below) : 000484A5 + WBINVD instruction is operational (V1) : 1 + WBINVD flushes all caches (V1) : 0 + All CPUs support C1 (V1) : 1 + C2 works on MP system (V1) : 0 + Control Method Power Button (V1) : 0 + Control Method Sleep Button (V1) : 1 + RTC wake not in fixed reg space (V1) : 0 + RTC can wake system from S4 (V1) : 1 + 32-bit PM Timer (V1) : 0 + Docking Supported (V1) : 0 + Reset Register Supported (V2) : 1 + Sealed Case (V3) : 0 + Headless - No Video (V3) : 0 + Use native instr after SLP_TYPx (V3) : 0 + PCIEXP_WAK Bits Supported (V4) : 0 + Use Platform Timer (V4) : 1 + RTC_STS valid on S4 wake (V4) : 0 + Remote Power-on capable (V4) : 0 + Use APIC Cluster Model (V4) : 1 + Use APIC Physical Destination Mode (V4) : 0 + Hardware Reduced (V5) : 0 + Low Power S0 Idle (V5) : 0 + +[074h 0116 12] Reset Register : [Generic Address Structure] +[074h 0116 1] Space ID : 01 [SystemIO] +[075h 0117 1] Bit Width : 08 +[076h 0118 1] Bit Offset : 00 +[077h 0119 1] Encoded Access Width : 00 [Undefined/Legacy] +[078h 0120 8] Address : 0000000000000CF9 + +[080h 0128 1] Value to cause reset : 0F +[081h 0129 2] ARM Flags (decoded below) : 0000 + PSCI Compliant : 0 + Must use HVC for PSCI : 0 + +[083h 0131 1] FADT Minor Revision : 00 +[084h 0132 8] FACS Address : 0000000000000000 +[08Ch 0140 8] DSDT Address : 0000000000000000 +[094h 0148 12] PM1A Event Block : [Generic Address Structure] +[094h 0148 1] Space ID : 01 [SystemIO] +[095h 0149 1] Bit Width : 20 +[096h 0150 1] Bit Offset : 00 +[097h 0151 1] Encoded Access Width : 00 [Undefined/Legacy] +[098h 0152 8] Address : 0000000000000600 + +[0A0h 0160 12] PM1B Event Block : [Generic Address Structure] +[0A0h 0160 1] Space ID : 00 [SystemMemory] +[0A1h 0161 1] Bit Width : 00 +[0A2h 0162 1] Bit Offset : 00 +[0A3h 0163 1] Encoded Access Width : 00 [Undefined/Legacy] +[0A4h 0164 8] Address : 0000000000000000 + +[0ACh 0172 12] PM1A Control Block : [Generic Address Structure] +[0ACh 0172 1] Space ID : 01 [SystemIO] +[0ADh 0173 1] Bit Width : 10 +[0AEh 0174 1] Bit Offset : 00 +[0AFh 0175 1] Encoded Access Width : 00 [Undefined/Legacy] +[0B0h 0176 8] Address : 0000000000000604 + +[0B8h 0184 12] PM1B Control Block : [Generic Address Structure] +[0B8h 0184 1] Space ID : 00 [SystemMemory] +[0B9h 0185 1] Bit Width : 00 +[0BAh 0186 1] Bit Offset : 00 +[0BBh 0187 1] Encoded Access Width : 00 [Undefined/Legacy] +[0BCh 0188 8] Address : 0000000000000000 + +[0C4h 0196 12] PM2 Control Block : [Generic Address Structure] +[0C4h 0196 1] Space ID : 00 [SystemMemory] +[0C5h 0197 1] Bit Width : 00 +[0C6h 0198 1] Bit Offset : 00 +[0C7h 0199 1] Encoded Access Width : 00 [Undefined/Legacy] +[0C8h 0200 8] Address : 0000000000000000 + +[0D0h 0208 12] PM Timer Block : [Generic Address Structure] +[0D0h 0208 1] Space ID : 01 [SystemIO] +[0D1h 0209 1] Bit Width : 20 +[0D2h 0210 1] Bit Offset : 00 +[0D3h 0211 1] Encoded Access Width : 00 [Undefined/Legacy] +[0D4h 0212 8] Address : 0000000000000608 + +[0DCh 0220 12] GPE0 Block : [Generic Address Structure] +[0DCh 0220 1] Space ID : 01 [SystemIO] +[0DDh 0221 1] Bit Width : 80 +[0DEh 0222 1] Bit Offset : 00 +[0DFh 0223 1] Encoded Access Width : 00 [Undefined/Legacy] +[0E0h 0224 8] Address : 0000000000000620 + +[0E8h 0232 12] GPE1 Block : [Generic Address Structure] +[0E8h 0232 1] Space ID : 00 [SystemMemory] +[0E9h 0233 1] Bit Width : 00 +[0EAh 0234 1] Bit Offset : 00 +[0EBh 0235 1] Encoded Access Width : 00 [Undefined/Legacy] +[0ECh 0236 8] Address : 0000000000000000 ... APIC: +/* + * Intel ACPI Component Architecture + * AML/ASL+ Disassembler version 20200925 (64-bit version) + * Copyright (c) 2000 - 2020 Intel Corporation + * + * Disassembly of /tmp/aml-FFXW91, Wed Aug 23 15:43:43 2023 + * + * ACPI Data Table [APIC] + * + * Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue + */ + +[000h 0000 4] Signature : "APIC" [Multiple APIC Description Table (MADT)] +[004h 0004 4] Table Length : 00000220 +[008h 0008 1] Revision : 03 +[009h 0009 1] Checksum : 3C +[00Ah 0010 6] Oem ID : "BOCHS " +[010h 0016 8] Oem Table ID : "BXPC " +[018h 0024 4] Oem Revision : 00000001 +[01Ch 0028 4] Asl Compiler ID : "BXPC" +[020h 0032 4] Asl Compiler Revision : 00000001 + +[024h 0036 4] Local Apic Address : FEE00000 +[028h 0040 4] Flags (decoded below) : 00000001 + PC-AT Compatibility : 1 + +[02Ch 0044 1] Subtable Type : 00 [Processor Local APIC] +[02Dh 0045 1] Length : 08 +[02Eh 0046 1] Processor ID : 00 +[02Fh 0047 1] Local Apic ID : 00 +[030h 0048 4] Flags (decoded below) : 00000001 + Processor Enabled : 1 + Runtime Online Capable : 0 [snip] +[1D4h 0468 1] Subtable Type : 00 [Processor Local APIC] +[1D5h 0469 1] Length : 08 +[1D6h 0470 1] Processor ID : 35 +[1D7h 0471 1] Local Apic ID : 6A +[1D8h 0472 4] Flags (decoded below) : 00000001 + Processor Enabled : 1 + Runtime Online Capable : 0 + +[1DCh 0476 1] Subtable Type : 01 [I/O APIC] +[1DDh 0477 1] Length : 0C +[1DEh 0478 1] I/O Apic ID : 00 +[1DFh 0479 1] Reserved : 00 +[1E0h 0480 4] Address : FEC00000 +[1E4h 0484 4] Interrupt : 00000000 + +[1E8h 0488 1] Subtable Type : 02 [Interrupt Source Override] +[1E9h 0489 1] Length : 0A +[1EAh 0490 1] Bus : 00 +[1EBh 0491 1] Source : 00 +[1ECh 0492 4] Interrupt : 00000002 +[1F0h 0496 2] Flags (decoded below) : 0000 + Polarity : 0 + Trigger Mode : 0 + +[1F2h 0498 1] Subtable Type : 02 [Interrupt Source Override] +[1F3h 0499 1] Length : 0A +[1F4h 0500 1] Bus : 00 +[1F5h 0501 1] Source : 05 +[1F6h 0502 4] Interrupt : 00000005 +[1FAh 0506 2] Flags (decoded below) : 000D + Polarity : 1 + Trigger Mode : 3 + +[1FCh 0508 1] Subtable Type : 02 [Interrupt Source Override] +[1FDh 0509 1] Length : 0A +[1FEh 0510 1] Bus : 00 +[1FFh 0511 1] Source : 09 +[200h 0512 4] Interrupt : 00000009 +[204h 0516 2] Flags (decoded below) : 000D + Polarity : 1 + Trigger Mode : 3 + +[206h 0518 1] Subtable Type : 02 [Interrupt Source Override] +[207h 0519 1] Length : 0A +[208h 0520 1] Bus : 00 +[209h 0521 1] Source : 0A +[20Ah 0522 4] Interrupt : 0000000A +[20Eh 0526 2] Flags (decoded below) : 000D + Polarity : 1 + Trigger Mode : 3 + +[210h 0528 1] Subtable Type : 02 [Interrupt Source Override] +[211h 0529 1] Length : 0A +[212h 0530 1] Bus : 00 +[213h 0531 1] Source : 0B +[214h 0532 4] Interrupt : 0000000B +[218h 0536 2] Flags (decoded below) : 000D + Polarity : 1 + Trigger Mode : 3 + +[21Ah 0538 1] Subtable Type : 04 [Local APIC NMI] +[21Bh 0539 1] Length : 06 +[21Ch 0540 1] Processor ID : FF +[21Dh 0541 2] Flags (decoded below) : 0000 + Polarity : 0 + Trigger Mode : 0 +[21Fh 0543 1] Interrupt Input LINT : 01 ... DSDT: +/* + * Intel ACPI Component Architecture + * AML/ASL+ Disassembler version 20200925 (64-bit version) + * Copyright (c) 2000 - 2020 Intel Corporation + * + * Disassembling to symbolic ASL+ operators + * + * Disassembly of /tmp/aml-9ZXW91, Wed Aug 23 15:43:43 2023 + * + * Original Table Header: + * Signature "DSDT" + * Length 0x00003271 (12913) + * Revision 0x01 **** 32-bit table (V1), no 64-bit math support + * Checksum 0xAF + * OEM ID "BOCHS " + * OEM Table ID "BXPC " + * OEM Revision 0x00000001 (1) + * Compiler ID "BXPC" + * Compiler Version 0x00000001 (1) + */ +DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ", 0x00000001) +{ + Scope (\) + { + OperationRegion (DBG, SystemIO, 0x0402, One) + Field (DBG, ByteAcc, NoLock, Preserve) + { + DBGB, 8 + } + + Method (DBUG, 1, NotSerialized) + { + ToHexString (Arg0, Local0) + ToBuffer (Local0, Local0) + Local1 = (SizeOf (Local0) - One) + Local2 = Zero + While ((Local2 < Local1)) + { + DBGB = DerefOf (Local0 [Local2]) + Local2++ + } + + DBGB = 0x0A + } + } [snip] + Device (\_SB.CPUS) + { + Name (_HID, "ACPI0010" /* Processor Container Device */) // _HID: Hardware ID + Name (_CID, EisaId ("PNP0A05") /* Generic Container Device */) // _CID: Compatible ID + Method (CTFY, 2, NotSerialized) + { + If ((Arg0 == Zero)) + { + Notify (C000, Arg1) + } + + If ((Arg0 == One)) + { + Notify (C001, Arg1) + } [snip] + If ((Arg0 == 0x35)) + { + Notify (C035, Arg1) + } + } [snip] + Processor (C000, 0x00, 0x00000000, 0x00) + { + Method (_STA, 0, Serialized) // _STA: Status + { + Return (CSTA (Zero)) + } + + Name (_MAT, Buffer (0x08) // _MAT: Multiple APIC Table Entry + { + 0x00, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 // ........ + }) + Method (_OST, 3, Serialized) // _OST: OSPM Status Indication + { + COST (Zero, Arg0, Arg1, Arg2) + } + } + + Processor (C001, 0x01, 0x00000000, 0x00) + { + Method (_STA, 0, Serialized) // _STA: Status + { + Return (CSTA (One)) + } + + Name (_MAT, Buffer (0x08) // _MAT: Multiple APIC Table Entry + { + 0x00, 0x08, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00 // ........ + }) + Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device, x=0-9 + { + CEJ0 (One) + } + + Method (_OST, 3, Serialized) // _OST: OSPM Status Indication + { + COST (One, Arg0, Arg1, Arg2) + } + } [snip] + Processor (C035, 0x35, 0x00000000, 0x00) + { + Method (_STA, 0, Serialized) // _STA: Status + { + Return (CSTA (0x35)) + } + + Name (_MAT, Buffer (0x08) // _MAT: Multiple APIC Table Entry + { + 0x00, 0x08, 0x35, 0x6A, 0x01, 0x00, 0x00, 0x00 // ..5j.... + }) + Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device, x=0-9 + { + CEJ0 (0x35) + } + + Method (_OST, 3, Serialized) // _OST: OSPM Status Indication + { + COST (0x35, Arg0, Arg1, Arg2) + } + } ... Signed-off-by: Zhao Liu Message-Id: <20230928125943.1816922-8-zhao1.liu@linux.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/q35/APIC.core-count | Bin 0 -> 544 bytes tests/data/acpi/q35/DSDT.core-count | Bin 0 -> 12913 bytes tests/data/acpi/q35/FACP.core-count | Bin 0 -> 244 bytes 4 files changed, 3 deletions(-) diff --git a/tests/data/acpi/q35/APIC.core-count b/tests/data/acpi/q35/APIC.core-count index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..d9d7ca9a896159791f6e74842d02786dc2608cb3 100644 GIT binary patch literal 544 zcmXxh*-pYh7(n5_rLA2+0RaKGf`EYgcISn(YQP%{EZ zC}OsRxiZdIaG{F%8W!qUO#f5d#RmIQ6U!~Ev~j6})h^b0SnuQV8LkX)HNv%XT))8Z z5*tHoj&S1&TM4$u*qPwwEq3p)caQxkZav`kBknxm?lbPa;QlKfyy4+H9(~~PC!Tz1 jjjVpV@0ngrUrimlY+ISr<$3?*s{?!sg0w8>S6%T3A7&l_ literal 0 HcmV?d00001 diff --git a/tests/data/acpi/q35/DSDT.core-count b/tests/data/acpi/q35/DSDT.core-count index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..a24b04cbdbf09383b933a42a2a15182545543a87 100644 GIT binary patch literal 12913 zcmb80O>A4)b;s}HheSP+5=BwpvPH|1Eq{unB-_)XMaV}|k}b+KDbGww1EeHRDtQ8g z&5VIK0|T}ONG1jfbVi+^OU*z5x=UBx)<8GyZgw4@t1i09HVEQXl>fQ+J-&1AlY!U^ z>YT@Oe&?J=^8I=5qsz_m_CFMauzp**@2oeor4Q>)7XK_E1ljaAwGnwFS})3_wYC)x zMXc7#xU}(5ie;{sOAptqf7$Q+y3_gemmO=TD|Ww4eZ9NW{rrp0uArc&yItERBXw`2 z-7K|RhZ{q6XCoJDuWytS#qaD`tnDZ(9BV(^D2vQyfBSyZiM;w)IOPxW$6L{({oxTi z)vEpP@*ihse(>uLJ}tifoB#RItB>sn0t)yW!{6mDJ#;?n*ylUPsjrR>tml+2pUWSQ ze03zBR>xBGOt(WvzDcMF^{sl&$>jy6Z#0Kz?U`SW3z48xPXGSx^z`&UlqpirL~1j0lTIF;xYmoh)7-Y= zuM>8x^)f|{gX0ggcqnIEFPfFRc&Yv?VMp*iwdmAiPNv{h?Z@$Xa`IZkQoVJ%zV zD1Vr3S*1mqrlr`>&u=svR!1Tk8d>F|ljTq`2ytSDl2>7nDsb~2@b zx;&rdzIQsIIBQfyo)Nkm(Lm3=8S7|#`QVj@;MXQoC$5tggz%+K4(&!GpWs))aQiD=N#1L9Mt9<)aQiD z=N!`J9Ma|-(&vQB=S*pHrnEUz`kZk2oWt6j!`hs~`kZk2oM~;&v^Hm2pA#;hb3~hS zM4NL&pA#;hGo#I!(dNwPbHe3wj%ss`YIBb2bHe3wj%jm_X>*S0bHe3wLdMiJOJ0@6 zwK>Q2IpOj-C$u>yv^gjAIpOj-CuL^Qy%J8!%#wStn^c*O?^0&jjh)gmr?ku|Jrgd^ zoYpd@wajTf6E4r3(K2VW%o#lsF3&utWuDVA&*_0RT`%S`VYe_myJ7jC$e z=_$#qR&!RXIjh%%t7^s|phYI2Yt0RmmSSqbMqyV#;h?N?!f?Ez5Kt8--$a(6EU!Nc zMOA1|K;e3$K|ockC!j2p1XP9g1Qag1@dQ-Gx*pX8)l*E$^v)OwC|q`2TvL*>ATyIVYsEU=D z5KtCM0;)n~CJ889Z%zoPij|oVP!>u8szPNZ2`F6e^@M<`SeXd{WuYXXDpY2YfWr0W zgn+78nF#@9p(LOxRA!QZ!u95afT~!T2?1rHB%mr(W|Dxy_2z_ts#uu`0cD{ipej^m zl7PbX=7fN%SeXd{WuYXXDpY2YfWr0Wgn+78nF#@9p(LOxRA!QZ!u95afT~!T2?1rH zB%mr(W|Dxy_2z_ts#uu`0cD{ipej^ml7PbX=7fN%SeXd{WuYXXDpY2YfWr0Wgn+78 znF#@9p(LOxRA!QZ!u95afT~!T2?1rHB%mr(W|Dxy_2z_ts#uu`0cD{ipej^ml7PbX z=7fN%SeXd{WuYXXDpY2YfWr0Wgn+78nF#@9p(LOxRA!QZ!u95afT~!T2?1rHB%mr( zW|Dxy_2z_ts#uu`0cD{ipej^ml7PbX=7fO4V*(0~3n*MJpm3RhvP=jl%OnA1nIxbr z69URIA)qXi1e9fxfU-;oD9eO^vP=?CmPrE2G9jQW69URINkCa92`I~ifWq@$T?i;V zykhcXl7Pa+%iy_`>782$C_L}nLO|hp=avK%u6J%pK;dE!WU37b6~~DqxmZ1+1?e|^ z^rx5^*?55U|M9?Q_KSUSVh^0y@yyD`1E(b-39NoiBPjF^M6y{}My#=J1$3@~c5H5QahtT!RI!rsA2%47HovMR7tc z)Ef_qnc;SMqbZ(~ZNHF5hG;{BBAkZw$J@e!jMz~^j4$Kjhr z0H=`YwXb1VC3k^ahwJvErLec*UT;*IUb{9f5@WZzbHjO;tg9w7TYW!q#Il^rL$r0fLQj3;iWV`)OknQ$A zNw(Yn6xnY7(`38-&yel*e~xUo|MO(K{m+u^_Me4aaQnYNw%h+4*>3+A$#(mnC)@3R zfo!+`OJuwKUnbk_f01mr|0`s>{a+>9?f)9tZvWTGcKg3Uw%h+rvfcid$aeeB!CrRz z&y(%;Um)A!YN zeSW(35bibwp4q&2(#h1K^qG3MLY9dF;Y@yJZOmypTd}u{5p%XGAEZO4U9s1-9)DX& zA3e6Z;&IpNbj8lMwZuOib*!)V>|28?bzLki&?MuL2 zu}7DiJrro=&mJzoLO)M;&pyw!0q1^mJMotDeD>QVz{kn!9-MJ*x^~DsN}*58gE-A+ zcGvp+4lYhP5*I-?74gQ7ozUAGm)}}(dpK^#1oq8nHI^B~eeLZy4I}msp0qx%M39=7 z3pFhji=bYrWy#cd+ZBhL#W0q{tP`eyjZdnP^gE!{Opg-^Nlv22u|xRE==EcVe9|)R zB$_0sbdMB{n4~Z#g?-WrwALhHjnN}Tq9!TANfDp4O3P4VIxH7@q-dW>igHraC*8uv zsY!yU_egy)lhnsaeLm?nHd0LzzQp%P{c;J8w}kh~+5Mc<@00G}4Puh;vxpukW}7|5 zI4S0n-jm;Q^moAkBMqcX(f}t7_@p8&`i(PgGm<@Ql59@0eNu_G4h&M9k>Y8S6z8P4 zPjc|}&?F@oDUmTr2~JA*q%t;YO;VDPlA|Um$w^6{RKdorNg8CN!7-CG$Vr1fsfvwU zlZ5ZDy?4RTgh?9Wq@f-upQF{AamKN}>yc8ECMm^9DW8<5MVdjv(ym7uo-#?poHXo{ z3bZ~mNLbbNNNM@ABmQYgb5hzTEz{D>AYnn*BaK`zdm7=S5uda|t1^RxwOo&snKMZl zPRjVCRa%f4BrM~4q|tekG|EY%KIs;%#S9Wwa6Qu4f=L?Vq%og#o0ee)35&NLY5bB& z8t0^OpL7Qs%O+`pktP;R(gY_>_@wu+(QJ|?8ENv0Nt)!ONuN~2om-PM#Yj_EP0|!6 zP5Gn}Hlj_^G$T#_z$8s`(zH)D&(?3QkIdjSOMdW%ak+ANm-wi zzYru{V5AG{Cg}nvUGPbTxgcqdk>)l`(i|tv`K0BGLDEG=x_H+lUF4*TK51n>NSbG) z`MOD(=cIX`w7L)^Eilr;1CzACNee#d)}(I>rkB}lr$NLSuBNmn@OicczD4U(=h($x=5(p65n>XS;> zf~0GVbnS;G=^7_p^GVM2An7_IUH?0ibe)r~`=s)XAn67p-RPL48=Q2*Csl3+NjDkk z=8j3a$w@bTQgtavT4JQ7U6ZuLNlQJ_vb&tq)>8Pva!)yPk4;jJlX5;OpAYtwXQcc` zCMnNJd7o4$1W5%(D*VVK6*#Hjla`l*q-920-Zx3hoV4tdR#t+f6-HV)Fi9(%wBnOi zSA(QgMp}Jhl2$os6{O5GHbSwf+pgpa!ri{5O;OsTN!3QxE~)%=uiO&88@K=ci=+st zCB-R~x7MsTi8l!=hT~R3u7dxFr{5%ceiAviIF z!kWNl`jtm0-&}5|`y#Yk0ehvLjz#Q{jZF!7tMm+wk@{=@WoRAVtbX9An;*#smD)q> zq7*3F=r|QkMQIB?RhfPyf1_QSqF1qX7;ols?O3~5ZeW_L&D?%F1(ZhPIb+~e`R7NxEKRAT3cS19{w<0F&(KV|hI>N%+?Xh@_zjGn^s?OK$ zKkQ`BbPo8!z`($~*~#D8BUr&HBEVSz2pEB4AU24G0Y(N+hD|^Y6El!tgNU*~X%LSC z$X0-fGcm9T0LA|E|L2FOWMD92VqjR>!otAF!NBm72Obk1 YBHITON2VDSAnpK(F*YFF1LDH~0O^Si0RR91 literal 0 HcmV?d00001 diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index b9bc196130..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/q35/APIC.core-count", -"tests/data/acpi/q35/DSDT.core-count", -"tests/data/acpi/q35/FACP.core-count", From patchwork Wed Oct 18 15:54:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1850999 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Lj/JtRF1; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bCX4nFRz20Zj for ; Thu, 19 Oct 2023 03:00:08 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8tP-0002hU-LD; Wed, 18 Oct 2023 11:55:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8sm-00026u-Kx for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8sj-0006Uj-Gy for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644487; 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=FnWheI9RHYepJZYu2SMx1IQcZHnuNqLDKqzr9JSiyUY=; b=Lj/JtRF1p8tPoR8bKiaLvYVwcjx2PNCpZSugz4bJAfO2Sn/bG3Ov9IM0eZzQAMO7tjnxbC /Z5xokiS8AlgLWXHhq+hDVGg1o29wCAq1yS0gQ9rC5tRovKYYI4PGauUnF3Cs/Z8/g8Avb Lgp5aKSRx0BqIZL95x+/vRcenLiGRRs= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-244-M-t_hTBwPratIOcMP4rJVg-1; Wed, 18 Oct 2023 11:54:46 -0400 X-MC-Unique: M-t_hTBwPratIOcMP4rJVg-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-40570ccc497so54263405e9.3 for ; Wed, 18 Oct 2023 08:54:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644483; x=1698249283; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=FnWheI9RHYepJZYu2SMx1IQcZHnuNqLDKqzr9JSiyUY=; b=q3OI189bi9fCYWAf7NGVubcDtR3Nri+cnovKD1u5d1t/We1b9HrcUMxGBJSSscrQBo tcsIMOuvly3TJD9cufkmNGBYWOiLr8bvceqBZC5GPP1rhqJxYikPyNkCUGJ6hs2d1JTi XoeR90J9Uf19YQBJ6tQuEOQfSRlAW4Xl6ytvEHGCQTMUqwDAerc8LTWfa3gGLVIFkgzQ e0a/2mCSbJuynHBbWusjKAkDqBE2vNem11pil3qmrEPxwn/595lgoVkpEg3wcfgmHaRs cSSCb8c+nlQ+E4ZmQKx9dsMtdZj2hrgcp0MnmJpCwd36WDVo98BONiJ0cSVQip18WyQQ z5TA== X-Gm-Message-State: AOJu0YwoExoKmnr5uZdp7Uzl7kBB0MBdxM8ZKYKDwmFPjOg61p1v7L5c ymXZsxz9BLB7jpCtq+oELMc+CrWQ1RjArQ4JMGI/EKHytDAxn4bjBifIEVXztGeBqisTBjgsT/w FaZ++1Nsc8LOL4JDN/8EfdcELq7D/jhtMguLZXZh3gYZVVP7kdUKJDwonuhz9ZWQ9p0AEcBc= X-Received: by 2002:a7b:c8da:0:b0:403:31a:77b9 with SMTP id f26-20020a7bc8da000000b00403031a77b9mr4674051wml.37.1697644483475; Wed, 18 Oct 2023 08:54:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGQXOnQjs8l8rO9Isdo0FwSgeRZJ9gBiKaFjiQGxTFWI4aOQKwif59LGxANz9ygPXIJYv5Ngg== X-Received: by 2002:a7b:c8da:0:b0:403:31a:77b9 with SMTP id f26-20020a7bc8da000000b00403031a77b9mr4674037wml.37.1697644483110; Wed, 18 Oct 2023 08:54:43 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id az15-20020a05600c600f00b00406447b798bsm2012295wmb.37.2023.10.18.08.54.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:54:42 -0700 (PDT) Date: Wed, 18 Oct 2023 11:54:39 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhao Liu , Igor Mammedov , Ani Sinha Subject: [PULL 20/83] tests: bios-tables-test: Prepare the ACPI table change for smbios type4 core count2 test Message-ID: <5a91859db1e0d2909c454d45a5b6696814db24b0.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhao Liu Following the guidelines in tests/qtest/bios-tables-test.c, this is step 1 - 3. List the ACPI tables that will be changed about the type 4 core count2 test case. Signed-off-by: Zhao Liu Message-Id: <20230928125943.1816922-9-zhao1.liu@linux.intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..0f95d1344b 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/APIC.core-count2", +"tests/data/acpi/q35/DSDT.core-count2", From patchwork Wed Oct 18 15:54:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851101 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Ovunazpr; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9d0b0Lr0z20Pd for ; Thu, 19 Oct 2023 04:20:47 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8tx-000365-S3; Wed, 18 Oct 2023 11:56:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8sp-0002Fy-7c for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8sl-0006Uy-Di for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:54:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644490; 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=Sr5apWx/ScK9oB1nRm3T8OXKBnRMu7sHdlMje9yDWyM=; b=OvunazprAv3RUEkpajfM3AiM+i5Gu+uvnzLq0fX6e284+0FKMi5aaAe1qlGMu1bOS79IB3 07mJAN0ltOYL8XSKpxOvK9NzwzvmYOoFVOckH4LHn5b3bAyicEwViEIkSWBiG9301vF0J4 Sa3i28X05fSu5IgI/xvU15Wis/plojI= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-490-ZbQdVtuANcSrGPnMLREJww-1; Wed, 18 Oct 2023 11:54:49 -0400 X-MC-Unique: ZbQdVtuANcSrGPnMLREJww-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-40554735995so52005205e9.1 for ; Wed, 18 Oct 2023 08:54:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644488; x=1698249288; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Sr5apWx/ScK9oB1nRm3T8OXKBnRMu7sHdlMje9yDWyM=; b=j01uLWH6fq9VfIMFHNqnslj9v31bYtPPyVMakyCSLDtxNDLS3gOx3iNjMxUGF/6KHb 3+DmGZl7dTrrmfb3h3m7DyyKehJQnv0MPTU/EFYiD3FKVP5g/TgwsaF5kAhymVsiH3oi BFy54OPgR3w65iRyzJe9VsDf1qUKE03YqX16pLc9k0XTopsNHJOwMrGzIGcXoGqM6Q26 nJz6Qtl/gt1xmyUHV8efbaW5ECik8C1lbGL7J8DMH4hUYBXaDuuB/sWEJdDsBcBaOHVt 3plBtxfqta+2U0XWHVLZ+R+03mRLygGKhqCH2V9S6fpxqsUomrTWPzprQ4gJ3GCffEV5 qd7Q== X-Gm-Message-State: AOJu0YzI3e7p/ShagZ0MFnjTufGEJqQojMmZm0G+M3fJg7OS/fPivebX WvsG6Kqlhxpta84AOc20F3kMxLHSzkyIrNOIilVjfF47Ua6x9LRBo2+3NvB+aV5jRTD1yrWd6Cv rEisr3NXdLEb8AwAhVICHkaWDq60aIpKtGcYerKc8jXbnygE/4Zdh0aH8B4ul9eHBaesIaWg= X-Received: by 2002:a05:600c:5251:b0:406:411f:742e with SMTP id fc17-20020a05600c525100b00406411f742emr4447007wmb.34.1697644487793; Wed, 18 Oct 2023 08:54:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGbQtUl+ym/B431elIpSmuOJkiL2wQuZ3F/CELEczzm7uo7bmIGPNPC8yGifDLgwufgwqNUfw== X-Received: by 2002:a05:600c:5251:b0:406:411f:742e with SMTP id fc17-20020a05600c525100b00406411f742emr4446990wmb.34.1697644487469; Wed, 18 Oct 2023 08:54:47 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id b24-20020a05600c06d800b004064e3b94afsm1995242wmn.4.2023.10.18.08.54.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:54:46 -0700 (PDT) Date: Wed, 18 Oct 2023 11:54:43 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhao Liu , Igor Mammedov , Ani Sinha Subject: [PULL 21/83] tests: bios-tables-test: Extend smbios core count2 test to cover general topology Message-ID: <4d47fd5f5bdc030b1c6054c43e932d69a1c7580f.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhao Liu The commit 196ea60a734c3 ("hw/smbios: Fix core count in type4") fixed the miscalculation of cores per socket. The original core count2 test (with the topology configured by "-smp 275") didn't recognize that topology-related but because it just created a special topology with only one socket and one die by default, ignoring the effect of more topology levels (between socket and core) on the cores per socket calculation. So for the topology in this case, there're the following considerations: 1. cores per socket should be more than 255 to ensure we could cover the core count2 field. 2. The original bug was that cores per socket was miscalculated, so now we should include as many topology levels as possible (mutiple sockets or dies, no module since x86 hasn't supported it) to cover more general topology scenarios, to ensure that the cores per socket encoded in the core count2 field is correct. Based on these considerations, select the topology with multiple dies: -smp 260,dies=2,cores=130,threads=1 Note, here we doesn't configure multiple sockets to avoid the error ("kvm_init_vcpu: kvm_get_vcpu failed (*): Too many open files") if user uses the default ulimit seeting on his machine. And the cores per socket calculation for multiple sockets has already been covered by the core count test case, so that only multiple dies configuration is enough. The expected core count2 = cores per socket = cores (130) * dies (2) = 260. Suggested-by: Igor Mammedov Signed-off-by: Zhao Liu Acked-by: Igor Mammedov Message-Id: <20230928125943.1816922-10-zhao1.liu@linux.intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index c20f6f73d0..f3af20cf2c 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -1024,10 +1024,12 @@ static void test_acpi_q35_tcg_core_count2(void) .required_struct_types = base_required_struct_types, .required_struct_types_len = ARRAY_SIZE(base_required_struct_types), .smbios_core_count = 0xFF, - .smbios_core_count2 = 275, + .smbios_core_count2 = 260, }; - test_acpi_one("-machine smbios-entry-point-type=64 -smp 275", &data); + test_acpi_one("-machine smbios-entry-point-type=64 " + "-smp 260,dies=2,cores=130,threads=1", + &data); free_test_data(&data); } From patchwork Wed Oct 18 15:54:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1850992 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=BiumW/nR; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9b8b0kwzz23jS for ; Thu, 19 Oct 2023 02:57:35 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8uC-0003Lm-Qw; Wed, 18 Oct 2023 11:56:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8sw-0002Qo-EX for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8ss-0006WB-JD for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644497; 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=SyAexu+rZaWuvzKgCKPZbnaS1iRHy97AiNuxjIJnXXg=; b=BiumW/nRpbkfSiSKsiVm+sB+sI4FBxmM54FF8R0Y/ccdLJY0TLrM554+CEBZSveMl8GytY 54rrQKDzNZwvbuAn+KrsVO4c8aT2o63rWAIPnaN0SxmK4Or7MKRrBCeiOiq4+2K/B7rsbc tnRFKIwmjwITVNo3vbSM5F+C9FaDIEo= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-357-XCtzNZ6lNFGhZSWk_g1C5A-1; Wed, 18 Oct 2023 11:54:56 -0400 X-MC-Unique: XCtzNZ6lNFGhZSWk_g1C5A-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-32d9602824dso3892424f8f.2 for ; Wed, 18 Oct 2023 08:54:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644494; x=1698249294; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=SyAexu+rZaWuvzKgCKPZbnaS1iRHy97AiNuxjIJnXXg=; b=TJZWNjB76TxAhN3GfahPGn3Dd1VJ3eY9YZ0zB+NbtpRO+sxWUTAyOXZrwvS8a2VdL6 c3xY9MKwANHAs6IP3b6Qnm5evXypaJePeDbJfVGRwlfYiGboUhwBRiLym/Ei+KFniATf DyWDkhmVyRQv9f4eRCRxejeA2CknB/nqlnYHoIUxqlbymNRSYlBMAuUuisuVUv1Vz7EC faKAn5HX/xwyBpXa8vRLJa+6gGDX8kxfWkVNEuiXz9uS6nu+Izerb10QRy3b1zRcrfeH BJsIQZrWfrFxuC6sdbkZy5AWIsFA35rvCul6cfPylR4g+Govjv32KupdgKS1cfga1/Ls +M6Q== X-Gm-Message-State: AOJu0YzvPxRFcVlSyFOHQL09ufEOkwVV9hk9I1PCi/M0G2bpRCKZghif hstTEO2Q56CV9e2ziqkGSsfs2Z1+1bs48xRYu6uqGL5+B32Dnk83gkzhix/hJmvoP1kM+0DvJkz MeWQB/1NnvG74I1h49elf9sTDV1M4hy/EVElaXXLCdAkQsZ6x6wXWY0VsQljA3Ffz08dsTvg= X-Received: by 2002:a5d:4b8d:0:b0:32d:b2e0:ed76 with SMTP id b13-20020a5d4b8d000000b0032db2e0ed76mr4229936wrt.49.1697644494083; Wed, 18 Oct 2023 08:54:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGQVn4lN7GXLEGROheXdT5AyxHef1Ow+3hCtPd4lJ5YN3NrD6ehcIoK/dqaw4Uy85Kqc6rnBw== X-Received: by 2002:a5d:4b8d:0:b0:32d:b2e0:ed76 with SMTP id b13-20020a5d4b8d000000b0032db2e0ed76mr4229904wrt.49.1697644493387; Wed, 18 Oct 2023 08:54:53 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id q7-20020adffec7000000b0031980294e9fsm2372868wrs.116.2023.10.18.08.54.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:54:52 -0700 (PDT) Date: Wed, 18 Oct 2023 11:54:47 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhao Liu , Igor Mammedov , Ani Sinha Subject: [PULL 22/83] tests: bios-tables-test: Update ACPI table binaries for smbios core count2 test Message-ID: <9d09a20bf422a8587b74cd468b6d2838e285d95a.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhao Liu Change the core count2 from 275 to 260. Following the guidelines in tests/qtest/bios-tables-test.c, this is step 5 and 6. Changes in the tables: APIC: /* * Intel ACPI Component Architecture * AML/ASL+ Disassembler version 20200925 (64-bit version) * Copyright (c) 2000 - 2020 Intel Corporation * - * Disassembly of tests/data/acpi/q35/APIC.core-count2, Wed Aug 23 16:29:51 2023 + * Disassembly of /tmp/aml-KQDX91, Wed Aug 23 16:29:51 2023 * * ACPI Data Table [APIC] * * Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue */ [000h 0000 4] Signature : "APIC" [Multiple APIC Description Table (MADT)] -[004h 0004 4] Table Length : 000009AE +[004h 0004 4] Table Length : 00000CA6 [008h 0008 1] Revision : 03 -[009h 0009 1] Checksum : CE +[009h 0009 1] Checksum : FA [00Ah 0010 6] Oem ID : "BOCHS " [010h 0016 8] Oem Table ID : "BXPC " [018h 0024 4] Oem Revision : 00000001 [01Ch 0028 4] Asl Compiler ID : "BXPC" [020h 0032 4] Asl Compiler Revision : 00000001 [024h 0036 4] Local Apic Address : FEE00000 [028h 0040 4] Flags (decoded below) : 00000001 PC-AT Compatibility : 1 [02Ch 0044 1] Subtable Type : 00 [Processor Local APIC] [02Dh 0045 1] Length : 08 [02Eh 0046 1] Processor ID : 00 [02Fh 0047 1] Local Apic ID : 00 [030h 0048 4] Flags (decoded below) : 00000001 Processor Enabled : 1 @@ -1051,1256 +1051,1136 @@ [42Ch 1068 1] Subtable Type : 00 [Processor Local APIC] [42Dh 1069 1] Length : 08 [42Eh 1070 1] Processor ID : 80 [42Fh 1071 1] Local Apic ID : 80 [430h 1072 4] Flags (decoded below) : 00000001 Processor Enabled : 1 Runtime Online Capable : 0 [434h 1076 1] Subtable Type : 00 [Processor Local APIC] [435h 1077 1] Length : 08 [436h 1078 1] Processor ID : 81 [437h 1079 1] Local Apic ID : 81 [438h 1080 4] Flags (decoded below) : 00000001 Processor Enabled : 1 Runtime Online Capable : 0 -[43Ch 1084 1] Subtable Type : 00 [Processor Local APIC] -[43Dh 1085 1] Length : 08 -[43Eh 1086 1] Processor ID : 82 -[43Fh 1087 1] Local Apic ID : 82 -[440h 1088 4] Flags (decoded below) : 00000001 - Processor Enabled : 1 - Runtime Online Capable : 0 - -[444h 1092 1] Subtable Type : 00 [Processor Local APIC] -[445h 1093 1] Length : 08 -[446h 1094 1] Processor ID : 83 -[447h 1095 1] Local Apic ID : 83 -[448h 1096 4] Flags (decoded below) : 00000001 - Processor Enabled : 1 - Runtime Online Capable : 0 [snip] - -[964h 2404 1] Subtable Type : 01 [I/O APIC] -[965h 2405 1] Length : 0C -[966h 2406 1] I/O Apic ID : 00 -[967h 2407 1] Reserved : 00 -[968h 2408 4] Address : FEC00000 -[96Ch 2412 4] Interrupt : 00000000 - -[970h 2416 1] Subtable Type : 02 [Interrupt Source Override] -[971h 2417 1] Length : 0A -[972h 2418 1] Bus : 00 -[973h 2419 1] Source : 00 -[974h 2420 4] Interrupt : 00000002 -[978h 2424 2] Flags (decoded below) : 0000 +[43Ch 1084 1] Subtable Type : 09 [Processor Local x2APIC] +[43Dh 1085 1] Length : 10 +[43Eh 1086 2] Reserved : 0000 +[440h 1088 4] Processor x2Apic ID : 00000100 +[444h 1092 4] Flags (decoded below) : 00000001 + Processor Enabled : 1 +[448h 1096 4] Processor UID : 00000082 + +[44Ch 1100 1] Subtable Type : 09 [Processor Local x2APIC] +[44Dh 1101 1] Length : 10 +[44Eh 1102 2] Reserved : 0000 +[450h 1104 4] Processor x2Apic ID : 00000101 +[454h 1108 4] Flags (decoded below) : 00000001 + Processor Enabled : 1 +[458h 1112 4] Processor UID : 00000083 + [snip] + +[C68h 3176 1] Subtable Type : 02 [Interrupt Source Override] +[C69h 3177 1] Length : 0A +[C6Ah 3178 1] Bus : 00 +[C6Bh 3179 1] Source : 00 +[C6Ch 3180 4] Interrupt : 00000002 +[C70h 3184 2] Flags (decoded below) : 0000 Polarity : 0 Trigger Mode : 0 -[97Ah 2426 1] Subtable Type : 02 [Interrupt Source Override] -[97Bh 2427 1] Length : 0A -[97Ch 2428 1] Bus : 00 -[97Dh 2429 1] Source : 05 -[97Eh 2430 4] Interrupt : 00000005 -[982h 2434 2] Flags (decoded below) : 000D +[C72h 3186 1] Subtable Type : 02 [Interrupt Source Override] +[C73h 3187 1] Length : 0A +[C74h 3188 1] Bus : 00 +[C75h 3189 1] Source : 05 +[C76h 3190 4] Interrupt : 00000005 +[C7Ah 3194 2] Flags (decoded below) : 000D Polarity : 1 Trigger Mode : 3 -[984h 2436 1] Subtable Type : 02 [Interrupt Source Override] -[985h 2437 1] Length : 0A -[986h 2438 1] Bus : 00 -[987h 2439 1] Source : 09 -[988h 2440 4] Interrupt : 00000009 -[98Ch 2444 2] Flags (decoded below) : 000D +[C7Ch 3196 1] Subtable Type : 02 [Interrupt Source Override] +[C7Dh 3197 1] Length : 0A +[C7Eh 3198 1] Bus : 00 +[C7Fh 3199 1] Source : 09 +[C80h 3200 4] Interrupt : 00000009 +[C84h 3204 2] Flags (decoded below) : 000D Polarity : 1 Trigger Mode : 3 -[98Eh 2446 1] Subtable Type : 02 [Interrupt Source Override] -[98Fh 2447 1] Length : 0A -[990h 2448 1] Bus : 00 -[991h 2449 1] Source : 0A -[992h 2450 4] Interrupt : 0000000A -[996h 2454 2] Flags (decoded below) : 000D +[C86h 3206 1] Subtable Type : 02 [Interrupt Source Override] +[C87h 3207 1] Length : 0A +[C88h 3208 1] Bus : 00 +[C89h 3209 1] Source : 0A +[C8Ah 3210 4] Interrupt : 0000000A +[C8Eh 3214 2] Flags (decoded below) : 000D Polarity : 1 Trigger Mode : 3 -[998h 2456 1] Subtable Type : 02 [Interrupt Source Override] -[999h 2457 1] Length : 0A -[99Ah 2458 1] Bus : 00 -[99Bh 2459 1] Source : 0B -[99Ch 2460 4] Interrupt : 0000000B -[9A0h 2464 2] Flags (decoded below) : 000D +[C90h 3216 1] Subtable Type : 02 [Interrupt Source Override] +[C91h 3217 1] Length : 0A +[C92h 3218 1] Bus : 00 +[C93h 3219 1] Source : 0B +[C94h 3220 4] Interrupt : 0000000B +[C98h 3224 2] Flags (decoded below) : 000D Polarity : 1 Trigger Mode : 3 -[9A2h 2466 1] Subtable Type : 0A [Local x2APIC NMI] -[9A3h 2467 1] Length : 0C -[9A4h 2468 2] Flags (decoded below) : 0000 +[C9Ah 3226 1] Subtable Type : 0A [Local x2APIC NMI] +[C9Bh 3227 1] Length : 0C +[C9Ch 3228 2] Flags (decoded below) : 0000 Polarity : 0 Trigger Mode : 0 -[9A6h 2470 4] Processor UID : FFFFFFFF -[9AAh 2474 1] Interrupt Input LINT : 01 -[9ABh 2475 3] Reserved : 000000 +[C9Eh 3230 4] Processor UID : FFFFFFFF +[CA2h 3234 1] Interrupt Input LINT : 01 +[CA3h 3235 3] Reserved : 000000 ... DSDT: /* * Intel ACPI Component Architecture * AML/ASL+ Disassembler version 20200925 (64-bit version) * Copyright (c) 2000 - 2020 Intel Corporation * * Disassembling to symbolic ASL+ operators * - * Disassembly of tests/data/acpi/q35/DSDT.core-count2, Wed Aug 23 16:29:51 2023 + * Disassembly of /tmp/aml-6DDX91, Wed Aug 23 16:29:51 2023 * * Original Table Header: * Signature "DSDT" - * Length 0x00007EEF (32495) + * Length 0x000083EA (33770) * Revision 0x01 **** 32-bit table (V1), no 64-bit math support - * Checksum 0x52 + * Checksum 0x01 * OEM ID "BOCHS " * OEM Table ID "BXPC " * OEM Revision 0x00000001 (1) * Compiler ID "BXPC" * Compiler Version 0x00000001 (1) */ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ", 0x00000001) { Scope (\) { OperationRegion (DBG, SystemIO, 0x0402, One) Field (DBG, ByteAcc, NoLock, Preserve) { DBGB, 8 } @@ -4196,107 +4196,32 @@ } If ((Arg0 == 0x0101)) { Notify (C101, Arg1) } If ((Arg0 == 0x0102)) { Notify (C102, Arg1) } If ((Arg0 == 0x0103)) { Notify (C103, Arg1) } - - If ((Arg0 == 0x0104)) - { - Notify (C104, Arg1) - } - - If ((Arg0 == 0x0105)) - { - Notify (C105, Arg1) - } - - If ((Arg0 == 0x0106)) - { - Notify (C106, Arg1) - } - [snip] - If ((Arg0 == 0x0112)) - { - Notify (C112, Arg1) - } } Method (CSTA, 1, Serialized) { Acquire (\_SB.PCI0.PRES.CPLK, 0xFFFF) \_SB.PCI0.PRES.CSEL = Arg0 Local0 = Zero If ((\_SB.PCI0.PRES.CPEN == One)) { Local0 = 0x0F } Release (\_SB.PCI0.PRES.CPLK) Return (Local0) } @@ -4306,33 +4231,33 @@ \_SB.PCI0.PRES.CSEL = Arg0 \_SB.PCI0.PRES.CEJ0 = One Release (\_SB.PCI0.PRES.CPLK) } Method (CSCN, 0, Serialized) { Acquire (\_SB.PCI0.PRES.CPLK, 0xFFFF) Name (CNEW, Package (0xFF) {}) Local3 = Zero Local4 = One While ((Local4 == One)) { Local4 = Zero Local0 = One Local1 = Zero - While (((Local0 == One) && (Local3 < 0x0113))) + While (((Local0 == One) && (Local3 < 0x0104))) { Local0 = Zero \_SB.PCI0.PRES.CSEL = Local3 \_SB.PCI0.PRES.CCMD = Zero If ((\_SB.PCI0.PRES.CDAT < Local3)) { Break } If ((Local1 == 0xFF)) { Local4 = One Break } Local3 = \_SB.PCI0.PRES.CDAT @@ -7220,3281 +7145,3281 @@ Name (_MAT, Buffer (0x08) // _MAT: Multiple APIC Table Entry { 0x00, 0x08, 0x81, 0x81, 0x01, 0x00, 0x00, 0x00 // ........ }) Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device, x=0-9 { CEJ0 (0x81) } Method (_OST, 3, Serialized) // _OST: OSPM Status Indication { COST (0x81, Arg0, Arg1, Arg2) } } - Processor (C082, 0x82, 0x00000000, 0x00) + Device (C082) { + Name (_HID, "ACPI0007" /* Processor Device */) // _HID: Hardware ID + Name (_UID, 0x82) // _UID: Unique ID Method (_STA, 0, Serialized) // _STA: Status { Return (CSTA (0x82)) } - Name (_MAT, Buffer (0x08) // _MAT: Multiple APIC Table Entry + Name (_MAT, Buffer (0x10) // _MAT: Multiple APIC Table Entry { - 0x00, 0x08, 0x82, 0x82, 0x01, 0x00, 0x00, 0x00 // ........ + /* 0000 */ 0x09, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ........ + /* 0008 */ 0x01, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00 // ........ }) Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device, x=0-9 { CEJ0 (0x82) } Method (_OST, 3, Serialized) // _OST: OSPM Status Indication { COST (0x82, Arg0, Arg1, Arg2) } } - Processor (C083, 0x83, 0x00000000, 0x00) + Device (C083) { + Name (_HID, "ACPI0007" /* Processor Device */) // _HID: Hardware ID + Name (_UID, 0x83) // _UID: Unique ID Method (_STA, 0, Serialized) // _STA: Status { Return (CSTA (0x83)) } - Name (_MAT, Buffer (0x08) // _MAT: Multiple APIC Table Entry + Name (_MAT, Buffer (0x10) // _MAT: Multiple APIC Table Entry { - 0x00, 0x08, 0x83, 0x83, 0x01, 0x00, 0x00, 0x00 // ........ + /* 0000 */ 0x09, 0x10, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, // ........ + /* 0008 */ 0x01, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00 // ........ }) Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device, x=0-9 { CEJ0 (0x83) } Method (_OST, 3, Serialized) // _OST: OSPM Status Indication { COST (0x83, Arg0, Arg1, Arg2) } } - Processor (C084, 0x84, 0x00000000, 0x00) + Device (C084) { + Name (_HID, "ACPI0007" /* Processor Device */) // _HID: Hardware ID + Name (_UID, 0x84) // _UID: Unique ID Method (_STA, 0, Serialized) // _STA: Status { Return (CSTA (0x84)) } - Name (_MAT, Buffer (0x08) // _MAT: Multiple APIC Table Entry + Name (_MAT, Buffer (0x10) // _MAT: Multiple APIC Table Entry { - 0x00, 0x08, 0x84, 0x84, 0x01, 0x00, 0x00, 0x00 // ........ + /* 0000 */ 0x09, 0x10, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, // ........ + /* 0008 */ 0x01, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00 // ........ }) Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device, x=0-9 { CEJ0 (0x84) } Method (_OST, 3, Serialized) // _OST: OSPM Status Indication { COST (0x84, Arg0, Arg1, Arg2) } } [snip] - Processor (C0FE, 0xFE, 0x00000000, 0x00) + Device (C0FE) { + Name (_HID, "ACPI0007" /* Processor Device */) // _HID: Hardware ID + Name (_UID, 0xFE) // _UID: Unique ID Method (_STA, 0, Serialized) // _STA: Status { Return (CSTA (0xFE)) } - Name (_MAT, Buffer (0x08) // _MAT: Multiple APIC Table Entry + Name (_MAT, Buffer (0x10) // _MAT: Multiple APIC Table Entry { - 0x00, 0x08, 0xFE, 0xFE, 0x01, 0x00, 0x00, 0x00 // ........ + /* 0000 */ 0x09, 0x10, 0x00, 0x00, 0x7C, 0x01, 0x00, 0x00, // ....|... + /* 0008 */ 0x01, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00 // ........ }) Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device, x=0-9 { CEJ0 (0xFE) } Method (_OST, 3, Serialized) // _OST: OSPM Status Indication { COST (0xFE, Arg0, Arg1, Arg2) } } ... Signed-off-by: Zhao Liu Message-Id: <20230928125943.1816922-11-zhao1.liu@linux.intel.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/APIC.core-count2 | Bin 2478 -> 3238 bytes tests/data/acpi/q35/DSDT.core-count2 | Bin 32495 -> 33770 bytes 3 files changed, 2 deletions(-) diff --git a/tests/data/acpi/q35/APIC.core-count2 b/tests/data/acpi/q35/APIC.core-count2 index f5da2eb1e8a93d961b39f665f2e8b02acf1aeb3c..4f2428443430b7da8321e9edd816219deb7929a2 100644 GIT binary patch literal 3238 zcmXxmby$@L7>4l=5IyGriroq-c6Un%f(43!4Ju%FCoFWS>+W#f-LAWJ9j?3EZMyH~ zdB%0*{(jUSTwd=(R#8FDzT_ZCIGkOWlV6;cT~d^j7QV#=LBKN&f4Y) zR}&J{TD8=~M74HpwN4#15>ca3H5OBolGNm6H6=x@TUV`DPfbl#>(^HsG*BBhR2wx? z8#h*)G*O#2RhuSZmv`|~NR9m%DTenu*v{Bo(RrPxbBI)UJyLM{(_G*U?YDR|I zv7_3lliInn+NF!ywX52#o7%m*+M|csv!~jtm)g6x+NY1&x3Ai-pW45_I$(f0aG*M9 zkUDsRrAyUi z%hct|)fFq$l`GX%tJKx2)irC>wQJRN>(uq@)eRfejT_ZXo7Byl)h%1pty|S?+tlsb z)g3$3ojcX4Dz&EHirqHX>*|PSvH3X zpKWun@HsYz3!iIq!0>rChYX)@bI|YwHir#gXmjB3MK*^HUu<*m@Fg~f4_|6?0P$ru zhY(+Gr`cE7>GqX22QqvGSJ@m&e6`KN#QW?F`x=`A%IB}OIi&bHn}dq4w>hl%2Aczm zZ?rkI_$Hf!i*L3$y!aNI1B`FAImGxjn}dvRw>ixC4x0mw@3cA8_%54+jqkQO-1r`w z1CH;tIpp|0n}d$;w>j+i0hL z0};N0Cv1iSKWQ@<_$fQre%j8npRpMdzW!O8LBY@23=4kVW?=9OHbaA7v>6=ylFjho zmu&_JzhW~)_*I)h!mrs36Mo%hpzr~kp~44k1`EGoGhFyhn*qab*$f$e+h)-4J2u0H z-?bSy{GQFw;rDF@4}V}YeE36~0mO%Fh7f;bm)alOW%egF0~x-8Pi=-0e`Yh7_;b75 z{=%-XzqBjuuWSZ2d<9?I3@iS|W?=ERHbaZQvl(3cz0L6AA8ZB~|7bJB_$Qk|#y{H( zGycV9pz*IZLydp48EpK!&2ZyCYz7?vX*1;bFPlNfhi!%(|7|ny_#d00$N$<4K0abI z{P?KN9{`wl>^*-7V0Io?+3Y;7wrh4inQz?Bj}GEv;XfXDN=yu!!c#Q*|5Ggd0(~qg Qspcsbe)rMvE&PGOe_jvc0RR91 literal 2478 zcmXZeWl$DT6oBC+KKO#RP*m&=4D137us{*TMz9O9Td}*lI}y7Jv9Q1{3{VuiJJ3D6 zcW3rK=bgE`Kkn?0^$7~_i#2JQO`>n0pMP*Z-_RhxeEMajX`0NUrln+LYSc8evO;TX zw6Q^3TQnHZ&JOME(P%`I3C(7-SkS=%9Ualh37wtM#RXkm(ajCBWWlUiFfD+ZQ7vv0p!oio*W=alil^I1mR7!oh=a z$PgSl6o(DN;lpvn2pl;QM~%YKqjAg_96J`HqjB6g96uf>Ou&f~andB5JQ=48~5zNy?b%rKHR?_4;;XQ2l3D$JbW0B9KoYU@z^muejHDnz>_C2E)Gwf!uWVR zeHzc4!Lw)a+&Mgd9upGq!Ueo|5iecB%a`%W6--RTq$Iq06|Y^x>(}wd4ZL|1Z{5P% zxAD#$yn7e#-NXC$F*z9@Jivz!@zEoE{1{VGFf|pQJi(_=F)awzkI>3U-8>F{Qez({J@_-@z*c>{Tu)M z!M}eoBSSQ~XxcwrnMG-d%su)dZKYb2wpJ}l+o%?$ZB>iX2GydpooZ3qUbQG~R4q!I zREyGP)uOaTwJ7bNT9kHFElNA77Nwn4i_$KtMQK;nqO_apOda&|(&92?wKnUw3^ExE cx{flL^j|P0v%Z1JV#%D$`qTgPOMjvEANV#K5C8xG diff --git a/tests/data/acpi/q35/DSDT.core-count2 b/tests/data/acpi/q35/DSDT.core-count2 index b47891ec10be131a59bf404242241c054ac902f8..3a0cb8c581c8cc630a2ec21712b7f8b75fcad1c8 100644 GIT binary patch delta 7005 zcmZA0cUaYR6vuHcmD)`M6Dpcop=68FRGPxQSQ+I2Hwg|D$rMA)wuyop<*2xEptuoH zapMFxZrr$095})Kguios=lOl^^YGliczw_J`#aCOJ%_q}6KALiUeBHm>ly%joe&wv9npJESpSH!iMaFibUbVckJpBA>RUFW;g2TVT zClndy?K{A$NU%Zdp_&wR(`he=Qe;Mo750h$58R0;z8L& z#nU`hbqzHT)Id<~q6X4!Ri7Ga5U4?*o)R^PzG`aTu-+5pkpL=z`uFj+CD35~uli5^ zD0Se@J~r_bQL)|$z@eZ)>S3xssd<3T=}X-QPWV})$?-1DC!<6ZwmO>c++SYJQ@aj zh#F1HRdH9zpprp(ib_rnGe>b&1c(4t6-3ln6=yXD)EH1Nh#EsWyrgN&e zvnimafO=Kb6#B50`7Wa~->IOcf_hEVRO;7Cx(lEu-K7Fb1@yY0RF~bQT6dSKy9?y* zrqT6Qy1O^zh-p;0wcIw4yPFP!r^DbkMNOxcs<^uupk{!oE@}o%Q^n!U1T_;>4N)_x zSQUqt1}Y8ITcXmaZX5Gm9NsKYvp~HqY8L&Yio=@?YBs2MM9rqHsyMuKQ0bt2MWwqe zFWtJlbj$LL@a9m%wz|BUa>N`8Z)-l1!P=?FyGOWAH(A@=bc#CONxbE&lIbty_2$wGt#NlPa;7l0&k*G{6RmI^g z0ks5_zo;eD@F#N?hnEE^3)IJ=vS_F(4sR)_rJz0$wUiF1;_#M%S_Z0)sAcpwf=;#9<<*lTR?tHo%;Bws!7E{K zeNii^QH1$O4sR8xRiGM(T1BH&ad@jitp*h!YBe2I#o?_1wFcB@qSnwmk>(9KytSa# zg8E$4TI!*S!&?Vx9jGrvt)mr@5?+uIUJjrfKwk>VaoJstb$2B9ad832F+W><%z~HY%ZJ=?gIJ}LZHiBv>Y9pOe#o=uNwFy+9s7+M6qj^IPZ!@UP zpn^ngrrxSJye*)%fO3f1LhDpQ1etb;kcZ7_Hn4E{#cHoBmS!`lvOJE(6(Z72WE<|8@09iVoA`cBji z`a>0mw-eM(P>n_Hq|K^0yj`Gnf%;z5E_y!7ydj6T8`N%4A)nI7&VT6|tC?C)d zg7RH~2DcJ*gc4M7 zct=4U1=U*AQQD)5!#f7*7^pU)j?pXK%o}oe$3Yzj)mGGT>a2>xI|1qhsCJ@G&>~eF z-bqj=L4}JtNq4(Rcupg{LO_LpeiBsZvb#d-?h18x!5rQxijC3TwU;AK(eN1gGQk|) zX&8JO21kfGO@~x*cxOPJ0Tn6g3|0TxoWLltsJyylxT>y0fRA*5a=-ck*yEwceP(`4kL>0L#ugJQ*BFplO@GjE&?z+4# za>PYCu7f$eOECBn4DKrG64m_0ye@}V45}DZw5Vc=RmI_526Y)!H&K^ql`0PJ3aBff zVnkh`r+b(;{jqpkUl>quhP>IX#O02sp z(cLxT@UD|*Pu*P)IpR9K-&5Y$h{L-9gKxm#o}zA0UsW95O;9&M#frK~>s4`hw?N$j z)l1YZvd5Y?(_VCF(IX ph->5iw~Z*SqwOCmjf=AVOX0nvZ2f6t`R{+^*Qa(?$e%Nx`XBpVSA+ln delta 7056 zcmZYDc~DjN6~J*03Oso1!Zc1N({Y@{rcS5tJ(l<0bUK~4HeDh`u|}<1j8RN%v^J(T zMiWs%al_-jf}p5~im0f#;l3m8yW+kf?mMP;`~7mRhd;P;=6&w>{_gqn-pLJZY=S6% z2Y*)M@Q@H_UlA42GBm$6wrE)qn)e>=Zuvpz-)buxS~{ag6h>n|YjYUmv)fX$wINI! z()1x*8`AY5LK~d=V9^GbK16DRTOXpd!J`jWZSd+tv^MzkAx0hA+5GwxtNj$vhd6Br z>O;Ib*lqfdpbd6?NYn;LcGAb;z7AQQ$gZu?^XnG4?8Eo4^M|LQMWv&Sw@pmW$IX2< zmt$mz`iBMWk}TFJONeFUNWiu2T79JdoRXvcoD|bT30X?iTvU#w$0wew1Wo7U0RAFF z=+seMk0N^1D8Qjor;X-%G|{6+1D=yQeGJ!Qh#oTr@DG0%CvoO-olA6XF5m*GU3pyR z5uKL@2$`bo9?SJuqQ{N}?48-lSg>cDrm-l~Sn#-UfV*VOo6lqUB$l5K*rvUBv~N7u zy+BB}G5j|}h;A^SVr*l1>=;_k|yZu9)#5sfO8AQ*R0k~Ca*G#Tw58!0R&Rox@{uNNmm=z(0K|9_^dU^<1Lo&IMd5 zwSOMh^N5}|5763Kv;*_Go=^1r`G5nY4ldw&0nrN<0M-iau@!P%NOWN#puLN65|6!z z>ms6yiU6^Tv0#s5p{B8}i?QH^3jv?XSV}RE6_Z$TF<_^z;?b!kT$d1CQUbU^>a;~% zFCu!;BEVn%Q?%0;bG?}8#ft&Im)cp%bt%!MrGS^Db}iw03DHZI0D8KKlem|1y_D#s zO96|!i3NL>X&URh84F&v3^1&_hnH_RaOFiD|PA`uGbK~W)0vOsngbSy_V>;YXN`% znK()MI1=gJgJ>kTvriYRR#Ey)UNehuP1u_dca=2#Yx;7xZXhYh7Eu_dW!{n zHfkE-b7R39Hv)d}xrlkId90ems;dEWrS@&&dK1x`HUZw2+P|6W%|vhB4EWbR;v|7B zTyG(I%ND?Lse@a&-b(b=t$=Y~7;T?z8`s;2-nI>Jkks}Xu4{;{sR2Cpg|T3tW4op? zp|7#v?b`v<`ie)V?BKB-B(`G*;0&o#cXGXx=$$(OUrL>}i|buP@7e{}wVyai`fjdw z6TN#k;AW|vd$`_1^qxI{zseSE*Iuso61{gX;Ez(f_i??C=zaSDuV#w{d-iJ@TlF^< zynjDnpuc#u_W+L_Ah81n086Fz9pw5T(FYF#Mt&*U{zF_JBKpuFz%Qi^9On8k(T5KM z9+Em(%XKZ$wY7l1`^q?p-*$xSBSarL0$3omy^iZTqU-7aAAe;m*zY*1X|xY87JT$5 zV8;RC(J9Ax>==n1I|f)Kb?R}hj}v|TIAF_viFVovu1^qs;soG#Qm3Ef`XtdOPXb<$ z+IfoWQ$(LS1^CCW#YtSJxjs$w>C=EkQoGM^eTL{WX8@ZG6bts8)iinr8Vf#q7O>Ai z@o4Wk9y>>3=gtA{k=l2j>+?jPKM(lPAkp?;;Q9j57cKziOC7k#^+lpDUIc8AI(Uie zOGIC~1eoz}<0JvwWv(w1efctAh1B+XuIq`euLo=~*jRADaYfUZIoMe6l`DYX3>J@0 zxyoZ#N$l!Xz*ADEUgP>2(buj4y8k2EY1g^FPW1KbfODiyzrpnlqHo*)Y?9h}lk1yA z-@FOf;~Q}j*DbDZ5q;|xV2#x7+g#r!`u1(W)nB7%c>>t^f1;iClVEp_@cuAdS8>>1$u--)*KIoHpLe*PSA zgw(DVT)!at#S6fCsogKReo6Gpmw>)uV!@tQn#Lc884G^(3UJXdaZvAT9(zqH31%wI`Ee3w?w~v3;5gNokM>L!Mx$0;qrDCd^Ef} z#%5UX(-GYv6stz`foAyr55KW=9qA8OKSN_tMpCBoO*$#|=Z~?^cady3$vX9HggF~w&PEtn^-8nKT_hVpvMx27XtkKL z7Uc_OW^!B0I~hfhjD=*}dM47GiBvvqwoh&w`A$YrBoj$89{nYw%$X?jOGX(lsb1+z zDtD1=6v=w^tks;gnzL3Tt6phVxr=12B^cadx~$@=wdj5!-) z&c+y7^-8nKT_hVrvH?9CYtF`+v#~~2z0$057sx diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index 0f95d1344b..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/APIC.core-count2", -"tests/data/acpi/q35/DSDT.core-count2", From patchwork Wed Oct 18 15:54:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1850998 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ac+WZFCa; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bCP6d0hz20Pd for ; Thu, 19 Oct 2023 03:00:01 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8v3-0004TE-SO; Wed, 18 Oct 2023 11:57:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8tQ-0002jy-Ae for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8tO-0006j0-AY for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644516; 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=zjlVrUeczLAR03pwd1/U1KMehdm4BwsDcIjYnYLYaqM=; b=ac+WZFCawuvKsmaMhfhsblxfRBdmbXTF7Bmw49iXkfUgdJsului82smK7yPKe2jrLrAsof lhSfOut/UqjhoWwa3E4XSZljvQIeuUtYOnid1f2H8V5vtdtiqPPdQAS+s5OF7hme1m3lT3 yeDZ7Kh//kQ0UbjPeVnuO1A06pQphFU= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-428-Y52Nofr2NlSIck_AAF6cfw-1; Wed, 18 Oct 2023 11:55:00 -0400 X-MC-Unique: Y52Nofr2NlSIck_AAF6cfw-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4065d52a83aso44807815e9.1 for ; Wed, 18 Oct 2023 08:55:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644498; x=1698249298; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=zjlVrUeczLAR03pwd1/U1KMehdm4BwsDcIjYnYLYaqM=; b=fPDLNqccZ8k7OlRMWhrs1QUX+M84Q8DZaxCk4Zet1LGgX7b99najAcvIYaw5Rv1h6G 3F1pXnzWcherlDJG/mYraYfBDZNUX6gf2D8WYO0nwjQK2iX4CDc9WC7MZs2DNf+jwFGs ayhzbQSYViG3askQuGbtQV5puZXTh0YZmIkdjn6YzVEz5mqymerYwZ+kRtYyaYLuaP62 gYMG/L0VJFcZez1pSaVxw696M0s7UFviSsvgcbW01aWozQ7dCNn50F0IwRYeeshNvQzX QFhjzcCfW/Qf1t/n6sI0RCTKgmQYXDFsdjIydwkvrIb7nQK1hYVldTCmN+OMk5NAIrW9 nXeg== X-Gm-Message-State: AOJu0Yyy/hkq84lPIMP0GHhxx4Js2+mj31tFMxDl/dshXdsxURw69tfU ee7gm6dInvNatG+Qi4zE6kXIUD4slmSiKcEkH8P7+iJkDWnT02MzRDHZCAOnvmBjkCohLROrK6T yNhssgcvN5d97HwjX25Xg7jVEJsDWVG2tUE8kVZLeaXPS1/vxVjZSOi9jwWRghC8yHAOePRg= X-Received: by 2002:a05:600c:4f42:b0:405:3455:d603 with SMTP id m2-20020a05600c4f4200b004053455d603mr4396920wmq.17.1697644498561; Wed, 18 Oct 2023 08:54:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEzyGp+tGeKXR6M4a+hA14WZPqTVDqKSrYDJp4l3AmRx1ix9Uwai9xEUdFLuelRv2e20FOKsg== X-Received: by 2002:a05:600c:4f42:b0:405:3455:d603 with SMTP id m2-20020a05600c4f4200b004053455d603mr4396907wmq.17.1697644498228; Wed, 18 Oct 2023 08:54:58 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id u25-20020a05600c00d900b004068495910csm1970175wmm.23.2023.10.18.08.54.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:54:57 -0700 (PDT) Date: Wed, 18 Oct 2023 11:54:53 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhao Liu , Igor Mammedov , Ani Sinha Subject: [PULL 23/83] tests: bios-tables-test: Prepare the ACPI table change for smbios type4 thread count test Message-ID: <03a8efb80813ef2a77be59de9ce41f2399b371d2.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhao Liu Following the guidelines in tests/qtest/bios-tables-test.c, this is step 1 - 3. List the ACPI tables that will be added to test the thread count field of smbios type4 table. Signed-off-by: Zhao Liu Message-Id: <20230928125943.1816922-12-zhao1.liu@linux.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/q35/APIC.thread-count | 0 tests/data/acpi/q35/DSDT.thread-count | 0 tests/data/acpi/q35/FACP.thread-count | 0 4 files changed, 3 insertions(+) create mode 100644 tests/data/acpi/q35/APIC.thread-count create mode 100644 tests/data/acpi/q35/DSDT.thread-count create mode 100644 tests/data/acpi/q35/FACP.thread-count diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..4d139d7f6b 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/q35/APIC.thread-count", +"tests/data/acpi/q35/DSDT.thread-count", +"tests/data/acpi/q35/FACP.thread-count", diff --git a/tests/data/acpi/q35/APIC.thread-count b/tests/data/acpi/q35/APIC.thread-count new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/q35/DSDT.thread-count b/tests/data/acpi/q35/DSDT.thread-count new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/q35/FACP.thread-count b/tests/data/acpi/q35/FACP.thread-count new file mode 100644 index 0000000000..e69de29bb2 From patchwork Wed Oct 18 15:54:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851027 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=erIfGIfK; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bhY09NSz20Pd for ; Thu, 19 Oct 2023 03:21:48 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8vF-0005Gf-Ba; Wed, 18 Oct 2023 11:57:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8t7-0002di-3K for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8t1-0006e7-5t for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644505; 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=Y2vvrjcXQ7FkGJyS721V81si3KF742NaIRZW7f1WAeE=; b=erIfGIfKD7vDweLbbVw+oAXeqImCp2ngDZOYIvRj94DwdEAc8xnlQIt/feXxJkqFpDo1nm fKKK16rmqMHxo/yw8V2EMpAMEhgQMttOazIYBOsdo2m4EVVitBiRz44go+ljjWXjMNQB+2 HbzyTlyYmmG6nAWXnex2W3GvS4kfZ2I= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-322-xIMNtRSLOGS_xXtfQ3Jn0A-1; Wed, 18 Oct 2023 11:55:04 -0400 X-MC-Unique: xIMNtRSLOGS_xXtfQ3Jn0A-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-40566c578b7so50241345e9.0 for ; Wed, 18 Oct 2023 08:55:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644502; x=1698249302; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Y2vvrjcXQ7FkGJyS721V81si3KF742NaIRZW7f1WAeE=; b=vHS5s6NsX2bf91GuVFV0jNgRNfVpvTXSXhRQm4oc0lJSKYfLidJfra97JHL8vEtBdj wVY6NmQdBNC0eRZdHfjw2av+kGqjX9EsDulcDCFF1qQ+QWhCWXbkxFegsqA8q4Cm+3tv 6kA9IZSO8D/80CnVi+QebkeBXTHuGbQQ1Ngx329TyilW24Uu/dTBs8YpHpuG2Sorvz1n ekkgUbuhL3cji8AWv0k6xznH/WSo2DoCuVqJJ88o6njLWWDrI8iaaAvl2ZGd7ci/ekp/ W/IxM476oBUFo/x3OeGJuUUYlW34zqSiWA3bHqedH+NYyT1ju196VayvMp4PKH/eIvny nlkw== X-Gm-Message-State: AOJu0YyVdP0KRHCAH7yNvRuPPD75ckN7vQg1w8xaogYJm9A+Ig9RBtHk fCmV8l4iNMIE0vLhbVO5qBqgtIiWfE8nfNIjnB2WqS8SMtw7k1Wn6n2cRmG4PWFb7hArrJxi7OW QxUQFCv5MHP4YldoEF8mdMhysmA1yvdZ3xuCwpFob2BPnPsOa+iHae9XfAWE5eOogBFMT5xI= X-Received: by 2002:a05:600c:1d22:b0:408:41b4:7fe0 with SMTP id l34-20020a05600c1d2200b0040841b47fe0mr542104wms.6.1697644502384; Wed, 18 Oct 2023 08:55:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFNCWzMRbk11rPAdYm60cwQQnzeQPVx2mk81W8uMqTBxeRiAXlCwaGoJ8WFyDOoAPQgQKZ83Q== X-Received: by 2002:a05:600c:1d22:b0:408:41b4:7fe0 with SMTP id l34-20020a05600c1d2200b0040841b47fe0mr542088wms.6.1697644502055; Wed, 18 Oct 2023 08:55:02 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id g11-20020a05600c310b00b003fe1fe56202sm2044786wmo.33.2023.10.18.08.55.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:55:01 -0700 (PDT) Date: Wed, 18 Oct 2023 11:54:58 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhao Liu , Igor Mammedov , Ani Sinha Subject: [PULL 24/83] tests: bios-tables-test: Add test for smbios type4 thread count Message-ID: <706fa69cfc9f3a4cf7677583cce31d742c0d2712.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhao Liu This tests the commit 7298fd7de5551 ("hw/smbios: Fix thread count in type4"). In smbios_build_type_4_table() (hw/smbios/smbios.c), if the number of threads in the socket is not more than 255, then smbios type4 table encodes threads per socket into the thread count field. So for the topology in this case, there're the following considerations: 1. threads per socket should be not more than 255 to ensure we could cover the thread count field. 2. The original bug was that threads per socket was miscalculated, so now we should configure as many topology levels as possible (mutiple sockets & dies, no module since x86 hasn't supported it) to cover more general topology scenarios, to ensure that the threads per socket encoded in the thread count field is correct. 3. For the more general topology, we should also add "cpus" (presented threads for machine) and "maxcpus" (total threads for machine) to make sure that configuring unpluged CPUs in smp (cpus < maxcpus) does not affect the correctness of threads per socket for thread count field. Based on these considerations, select the topology as the follow: -smp cpus=15,maxcpus=54,sockets=2,dies=3,cores=3,threads=3 The expected thread count = threads per socket = threads (3) * cores (3) * dies (3) = 27. Suggested-by: Igor Mammedov Signed-off-by: Zhao Liu Acked-by: Igor Mammedov Message-Id: <20230928125943.1816922-13-zhao1.liu@linux.intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index f3af20cf2c..395ed7f9ff 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -95,6 +95,7 @@ typedef struct { uint16_t smbios_cpu_curr_speed; uint8_t smbios_core_count; uint16_t smbios_core_count2; + uint8_t smbios_thread_count; uint8_t *required_struct_types; int required_struct_types_len; int type4_count; @@ -640,6 +641,7 @@ static void smbios_cpu_test(test_data *data, uint32_t addr, SmbiosEntryPointType ep_type) { uint8_t core_count, expected_core_count = data->smbios_core_count; + uint8_t thread_count, expected_thread_count = data->smbios_thread_count; uint16_t speed, expected_speed[2]; uint16_t core_count2, expected_core_count2 = data->smbios_core_count2; int offset[2]; @@ -663,6 +665,13 @@ static void smbios_cpu_test(test_data *data, uint32_t addr, g_assert_cmpuint(core_count, ==, expected_core_count); } + thread_count = qtest_readb(data->qts, + addr + offsetof(struct smbios_type_4, thread_count)); + + if (expected_thread_count) { + g_assert_cmpuint(thread_count, ==, expected_thread_count); + } + if (ep_type == SMBIOS_ENTRY_POINT_TYPE_64) { core_count2 = qtest_readw(data->qts, addr + offsetof(struct smbios_type_4, core_count2)); @@ -1033,6 +1042,22 @@ static void test_acpi_q35_tcg_core_count2(void) free_test_data(&data); } +static void test_acpi_q35_tcg_thread_count(void) +{ + test_data data = { + .machine = MACHINE_Q35, + .variant = ".thread-count", + .required_struct_types = base_required_struct_types, + .required_struct_types_len = ARRAY_SIZE(base_required_struct_types), + .smbios_thread_count = 27, + }; + + test_acpi_one("-machine smbios-entry-point-type=64 " + "-smp cpus=15,maxcpus=54,sockets=2,dies=3,cores=3,threads=3", + &data); + free_test_data(&data); +} + static void test_acpi_q35_tcg_bridge(void) { test_data data = {}; @@ -2201,6 +2226,8 @@ int main(int argc, char *argv[]) test_acpi_q35_tcg_core_count); qtest_add_func("acpi/q35/core-count2", test_acpi_q35_tcg_core_count2); + qtest_add_func("acpi/q35/thread-count", + test_acpi_q35_tcg_thread_count); } if (qtest_has_device("virtio-iommu-pci")) { qtest_add_func("acpi/q35/viot", test_acpi_q35_viot); From patchwork Wed Oct 18 15:55:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851002 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=aOe6Ztw+; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bDX53LXz20Zj for ; Thu, 19 Oct 2023 03:01:00 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8vE-00053V-22; Wed, 18 Oct 2023 11:57:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8ta-0002nO-Em for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8tT-0006pc-QF for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644534; 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=MwPAwv5Y3eXXEHBw1lpcidsmEhKEgP+6i9xKOvqMojk=; b=aOe6Ztw+1AOKSjSd2xIvS36CuidxvMc0bhV5Y00q87XsqnTdeEUrtSkPkyTWkanHBfBPMp b/8r25w4HB6OL0s0n8YaABoZfdCxkk871Z51zmOFwi1SynyHBVux7wlk3/ZNTdTtKvmFfF Q5TSSbXEN577z4RjT+rwL4kMIN8LN44= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-588-pSnTike8PYGkNRqgZJH39Q-1; Wed, 18 Oct 2023 11:55:10 -0400 X-MC-Unique: pSnTike8PYGkNRqgZJH39Q-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-3f42bcef2acso46844835e9.2 for ; Wed, 18 Oct 2023 08:55:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644508; x=1698249308; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MwPAwv5Y3eXXEHBw1lpcidsmEhKEgP+6i9xKOvqMojk=; b=jMbK8EH13rFYaP4+JTMGTTIIMLWjoYfm8JTImmB7jT7gJL5v9berbr59k6ITRmg2gr g9h9K8PlEVIInm7mCzks+3cpLmtpFml05onER81ksR06o6f+ZXy6s4kyhLaHqWECoViT aHei/l0ZQu/Cu40kK0qZcAfiwfYBcShzacKZaa+NqkWvtsE+YfKt/0g1l7zNFdr/Kg3E vkeojTw+FJvNmYwLbxSFk8B+Vq0Kz+uh1zKqG+KhXc7f3GOXDSeyFKf9WUAnhW/EtqcH YU3QiAPppp06R+2bfnlVrCjTb5zc4P4ptZArsCkFJsEVwVO73C8sbOebhO+jN48XfKYb eTWQ== X-Gm-Message-State: AOJu0YzRtVFMa8ZkP7wLcilNXWX4LQSzDBVlH4x+75mwJPaK/compxxJ W+WMH0/YVwflA/KXI6IgPQUL/vxNBuRD55j/hg2ro4sM034s2tmMBt+o0i2YoN7MR8QTiTDFosb jhLu9XDslN/zTZRqdh5MjfuFP2zbxqic2imjwe+IRIqyiHCFhqf5wtx/VMaTeDrT0r15uZa0= X-Received: by 2002:a05:600c:484f:b0:406:4573:81d2 with SMTP id j15-20020a05600c484f00b00406457381d2mr4167930wmo.39.1697644508230; Wed, 18 Oct 2023 08:55:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFzya3+CF4r2P3FwfyBiyrvL+luU6Y8pG7jD5xXNaGfnXJUnHFJByBvsHDydhqzs31OJ6r2UA== X-Received: by 2002:a05:600c:484f:b0:406:4573:81d2 with SMTP id j15-20020a05600c484f00b00406457381d2mr4167902wmo.39.1697644507567; Wed, 18 Oct 2023 08:55:07 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id q12-20020a05600c2e4c00b0040648217f4fsm1969364wmf.39.2023.10.18.08.55.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:55:06 -0700 (PDT) Date: Wed, 18 Oct 2023 11:55:02 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhao Liu , Igor Mammedov , Ani Sinha Subject: [PULL 25/83] tests: bios-tables-test: Add ACPI table binaries for smbios type4 thread count test Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhao Liu Following the guidelines in tests/qtest/bios-tables-test.c, this is step 5 and 6. Changes in the tables: FACP: +/* + * Intel ACPI Component Architecture + * AML/ASL+ Disassembler version 20200925 (64-bit version) + * Copyright (c) 2000 - 2020 Intel Corporation + * + * Disassembly of /tmp/aml-1NP791, Wed Aug 23 21:51:31 2023 + * + * ACPI Data Table [FACP] + * + * Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue + */ + +[000h 0000 4] Signature : "FACP" [Fixed ACPI Description Table (FADT)] +[004h 0004 4] Table Length : 000000F4 +[008h 0008 1] Revision : 03 +[009h 0009 1] Checksum : B3 +[00Ah 0010 6] Oem ID : "BOCHS " +[010h 0016 8] Oem Table ID : "BXPC " +[018h 0024 4] Oem Revision : 00000001 +[01Ch 0028 4] Asl Compiler ID : "BXPC" +[020h 0032 4] Asl Compiler Revision : 00000001 + +[024h 0036 4] FACS Address : 00000000 +[028h 0040 4] DSDT Address : 00000000 +[02Ch 0044 1] Model : 01 +[02Dh 0045 1] PM Profile : 00 [Unspecified] +[02Eh 0046 2] SCI Interrupt : 0009 +[030h 0048 4] SMI Command Port : 000000B2 +[034h 0052 1] ACPI Enable Value : 02 +[035h 0053 1] ACPI Disable Value : 03 +[036h 0054 1] S4BIOS Command : 00 +[037h 0055 1] P-State Control : 00 +[038h 0056 4] PM1A Event Block Address : 00000600 +[03Ch 0060 4] PM1B Event Block Address : 00000000 +[040h 0064 4] PM1A Control Block Address : 00000604 +[044h 0068 4] PM1B Control Block Address : 00000000 +[048h 0072 4] PM2 Control Block Address : 00000000 +[04Ch 0076 4] PM Timer Block Address : 00000608 +[050h 0080 4] GPE0 Block Address : 00000620 +[054h 0084 4] GPE1 Block Address : 00000000 +[058h 0088 1] PM1 Event Block Length : 04 +[059h 0089 1] PM1 Control Block Length : 02 +[05Ah 0090 1] PM2 Control Block Length : 00 +[05Bh 0091 1] PM Timer Block Length : 04 +[05Ch 0092 1] GPE0 Block Length : 10 +[05Dh 0093 1] GPE1 Block Length : 00 +[05Eh 0094 1] GPE1 Base Offset : 00 +[05Fh 0095 1] _CST Support : 00 +[060h 0096 2] C2 Latency : 0FFF +[062h 0098 2] C3 Latency : 0FFF +[064h 0100 2] CPU Cache Size : 0000 +[066h 0102 2] Cache Flush Stride : 0000 +[068h 0104 1] Duty Cycle Offset : 00 +[069h 0105 1] Duty Cycle Width : 00 +[06Ah 0106 1] RTC Day Alarm Index : 00 +[06Bh 0107 1] RTC Month Alarm Index : 00 +[06Ch 0108 1] RTC Century Index : 32 +[06Dh 0109 2] Boot Flags (decoded below) : 0002 + Legacy Devices Supported (V2) : 0 + 8042 Present on ports 60/64 (V2) : 1 + VGA Not Present (V4) : 0 + MSI Not Supported (V4) : 0 + PCIe ASPM Not Supported (V4) : 0 + CMOS RTC Not Present (V5) : 0 +[06Fh 0111 1] Reserved : 00 +[070h 0112 4] Flags (decoded below) : 000484A5 + WBINVD instruction is operational (V1) : 1 + WBINVD flushes all caches (V1) : 0 + All CPUs support C1 (V1) : 1 + C2 works on MP system (V1) : 0 + Control Method Power Button (V1) : 0 + Control Method Sleep Button (V1) : 1 + RTC wake not in fixed reg space (V1) : 0 + RTC can wake system from S4 (V1) : 1 + 32-bit PM Timer (V1) : 0 + Docking Supported (V1) : 0 + Reset Register Supported (V2) : 1 + Sealed Case (V3) : 0 + Headless - No Video (V3) : 0 + Use native instr after SLP_TYPx (V3) : 0 + PCIEXP_WAK Bits Supported (V4) : 0 + Use Platform Timer (V4) : 1 + RTC_STS valid on S4 wake (V4) : 0 + Remote Power-on capable (V4) : 0 + Use APIC Cluster Model (V4) : 1 + Use APIC Physical Destination Mode (V4) : 0 + Hardware Reduced (V5) : 0 + Low Power S0 Idle (V5) : 0 + +[074h 0116 12] Reset Register : [Generic Address Structure] +[074h 0116 1] Space ID : 01 [SystemIO] +[075h 0117 1] Bit Width : 08 +[076h 0118 1] Bit Offset : 00 +[077h 0119 1] Encoded Access Width : 00 [Undefined/Legacy] +[078h 0120 8] Address : 0000000000000CF9 + +[080h 0128 1] Value to cause reset : 0F +[081h 0129 2] ARM Flags (decoded below) : 0000 + PSCI Compliant : 0 + Must use HVC for PSCI : 0 + +[083h 0131 1] FADT Minor Revision : 00 +[084h 0132 8] FACS Address : 0000000000000000 +[08Ch 0140 8] DSDT Address : 0000000000000000 +[094h 0148 12] PM1A Event Block : [Generic Address Structure] +[094h 0148 1] Space ID : 01 [SystemIO] +[095h 0149 1] Bit Width : 20 +[096h 0150 1] Bit Offset : 00 +[097h 0151 1] Encoded Access Width : 00 [Undefined/Legacy] +[098h 0152 8] Address : 0000000000000600 + +[0A0h 0160 12] PM1B Event Block : [Generic Address Structure] +[0A0h 0160 1] Space ID : 00 [SystemMemory] +[0A1h 0161 1] Bit Width : 00 +[0A2h 0162 1] Bit Offset : 00 +[0A3h 0163 1] Encoded Access Width : 00 [Undefined/Legacy] +[0A4h 0164 8] Address : 0000000000000000 + +[0ACh 0172 12] PM1A Control Block : [Generic Address Structure] +[0ACh 0172 1] Space ID : 01 [SystemIO] +[0ADh 0173 1] Bit Width : 10 +[0AEh 0174 1] Bit Offset : 00 +[0AFh 0175 1] Encoded Access Width : 00 [Undefined/Legacy] +[0B0h 0176 8] Address : 0000000000000604 + +[0B8h 0184 12] PM1B Control Block : [Generic Address Structure] +[0B8h 0184 1] Space ID : 00 [SystemMemory] +[0B9h 0185 1] Bit Width : 00 +[0BAh 0186 1] Bit Offset : 00 +[0BBh 0187 1] Encoded Access Width : 00 [Undefined/Legacy] +[0BCh 0188 8] Address : 0000000000000000 + +[0C4h 0196 12] PM2 Control Block : [Generic Address Structure] +[0C4h 0196 1] Space ID : 00 [SystemMemory] +[0C5h 0197 1] Bit Width : 00 +[0C6h 0198 1] Bit Offset : 00 +[0C7h 0199 1] Encoded Access Width : 00 [Undefined/Legacy] +[0C8h 0200 8] Address : 0000000000000000 + +[0D0h 0208 12] PM Timer Block : [Generic Address Structure] +[0D0h 0208 1] Space ID : 01 [SystemIO] +[0D1h 0209 1] Bit Width : 20 +[0D2h 0210 1] Bit Offset : 00 +[0D3h 0211 1] Encoded Access Width : 00 [Undefined/Legacy] +[0D4h 0212 8] Address : 0000000000000608 + +[0DCh 0220 12] GPE0 Block : [Generic Address Structure] +[0DCh 0220 1] Space ID : 01 [SystemIO] +[0DDh 0221 1] Bit Width : 80 +[0DEh 0222 1] Bit Offset : 00 +[0DFh 0223 1] Encoded Access Width : 00 [Undefined/Legacy] +[0E0h 0224 8] Address : 0000000000000620 + +[0E8h 0232 12] GPE1 Block : [Generic Address Structure] +[0E8h 0232 1] Space ID : 00 [SystemMemory] +[0E9h 0233 1] Bit Width : 00 +[0EAh 0234 1] Bit Offset : 00 +[0EBh 0235 1] Encoded Access Width : 00 [Undefined/Legacy] +[0ECh 0236 8] Address : 0000000000000000 ... APIC: +/* + * Intel ACPI Component Architecture + * AML/ASL+ Disassembler version 20200925 (64-bit version) + * Copyright (c) 2000 - 2020 Intel Corporation + * + * Disassembly of /tmp/aml-2JP791, Wed Aug 23 21:51:31 2023 + * + * ACPI Data Table [APIC] + * + * Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue + */ + +[000h 0000 4] Signature : "APIC" [Multiple APIC Description Table (MADT)] +[004h 0004 4] Table Length : 00000220 +[008h 0008 1] Revision : 03 +[009h 0009 1] Checksum : 63 +[00Ah 0010 6] Oem ID : "BOCHS " +[010h 0016 8] Oem Table ID : "BXPC " +[018h 0024 4] Oem Revision : 00000001 +[01Ch 0028 4] Asl Compiler ID : "BXPC" +[020h 0032 4] Asl Compiler Revision : 00000001 + +[024h 0036 4] Local Apic Address : FEE00000 +[028h 0040 4] Flags (decoded below) : 00000001 + PC-AT Compatibility : 1 + +[02Ch 0044 1] Subtable Type : 00 [Processor Local APIC] +[02Dh 0045 1] Length : 08 +[02Eh 0046 1] Processor ID : 00 +[02Fh 0047 1] Local Apic ID : 00 +[030h 0048 4] Flags (decoded below) : 00000001 + Processor Enabled : 1 + Runtime Online Capable : 0 + +[034h 0052 1] Subtable Type : 00 [Processor Local APIC] +[035h 0053 1] Length : 08 +[036h 0054 1] Processor ID : 01 +[037h 0055 1] Local Apic ID : 01 +[038h 0056 4] Flags (decoded below) : 00000001 + Processor Enabled : 1 + Runtime Online Capable : 0 [snip] +[1D4h 0468 1] Subtable Type : 00 [Processor Local APIC] +[1D5h 0469 1] Length : 08 +[1D6h 0470 1] Processor ID : 35 +[1D7h 0471 1] Local Apic ID : 6A +[1D8h 0472 4] Flags (decoded below) : 00000000 + Processor Enabled : 0 + Runtime Online Capable : 0 + +[1DCh 0476 1] Subtable Type : 01 [I/O APIC] +[1DDh 0477 1] Length : 0C +[1DEh 0478 1] I/O Apic ID : 00 +[1DFh 0479 1] Reserved : 00 +[1E0h 0480 4] Address : FEC00000 +[1E4h 0484 4] Interrupt : 00000000 + +[1E8h 0488 1] Subtable Type : 02 [Interrupt Source Override] +[1E9h 0489 1] Length : 0A +[1EAh 0490 1] Bus : 00 +[1EBh 0491 1] Source : 00 +[1ECh 0492 4] Interrupt : 00000002 +[1F0h 0496 2] Flags (decoded below) : 0000 + Polarity : 0 + Trigger Mode : 0 + +[1F2h 0498 1] Subtable Type : 02 [Interrupt Source Override] +[1F3h 0499 1] Length : 0A +[1F4h 0500 1] Bus : 00 +[1F5h 0501 1] Source : 05 +[1F6h 0502 4] Interrupt : 00000005 +[1FAh 0506 2] Flags (decoded below) : 000D + Polarity : 1 + Trigger Mode : 3 + +[1FCh 0508 1] Subtable Type : 02 [Interrupt Source Override] +[1FDh 0509 1] Length : 0A +[1FEh 0510 1] Bus : 00 +[1FFh 0511 1] Source : 09 +[200h 0512 4] Interrupt : 00000009 +[204h 0516 2] Flags (decoded below) : 000D + Polarity : 1 + Trigger Mode : 3 + +[206h 0518 1] Subtable Type : 02 [Interrupt Source Override] +[207h 0519 1] Length : 0A +[208h 0520 1] Bus : 00 +[209h 0521 1] Source : 0A +[20Ah 0522 4] Interrupt : 0000000A +[20Eh 0526 2] Flags (decoded below) : 000D + Polarity : 1 + Trigger Mode : 3 + +[210h 0528 1] Subtable Type : 02 [Interrupt Source Override] +[211h 0529 1] Length : 0A +[212h 0530 1] Bus : 00 +[213h 0531 1] Source : 0B +[214h 0532 4] Interrupt : 0000000B +[218h 0536 2] Flags (decoded below) : 000D + Polarity : 1 + Trigger Mode : 3 + +[21Ah 0538 1] Subtable Type : 04 [Local APIC NMI] +[21Bh 0539 1] Length : 06 +[21Ch 0540 1] Processor ID : FF +[21Dh 0541 2] Flags (decoded below) : 0000 + Polarity : 0 + Trigger Mode : 0 +[21Fh 0543 1] Interrupt Input LINT : 01 ... DSDT: +/* + * Intel ACPI Component Architecture + * AML/ASL+ Disassembler version 20200925 (64-bit version) + * Copyright (c) 2000 - 2020 Intel Corporation + * + * Disassembling to symbolic ASL+ operators + * + * Disassembly of /tmp/aml-00O791, Wed Aug 23 21:51:31 2023 + * + * Original Table Header: + * Signature "DSDT" + * Length 0x00003271 (12913) + * Revision 0x01 **** 32-bit table (V1), no 64-bit math support + * Checksum 0xAF + * OEM ID "BOCHS " + * OEM Table ID "BXPC " + * OEM Revision 0x00000001 (1) + * Compiler ID "BXPC" + * Compiler Version 0x00000001 (1) + */ +DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ", 0x00000001) +{ + Scope (\) + { + OperationRegion (DBG, SystemIO, 0x0402, One) + Field (DBG, ByteAcc, NoLock, Preserve) + { + DBGB, 8 + } + + Method (DBUG, 1, NotSerialized) + { + ToHexString (Arg0, Local0) + ToBuffer (Local0, Local0) + Local1 = (SizeOf (Local0) - One) + Local2 = Zero + While ((Local2 < Local1)) + { + DBGB = DerefOf (Local0 [Local2]) + Local2++ + } + + DBGB = 0x0A + } + } [snip] + Processor (C000, 0x00, 0x00000000, 0x00) + { + Method (_STA, 0, Serialized) // _STA: Status + { + Return (CSTA (Zero)) + } + + Name (_MAT, Buffer (0x08) // _MAT: Multiple APIC Table Entry + { + 0x00, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 // ........ + }) + Method (_OST, 3, Serialized) // _OST: OSPM Status Indication + { + COST (Zero, Arg0, Arg1, Arg2) + } + } + + Processor (C001, 0x01, 0x00000000, 0x00) + { + Method (_STA, 0, Serialized) // _STA: Status + { + Return (CSTA (One)) + } + + Name (_MAT, Buffer (0x08) // _MAT: Multiple APIC Table Entry + { + 0x00, 0x08, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00 // ........ + }) + Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device, x=0-9 + { + CEJ0 (One) + } + + Method (_OST, 3, Serialized) // _OST: OSPM Status Indication + { + COST (One, Arg0, Arg1, Arg2) + } + } [snip] + Processor (C035, 0x35, 0x00000000, 0x00) + { + Method (_STA, 0, Serialized) // _STA: Status + { + Return (CSTA (0x35)) + } + + Name (_MAT, Buffer (0x08) // _MAT: Multiple APIC Table Entry + { + 0x00, 0x08, 0x35, 0x6A, 0x01, 0x00, 0x00, 0x00 // ..5j.... + }) + Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device, x=0-9 + { + CEJ0 (0x35) + } + + Method (_OST, 3, Serialized) // _OST: OSPM Status Indication + { + COST (0x35, Arg0, Arg1, Arg2) + } + } ... Signed-off-by: Zhao Liu Message-Id: <20230928125943.1816922-14-zhao1.liu@linux.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/q35/APIC.thread-count | Bin 0 -> 544 bytes tests/data/acpi/q35/DSDT.thread-count | Bin 0 -> 12913 bytes tests/data/acpi/q35/FACP.thread-count | Bin 0 -> 244 bytes 4 files changed, 3 deletions(-) diff --git a/tests/data/acpi/q35/APIC.thread-count b/tests/data/acpi/q35/APIC.thread-count index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c27e87fcf1c04a2e75f9a20f2bc6a28f19aadf66 100644 GIT binary patch literal 544 zcmXxe*-pYh7(n4^X=@iyb^*5m0Ri{zURpKajdcxrrJx3VN*;wLL1%j6B=dhKlgVWI z@i3C65UELc8x0<0IEo{wmLY`DtrcRvNOXlj!$8x-l!ca!wu6p~OCGvDdRg>y800Zs z#7qg7%eYcWzTsx8n5$u4Vxf-329}ywZsBShD;=zMvDU-23taExMu?l2xOIi{8tVgW z3~~Dgn=!WTuzim^kJx#_?lbmAxch>8uekq)2k&?|#-k5B{=}0nJe}g%H=h4!jkKP# eg`TFbwhmpkt<321y#Mmm1A4)b;s}HheSP+5=BwpvPH|1Eq{unB-_)XMaV}|k}b+KDbGww1EeHRDtQ8g z&5VIK0|T}ONG1jfbVi+^OU*z5x=UBx)<8GyZgw4@t1i09HVEQXl>fQ+J-&1AlY!U^ z>YT@Oe&?J=^8I=5qsz_m_CFMauzp**@2oeor4Q>)7XK_E1ljaAwGnwFS})3_wYC)x zMXc7#xU}(5ie;{sOAptqf7$Q+y3_gemmO=TD|Ww4eZ9NW{rrp0uArc&yItERBXw`2 z-7K|RhZ{q6XCoJDuWytS#qaD`tnDZ(9BV(^D2vQyfBSyZiM;w)IOPxW$6L{({oxTi z)vEpP@*ihse(>uLJ}tifoB#RItB>sn0t)yW!{6mDJ#;?n*ylUPsjrR>tml+2pUWSQ ze03zBR>xBGOt(WvzDcMF^{sl&$>jy6Z#0Kz?U`SW3z48xPXGSx^z`&UlqpirL~1j0lTIF;xYmoh)7-Y= zuM>8x^)f|{gX0ggcqnIEFPfFRc&Yv?VMp*iwdmAiPNv{h?Z@$Xa`IZkQoVJ%zV zD1Vr3S*1mqrlr`>&u=svR!1Tk8d>F|ljTq`2ytSDl2>7nDsb~2@b zx;&rdzIQsIIBQfyo)Nkm(Lm3=8S7|#`QVj@;MXQoC$5tggz%+K4(&!GpWs))aQiD=N#1L9Mt9<)aQiD z=N!`J9Ma|-(&vQB=S*pHrnEUz`kZk2oWt6j!`hs~`kZk2oM~;&v^Hm2pA#;hb3~hS zM4NL&pA#;hGo#I!(dNwPbHe3wj%ss`YIBb2bHe3wj%jm_X>*S0bHe3wLdMiJOJ0@6 zwK>Q2IpOj-C$u>yv^gjAIpOj-CuL^Qy%J8!%#wStn^c*O?^0&jjh)gmr?ku|Jrgd^ zoYpd@wajTf6E4r3(K2VW%o#lsF3&utWuDVA&*_0RT`%S`VYe_myJ7jC$e z=_$#qR&!RXIjh%%t7^s|phYI2Yt0RmmSSqbMqyV#;h?N?!f?Ez5Kt8--$a(6EU!Nc zMOA1|K;e3$K|ockC!j2p1XP9g1Qag1@dQ-Gx*pX8)l*E$^v)OwC|q`2TvL*>ATyIVYsEU=D z5KtCM0;)n~CJ889Z%zoPij|oVP!>u8szPNZ2`F6e^@M<`SeXd{WuYXXDpY2YfWr0W zgn+78nF#@9p(LOxRA!QZ!u95afT~!T2?1rHB%mr(W|Dxy_2z_ts#uu`0cD{ipej^m zl7PbX=7fN%SeXd{WuYXXDpY2YfWr0Wgn+78nF#@9p(LOxRA!QZ!u95afT~!T2?1rH zB%mr(W|Dxy_2z_ts#uu`0cD{ipej^ml7PbX=7fN%SeXd{WuYXXDpY2YfWr0Wgn+78 znF#@9p(LOxRA!QZ!u95afT~!T2?1rHB%mr(W|Dxy_2z_ts#uu`0cD{ipej^ml7PbX z=7fN%SeXd{WuYXXDpY2YfWr0Wgn+78nF#@9p(LOxRA!QZ!u95afT~!T2?1rHB%mr( zW|Dxy_2z_ts#uu`0cD{ipej^ml7PbX=7fO4V*(0~3n*MJpm3RhvP=jl%OnA1nIxbr z69URIA)qXi1e9fxfU-;oD9eO^vP=?CmPrE2G9jQW69URINkCa92`I~ifWq@$T?i;V zykhcXl7Pa+%iy_`>782$C_L}nLO|hp=avK%u6J%pK;dE!WU37b6~~DqxmZ1+1?e|^ z^rx5^*?55U|M9?Q_KSUSVh^0y@yyD`1E(b-39NoiBPjF^M6y{}My#=J1$3@~c5H5QahtT!RI!rsA2%47HovMR7tc z)Ef_qnc;SMqbZ(~ZNHF5hG;{BBAkZw$J@e!jMz~^j4$Kjhr z0H=`YwXb1VC3k^ahwJvErLec*UT;*IUb{9f5@WZzbHjO;tg9w7TYW!q#Il^rL$r0fLQj3;iWV`)OknQ$A zNw(Yn6xnY7(`38-&yel*e~xUo|MO(K{m+u^_Me4aaQnYNw%h+4*>3+A$#(mnC)@3R zfo!+`OJuwKUnbk_f01mr|0`s>{a+>9?f)9tZvWTGcKg3Uw%h+rvfcid$aeeB!CrRz z&y(%;Um)A!YN zeSW(35bibwp4q&2(#h1K^qG3MLY9dF;Y@yJZOmypTd}u{5p%XGAEZO4U9s1-9)DX& zA3e6Z;&IpNbj8lMwZuOib*!)V>|28?bzLki&?MuL2 zu}7DiJrro=&mJzoLO)M;&pyw!0q1^mJMotDeD>QVz{kn!9-MJ*x^~DsN}*58gE-A+ zcGvp+4lYhP5*I-?74gQ7ozUAGm)}}(dpK^#1oq8nHI^B~eeLZy4I}msp0qx%M39=7 z3pFhji=bYrWy#cd+ZBhL#W0q{tP`eyjZdnP^gE!{Opg-^Nlv22u|xRE==EcVe9|)R zB$_0sbdMB{n4~Z#g?-WrwALhHjnN}Tq9!TANfDp4O3P4VIxH7@q-dW>igHraC*8uv zsY!yU_egy)lhnsaeLm?nHd0LzzQp%P{c;J8w}kh~+5Mc<@00G}4Puh;vxpukW}7|5 zI4S0n-jm;Q^moAkBMqcX(f}t7_@p8&`i(PgGm<@Ql59@0eNu_G4h&M9k>Y8S6z8P4 zPjc|}&?F@oDUmTr2~JA*q%t;YO;VDPlA|Um$w^6{RKdorNg8CN!7-CG$Vr1fsfvwU zlZ5ZDy?4RTgh?9Wq@f-upQF{AamKN}>yc8ECMm^9DW8<5MVdjv(ym7uo-#?poHXo{ z3bZ~mNLbbNNNM@ABmQYgb5hzTEz{D>AYnn*BaK`zdm7=S5uda|t1^RxwOo&snKMZl zPRjVCRa%f4BrM~4q|tekG|EY%KIs;%#S9Wwa6Qu4f=L?Vq%og#o0ee)35&NLY5bB& z8t0^OpL7Qs%O+`pktP;R(gY_>_@wu+(QJ|?8ENv0Nt)!ONuN~2om-PM#Yj_EP0|!6 zP5Gn}Hlj_^G$T#_z$8s`(zH)D&(?3QkIdjSOMdW%ak+ANm-wi zzYru{V5AG{Cg}nvUGPbTxgcqdk>)l`(i|tv`K0BGLDEG=x_H+lUF4*TK51n>NSbG) z`MOD(=cIX`w7L)^Eilr;1CzACNee#d)}(I>rkB}lr$NLSuBNmn@OicczD4U(=h($x=5(p65n>XS;> zf~0GVbnS;G=^7_p^GVM2An7_IUH?0ibe)r~`=s)XAn67p-RPL48=Q2*Csl3+NjDkk z=8j3a$w@bTQgtavT4JQ7U6ZuLNlQJ_vb&tq)>8Pva!)yPk4;jJlX5;OpAYtwXQcc` zCMnNJd7o4$1W5%(D*VVK6*#Hjla`l*q-920-Zx3hoV4tdR#t+f6-HV)Fi9(%wBnOi zSA(QgMp}Jhl2$os6{O5GHbSwf+pgpa!ri{5O;OsTN!3QxE~)%=uiO&88@K=ci=+st zCB-R~x7MsTi8l!=hT~R3u7dxFr{5%ceiAviIF z!kWNl`jtm0-&}5|`y#Yk0ehvLjz#Q{jZF!7tMm+wk@{=@WoRAVtbX9An;*#smD)q> zq7*3F=r|QkMQIB?RhfPyf1_QSqF1qX7;ols?O3~5ZeW_L&D?%F1(ZhPIb+~e`R7NxEKRAT3cS19{w<0F&(KV|hI>N%+?Xh@_zjGn^s?OK$ zKkQ`BbPo8!z`($~*~#D8BUr&HBEVSz2pEB4AU24G0Y(N+hD|^Y6El!tgNU*~X%LSC z$X0-fGcm9T0LA|E|L2FOWMD92VqjR>!otAF!NBm72Obk1 YBHITON2VDSAnpK(F*YFF1LDH~0O^Si0RR91 literal 0 HcmV?d00001 diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index 4d139d7f6b..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/q35/APIC.thread-count", -"tests/data/acpi/q35/DSDT.thread-count", -"tests/data/acpi/q35/FACP.thread-count", From patchwork Wed Oct 18 15:55:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851103 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Zc2yKBPY; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9d0s2Jjvz20Pd for ; Thu, 19 Oct 2023 04:21:01 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8u5-0003BR-PT; Wed, 18 Oct 2023 11:56:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8tQ-0002jz-BK for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8tH-0006iq-LM for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644515; 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=QH9s3dhQtNiDAB8BBK8PkL20rbeESKgpLRTsvRZX/ME=; b=Zc2yKBPYpPu+7niztnrimmUuYD6JKlJgdpZ8J1dIghPd+wa9nencyzoPedhjHUUvceNvNO y4XFkLIfj6+pc/74nS31MT8+VeeahS8d9WeYT9/8v89ZARqWPtTU06cX217FoCITTe0YSI 9oW16Q/CMaTMNKf8hGPXWCnl0QGQrm8= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-402-xa-fIXhVNTiaXR1Et6g1oQ-1; Wed, 18 Oct 2023 11:55:14 -0400 X-MC-Unique: xa-fIXhVNTiaXR1Et6g1oQ-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-406de77fb85so44701825e9.0 for ; Wed, 18 Oct 2023 08:55:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644512; x=1698249312; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=QH9s3dhQtNiDAB8BBK8PkL20rbeESKgpLRTsvRZX/ME=; b=DZoePu6D2NhPfeCFMr++a8uwRWgbBFmjSX9BW9UztT8cuv3ww08aBQn5iPXqNiNt57 ChhdTqP0h2ktQIXDS4EuvyXbuKRArMSzL8Uzq2W44KEz3ALiA4i117PiTylkNQ9Tw7px CpLQ+zJyRAoz9y1SQk0yV+sL2C7o+IM7qfaTKIofOS2DSPEGk3ziVXZJHjNftkYCMbug IjSsQE5YVLs1Ap+emFZBOh85tbmqYqg5lbjjtEO/OlpQq7O8wja9FVXcmv6dx9adC59j B8A4RvDNqMvu0VtsI2sX9m9ujFF2DUvAG8K/8czGgjnY8R8DvAR1Rk6gHO1E8/ttbvDn EtwQ== X-Gm-Message-State: AOJu0YycyZwHJMbVFnmwrcbSKIUl09U/DX4sv/5WyUofbVqSPJuRBlVA 6QTt7CVUil6Gr9fiqTrjV+/uHnGwNsbHWvOEC8LuqdD3tNH46e4590JXN9vym9x19T+CPRroddb /QWhihTmLsgJ0p2cuGLewMyKB4GgngTt3LT/7IR8NQCVLXu8NmHXkHlRE4jQXhF2zFML0bSQ= X-Received: by 2002:a05:600c:1d22:b0:408:41b4:7fe5 with SMTP id l34-20020a05600c1d2200b0040841b47fe5mr504224wms.16.1697644512523; Wed, 18 Oct 2023 08:55:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9Lv8frgzjDMxVODvtkuaDnt7oPgS5RMN+PSyuarkyH7Dsh6kTpizN9fX4uBulYz812YdWDQ== X-Received: by 2002:a05:600c:1d22:b0:408:41b4:7fe5 with SMTP id l34-20020a05600c1d2200b0040841b47fe5mr504212wms.16.1697644512284; Wed, 18 Oct 2023 08:55:12 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id c4-20020a05600c0a4400b0040775fd5bf9sm2090292wmq.0.2023.10.18.08.55.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:55:11 -0700 (PDT) Date: Wed, 18 Oct 2023 11:55:07 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhao Liu , Igor Mammedov , Ani Sinha Subject: [PULL 26/83] tests: bios-tables-test: Prepare the ACPI table change for smbios type4 thread count2 test Message-ID: <76869a486c0150cb66492bcd254e245d3d238161.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhao Liu Following the guidelines in tests/qtest/bios-tables-test.c, this is step 1 - 3. List the ACPI tables that will be added to test the thread count2 field of smbios type4 table. Signed-off-by: Zhao Liu Message-Id: <20230928125943.1816922-15-zhao1.liu@linux.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/q35/APIC.thread-count2 | 0 tests/data/acpi/q35/DSDT.thread-count2 | 0 tests/data/acpi/q35/FACP.thread-count2 | 0 4 files changed, 3 insertions(+) create mode 100644 tests/data/acpi/q35/APIC.thread-count2 create mode 100644 tests/data/acpi/q35/DSDT.thread-count2 create mode 100644 tests/data/acpi/q35/FACP.thread-count2 diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..d17d80e21a 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/q35/APIC.thread-count2", +"tests/data/acpi/q35/DSDT.thread-count2", +"tests/data/acpi/q35/FACP.thread-count2", diff --git a/tests/data/acpi/q35/APIC.thread-count2 b/tests/data/acpi/q35/APIC.thread-count2 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/q35/DSDT.thread-count2 b/tests/data/acpi/q35/DSDT.thread-count2 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/q35/FACP.thread-count2 b/tests/data/acpi/q35/FACP.thread-count2 new file mode 100644 index 0000000000..e69de29bb2 From patchwork Wed Oct 18 15:55:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1850995 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=EsTi1B/s; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9b965ZFHz20Pd for ; Thu, 19 Oct 2023 02:58:02 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8v3-0004TF-S4; Wed, 18 Oct 2023 11:57:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8tR-0002kV-UF for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8tO-0006jC-B3 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644519; 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=+ipRnkY4NnuS9r1wxkgNKOh/7QddOOYjOxyvSDYxSKc=; b=EsTi1B/sByINr+KLeHoH5ZzHWAswAl3LYGs9URRW6sZU3Zf/VFRJbZPYx2fO00cfOWm3sV +mxgdD3PfWHUReu9ie6P9VlId/GrMh9+4ODbC8aA4yR2rwzSPFAmxuAwW8cHQgEPHj8k9s wt+KfIkqjQflUnPW/dVeRYLIhphWeU8= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-470-7VFxPu3LM0i8__FBth6UdQ-1; Wed, 18 Oct 2023 11:55:18 -0400 X-MC-Unique: 7VFxPu3LM0i8__FBth6UdQ-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4083865e0b7so8161225e9.3 for ; Wed, 18 Oct 2023 08:55:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644517; x=1698249317; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=+ipRnkY4NnuS9r1wxkgNKOh/7QddOOYjOxyvSDYxSKc=; b=SDDvoewAjITRwEC3V3pldwrxd7YAEWN+Q2C/I6qHfQYamDr0cbmO+lId2eMIp563Bp BrtG6nHWSDnWpE3ciI2nz88oKxKnUx8/akbbdC7IJ9sAPiRyrryONDDHw6XbT1TXiQDb 71Afngn0LPoUzRl5miihyLKk88XMym7Hpae90fQGS3K2paD119Xygq0rdKnVBLpsQyNA 8xJm5eRc3ngOjOtYMVnBFqnmuk3mzcV7AYfzZyH09sf9LHOpMN2MC/hSys4DGUX3kXbk pZYgNcmeHJKoaahlEpMrbR0la9DLHi8n3GEn1OCo3V1iafe3o3D46gOvS+si437Nq2Z0 9cIg== X-Gm-Message-State: AOJu0Yx5s8gOBQDF6gWbz4NTd4Rm6l0cVvjPptdToh9nCX0182VxpEsK 8zWdOcJglTODjo7831SNMegBfKBzE/q4HMZ1q77bftam1nvtC+j3+bQQoyCFYQa5QRW9/gO5dS6 TqoHtrkNXIIN/s/C2ppKX5FaTfA6t8sSdvsVl74n9B/hO0rxnQcgmOMg166dlzHY6dw2qAaM= X-Received: by 2002:a05:600c:3c96:b0:406:53f1:d629 with SMTP id bg22-20020a05600c3c9600b0040653f1d629mr4184124wmb.5.1697644516796; Wed, 18 Oct 2023 08:55:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGYW+5Q3wvgvSHgK60mRVa+C5bOOnsFRs32f109HwRintm+OGb80khRpfG2BYyMP2l4la1tiw== X-Received: by 2002:a05:600c:3c96:b0:406:53f1:d629 with SMTP id bg22-20020a05600c3c9600b0040653f1d629mr4184104wmb.5.1697644516393; Wed, 18 Oct 2023 08:55:16 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id z6-20020a05600c220600b0040684abb623sm1964428wml.24.2023.10.18.08.55.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:55:15 -0700 (PDT) Date: Wed, 18 Oct 2023 11:55:12 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhao Liu , Igor Mammedov , Ani Sinha Subject: [PULL 27/83] tests: bios-tables-test: Add test for smbios type4 thread count2 Message-ID: <2b04a1eaf75f0a94b40be865198ab746cfb3034d.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhao Liu This tests the commit 7298fd7de5551 ("hw/smbios: Fix thread count in type4"). In smbios_build_type_4_table() (hw/smbios/smbios.c), if the number of threads in the socket is more than 255, then smbios type4 table encodes threads per socket into the thread count2 field. So for the topology in this case, there're the following considerations: 1. threads per socket should be more than 255 to ensure we could cover the thread count2 field. 2. The original bug was that threads per socket was miscalculated, so now we should configure as many topology levels as possible (mutiple sockets & dies, no module since x86 hasn't supported it) to cover more general topology scenarios, to ensure that the threads per socket encoded in the thread count2 field is correct. 3. For the more general topology, we should also add "cpus" (presented threads for machine) and "maxcpus" (total threads for machine) to make sure that configuring unpluged CPUs in smp (cpus < maxcpus) does not affect the correctness of threads per socket for thread count2 field. Based on these considerations, select the topology as the follow: -smp cpus=210,maxcpus=520,sockets=2,dies=2,cores=65,threads=2 The expected thread count2 = threads per socket = threads (2) * cores (65) * dies (2) = 260. Suggested-by: Igor Mammedov Signed-off-by: Zhao Liu Message-Id: <20230928125943.1816922-16-zhao1.liu@linux.intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 395ed7f9ff..1e61ead539 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -96,6 +96,7 @@ typedef struct { uint8_t smbios_core_count; uint16_t smbios_core_count2; uint8_t smbios_thread_count; + uint16_t smbios_thread_count2; uint8_t *required_struct_types; int required_struct_types_len; int type4_count; @@ -644,6 +645,7 @@ static void smbios_cpu_test(test_data *data, uint32_t addr, uint8_t thread_count, expected_thread_count = data->smbios_thread_count; uint16_t speed, expected_speed[2]; uint16_t core_count2, expected_core_count2 = data->smbios_core_count2; + uint16_t thread_count2, expected_thread_count2 = data->smbios_thread_count2; int offset[2]; int i; @@ -680,6 +682,15 @@ static void smbios_cpu_test(test_data *data, uint32_t addr, if (expected_core_count == 0xFF && expected_core_count2) { g_assert_cmpuint(core_count2, ==, expected_core_count2); } + + thread_count2 = qtest_readw(data->qts, + addr + offsetof(struct smbios_type_4, + thread_count2)); + + /* Thread Count has reached its limit, checking Thread Count 2 */ + if (expected_thread_count == 0xFF && expected_thread_count2) { + g_assert_cmpuint(thread_count2, ==, expected_thread_count2); + } } } @@ -1050,6 +1061,7 @@ static void test_acpi_q35_tcg_thread_count(void) .required_struct_types = base_required_struct_types, .required_struct_types_len = ARRAY_SIZE(base_required_struct_types), .smbios_thread_count = 27, + .smbios_thread_count2 = 27, }; test_acpi_one("-machine smbios-entry-point-type=64 " @@ -1058,6 +1070,23 @@ static void test_acpi_q35_tcg_thread_count(void) free_test_data(&data); } +static void test_acpi_q35_tcg_thread_count2(void) +{ + test_data data = { + .machine = MACHINE_Q35, + .variant = ".thread-count2", + .required_struct_types = base_required_struct_types, + .required_struct_types_len = ARRAY_SIZE(base_required_struct_types), + .smbios_thread_count = 0xFF, + .smbios_thread_count2 = 260, + }; + + test_acpi_one("-machine smbios-entry-point-type=64 " + "-smp cpus=210,maxcpus=520,sockets=2,dies=2,cores=65,threads=2", + &data); + free_test_data(&data); +} + static void test_acpi_q35_tcg_bridge(void) { test_data data = {}; @@ -2228,6 +2257,8 @@ int main(int argc, char *argv[]) test_acpi_q35_tcg_core_count2); qtest_add_func("acpi/q35/thread-count", test_acpi_q35_tcg_thread_count); + qtest_add_func("acpi/q35/thread-count2", + test_acpi_q35_tcg_thread_count2); } if (qtest_has_device("virtio-iommu-pci")) { qtest_add_func("acpi/q35/viot", test_acpi_q35_viot); From patchwork Wed Oct 18 15:55:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851069 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=FkFkYWJ3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9ccV69h4z20Zj for ; Thu, 19 Oct 2023 04:03:22 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8vD-0004yg-QO; Wed, 18 Oct 2023 11:57:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8ta-0002nN-EO for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8tR-0006nL-LJ for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644532; 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=5kG6dSpxbgUtbSPh/RmOVRi7KkFbCQn9wyK/IsVOsMw=; b=FkFkYWJ3Z3Tpm++d4rZgvEYy6jlAE4+kcVrmpqlxGo99q42aVoFva1k5/hU4koIFxXopkH IvhBHINneF3IEqwEME1/EhLW7tDrf4DmPExfNG6Fb/rjU1MA/oyqvLMmDinG6sIAEnp4Z+ z7D90p666frY61ZGcXGg8QvKBHKdTT4= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-654-eBQcRv7gOf2n0qcUXB6e5Q-1; Wed, 18 Oct 2023 11:55:25 -0400 X-MC-Unique: eBQcRv7gOf2n0qcUXB6e5Q-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4077e9112b4so25260005e9.2 for ; Wed, 18 Oct 2023 08:55:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644522; x=1698249322; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=5kG6dSpxbgUtbSPh/RmOVRi7KkFbCQn9wyK/IsVOsMw=; b=ioKYbXz/YzRGpznZ77aur92llnuxr+e7L5Zq9cM9y1QnmwF5Pv7iYBDCB67OvBicmz LZD4C0ppD/+0WdJbYPTQeio/SYZsDQrFGTkGxOUNEp22QwQt+QXPSR3OeorLQ8qlS0uh 99MSsPDPJOQ1yVow9r51JUD6yjFVLC/ewqPolkVCJV9DnBrn5n2FXA+bMnNBj2orbsjN PtVvVrVCzJt2V0MKVdmFuEANYlvE4xFUJSxbbTFpkGOi6poyAvTbR/fPn6G2yAr2zABN r1UkRMi/44NA7ltioNqrgF7T/xQYKI7rvGIFHJLMUEnhyHyX+FWAexFCl+15hLiXcW2W ErgA== X-Gm-Message-State: AOJu0YxJX+CRHblBo27nVBvOo+0yNXX/gd2GCQpeul3D1wxA1Z7UiEqV IP8Cewj+z2EYckpwDve9IeckNupAPJhhx5eX/j1Ti/jhw+QtgIH0tWpw/EG6K7jMkpsWYLUxUFJ uVwJImGXxokRefW0q4gD1z4oPmdQGIKA16I8gDrwrUwOMtrXX+gbCwfAqTuUTmHgTFyd8zPE= X-Received: by 2002:a05:600c:4714:b0:407:462a:7e9f with SMTP id v20-20020a05600c471400b00407462a7e9fmr4396111wmo.27.1697644521936; Wed, 18 Oct 2023 08:55:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEU2Snm+4WD0H329uq62aOF2QwFPZ5HsRWWeNVjcQeQ5dZIHjgXxRVj2rCixp1TWlsz2MgMwQ== X-Received: by 2002:a05:600c:4714:b0:407:462a:7e9f with SMTP id v20-20020a05600c471400b00407462a7e9fmr4396071wmo.27.1697644520946; Wed, 18 Oct 2023 08:55:20 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id iv7-20020a05600c548700b004064cd71aa8sm2030937wmb.34.2023.10.18.08.55.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:55:20 -0700 (PDT) Date: Wed, 18 Oct 2023 11:55:16 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhao Liu , Igor Mammedov , Ani Sinha Subject: [PULL 28/83] tests: bios-tables-test: Add ACPI table binaries for smbios type4 thread count2 test Message-ID: <7b78c88ebbfa5668971fe487481381e8936fe9df.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhao Liu Following the guidelines in tests/qtest/bios-tables-test.c, this is step 5 and 6. Changes in the tables: FACP: +/* + * Intel ACPI Component Architecture + * AML/ASL+ Disassembler version 20200925 (64-bit version) + * Copyright (c) 2000 - 2020 Intel Corporation + * + * Disassembly of /tmp/aml-WOA191, Wed Aug 23 22:29:53 2023 + * + * ACPI Data Table [FACP] + * + * Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue + */ + +[000h 0000 4] Signature : "FACP" [Fixed ACPI Description Table (FADT)] +[004h 0004 4] Table Length : 000000F4 +[008h 0008 1] Revision : 03 +[009h 0009 1] Checksum : B3 +[00Ah 0010 6] Oem ID : "BOCHS " +[010h 0016 8] Oem Table ID : "BXPC " +[018h 0024 4] Oem Revision : 00000001 +[01Ch 0028 4] Asl Compiler ID : "BXPC" +[020h 0032 4] Asl Compiler Revision : 00000001 + +[024h 0036 4] FACS Address : 00000000 +[028h 0040 4] DSDT Address : 00000000 +[02Ch 0044 1] Model : 01 +[02Dh 0045 1] PM Profile : 00 [Unspecified] +[02Eh 0046 2] SCI Interrupt : 0009 +[030h 0048 4] SMI Command Port : 000000B2 +[034h 0052 1] ACPI Enable Value : 02 +[035h 0053 1] ACPI Disable Value : 03 +[036h 0054 1] S4BIOS Command : 00 +[037h 0055 1] P-State Control : 00 +[038h 0056 4] PM1A Event Block Address : 00000600 +[03Ch 0060 4] PM1B Event Block Address : 00000000 +[040h 0064 4] PM1A Control Block Address : 00000604 +[044h 0068 4] PM1B Control Block Address : 00000000 +[048h 0072 4] PM2 Control Block Address : 00000000 +[04Ch 0076 4] PM Timer Block Address : 00000608 +[050h 0080 4] GPE0 Block Address : 00000620 +[054h 0084 4] GPE1 Block Address : 00000000 +[058h 0088 1] PM1 Event Block Length : 04 +[059h 0089 1] PM1 Control Block Length : 02 +[05Ah 0090 1] PM2 Control Block Length : 00 +[05Bh 0091 1] PM Timer Block Length : 04 +[05Ch 0092 1] GPE0 Block Length : 10 +[05Dh 0093 1] GPE1 Block Length : 00 +[05Eh 0094 1] GPE1 Base Offset : 00 +[05Fh 0095 1] _CST Support : 00 +[060h 0096 2] C2 Latency : 0FFF +[062h 0098 2] C3 Latency : 0FFF +[064h 0100 2] CPU Cache Size : 0000 +[066h 0102 2] Cache Flush Stride : 0000 +[068h 0104 1] Duty Cycle Offset : 00 +[069h 0105 1] Duty Cycle Width : 00 +[06Ah 0106 1] RTC Day Alarm Index : 00 +[06Bh 0107 1] RTC Month Alarm Index : 00 +[06Ch 0108 1] RTC Century Index : 32 +[06Dh 0109 2] Boot Flags (decoded below) : 0002 + Legacy Devices Supported (V2) : 0 + 8042 Present on ports 60/64 (V2) : 1 + VGA Not Present (V4) : 0 + MSI Not Supported (V4) : 0 + PCIe ASPM Not Supported (V4) : 0 + CMOS RTC Not Present (V5) : 0 +[06Fh 0111 1] Reserved : 00 +[070h 0112 4] Flags (decoded below) : 000484A5 + WBINVD instruction is operational (V1) : 1 + WBINVD flushes all caches (V1) : 0 + All CPUs support C1 (V1) : 1 + C2 works on MP system (V1) : 0 + Control Method Power Button (V1) : 0 + Control Method Sleep Button (V1) : 1 + RTC wake not in fixed reg space (V1) : 0 + RTC can wake system from S4 (V1) : 1 + 32-bit PM Timer (V1) : 0 + Docking Supported (V1) : 0 + Reset Register Supported (V2) : 1 + Sealed Case (V3) : 0 + Headless - No Video (V3) : 0 + Use native instr after SLP_TYPx (V3) : 0 + PCIEXP_WAK Bits Supported (V4) : 0 + Use Platform Timer (V4) : 1 + RTC_STS valid on S4 wake (V4) : 0 + Remote Power-on capable (V4) : 0 + Use APIC Cluster Model (V4) : 1 + Use APIC Physical Destination Mode (V4) : 0 + Hardware Reduced (V5) : 0 + Low Power S0 Idle (V5) : 0 + +[074h 0116 12] Reset Register : [Generic Address Structure] +[074h 0116 1] Space ID : 01 [SystemIO] +[075h 0117 1] Bit Width : 08 +[076h 0118 1] Bit Offset : 00 +[077h 0119 1] Encoded Access Width : 00 [Undefined/Legacy] +[078h 0120 8] Address : 0000000000000CF9 + +[080h 0128 1] Value to cause reset : 0F +[081h 0129 2] ARM Flags (decoded below) : 0000 + PSCI Compliant : 0 + Must use HVC for PSCI : 0 + +[083h 0131 1] FADT Minor Revision : 00 +[084h 0132 8] FACS Address : 0000000000000000 +[08Ch 0140 8] DSDT Address : 0000000000000000 +[094h 0148 12] PM1A Event Block : [Generic Address Structure] +[094h 0148 1] Space ID : 01 [SystemIO] +[095h 0149 1] Bit Width : 20 +[096h 0150 1] Bit Offset : 00 +[097h 0151 1] Encoded Access Width : 00 [Undefined/Legacy] +[098h 0152 8] Address : 0000000000000600 + +[0A0h 0160 12] PM1B Event Block : [Generic Address Structure] +[0A0h 0160 1] Space ID : 00 [SystemMemory] +[0A1h 0161 1] Bit Width : 00 +[0A2h 0162 1] Bit Offset : 00 +[0A3h 0163 1] Encoded Access Width : 00 [Undefined/Legacy] +[0A4h 0164 8] Address : 0000000000000000 + +[0ACh 0172 12] PM1A Control Block : [Generic Address Structure] +[0ACh 0172 1] Space ID : 01 [SystemIO] +[0ADh 0173 1] Bit Width : 10 +[0AEh 0174 1] Bit Offset : 00 +[0AFh 0175 1] Encoded Access Width : 00 [Undefined/Legacy] +[0B0h 0176 8] Address : 0000000000000604 + +[0B8h 0184 12] PM1B Control Block : [Generic Address Structure] +[0B8h 0184 1] Space ID : 00 [SystemMemory] +[0B9h 0185 1] Bit Width : 00 +[0BAh 0186 1] Bit Offset : 00 +[0BBh 0187 1] Encoded Access Width : 00 [Undefined/Legacy] +[0BCh 0188 8] Address : 0000000000000000 + +[0C4h 0196 12] PM2 Control Block : [Generic Address Structure] +[0C4h 0196 1] Space ID : 00 [SystemMemory] +[0C5h 0197 1] Bit Width : 00 +[0C6h 0198 1] Bit Offset : 00 +[0C7h 0199 1] Encoded Access Width : 00 [Undefined/Legacy] +[0C8h 0200 8] Address : 0000000000000000 + +[0D0h 0208 12] PM Timer Block : [Generic Address Structure] +[0D0h 0208 1] Space ID : 01 [SystemIO] +[0D1h 0209 1] Bit Width : 20 +[0D2h 0210 1] Bit Offset : 00 +[0D3h 0211 1] Encoded Access Width : 00 [Undefined/Legacy] +[0D4h 0212 8] Address : 0000000000000608 + +[0DCh 0220 12] GPE0 Block : [Generic Address Structure] +[0DCh 0220 1] Space ID : 01 [SystemIO] +[0DDh 0221 1] Bit Width : 80 +[0DEh 0222 1] Bit Offset : 00 +[0DFh 0223 1] Encoded Access Width : 00 [Undefined/Legacy] +[0E0h 0224 8] Address : 0000000000000620 + +[0E8h 0232 12] GPE1 Block : [Generic Address Structure] +[0E8h 0232 1] Space ID : 00 [SystemMemory] +[0E9h 0233 1] Bit Width : 00 +[0EAh 0234 1] Bit Offset : 00 +[0EBh 0235 1] Encoded Access Width : 00 [Undefined/Legacy] +[0ECh 0236 8] Address : 0000000000000000 ... APIC: +/* + * Intel ACPI Component Architecture + * AML/ASL+ Disassembler version 20200925 (64-bit version) + * Copyright (c) 2000 - 2020 Intel Corporation + * + * Disassembly of /tmp/aml-UMA191, Wed Aug 23 22:29:53 2023 + * + * ACPI Data Table [APIC] + * + * Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue + */ + +[000h 0000 4] Signature : "APIC" [Multiple APIC Description Table (MADT)] +[004h 0004 4] Table Length : 00001CE6 +[008h 0008 1] Revision : 03 +[009h 0009 1] Checksum : CA +[00Ah 0010 6] Oem ID : "BOCHS " +[010h 0016 8] Oem Table ID : "BXPC " +[018h 0024 4] Oem Revision : 00000001 +[01Ch 0028 4] Asl Compiler ID : "BXPC" +[020h 0032 4] Asl Compiler Revision : 00000001 + +[024h 0036 4] Local Apic Address : FEE00000 +[028h 0040 4] Flags (decoded below) : 00000001 + PC-AT Compatibility : 1 + +[02Ch 0044 1] Subtable Type : 00 [Processor Local APIC] +[02Dh 0045 1] Length : 08 +[02Eh 0046 1] Processor ID : 00 +[02Fh 0047 1] Local Apic ID : 00 +[030h 0048 4] Flags (decoded below) : 00000001 + Processor Enabled : 1 + Runtime Online Capable : 0 + +[034h 0052 1] Subtable Type : 00 [Processor Local APIC] +[035h 0053 1] Length : 08 +[036h 0054 1] Processor ID : 01 +[037h 0055 1] Local Apic ID : 01 +[038h 0056 4] Flags (decoded below) : 00000001 + Processor Enabled : 1 + Runtime Online Capable : 0 [snip] +[434h 1076 1] Subtable Type : 00 [Processor Local APIC] +[435h 1077 1] Length : 08 +[436h 1078 1] Processor ID : 81 +[437h 1079 1] Local Apic ID : 81 +[438h 1080 4] Flags (decoded below) : 00000001 + Processor Enabled : 1 + Runtime Online Capable : 0 + +[43Ch 1084 1] Subtable Type : 09 [Processor Local x2APIC] +[43Dh 1085 1] Length : 10 +[43Eh 1086 2] Reserved : 0000 +[440h 1088 4] Processor x2Apic ID : 00000100 +[444h 1092 4] Flags (decoded below) : 00000001 + Processor Enabled : 1 +[448h 1096 4] Processor UID : 00000082 [snip] +[1C8Ch 7308 1] Subtable Type : 09 [Processor Local x2APIC] +[1C8Dh 7309 1] Length : 10 +[1C8Eh 7310 2] Reserved : 0000 +[1C90h 7312 4] Processor x2Apic ID : 00000381 +[1C94h 7316 4] Flags (decoded below) : 00000000 + Processor Enabled : 0 +[1C98h 7320 4] Processor UID : 00000207 + +[1C9Ch 7324 1] Subtable Type : 01 [I/O APIC] +[1C9Dh 7325 1] Length : 0C +[1C9Eh 7326 1] I/O Apic ID : 00 +[1C9Fh 7327 1] Reserved : 00 +[1CA0h 7328 4] Address : FEC00000 +[1CA4h 7332 4] Interrupt : 00000000 + +[1CA8h 7336 1] Subtable Type : 02 [Interrupt Source Override] +[1CA9h 7337 1] Length : 0A +[1CAAh 7338 1] Bus : 00 +[1CABh 7339 1] Source : 00 +[1CACh 7340 4] Interrupt : 00000002 +[1CB0h 7344 2] Flags (decoded below) : 0000 + Polarity : 0 + Trigger Mode : 0 + +[1CB2h 7346 1] Subtable Type : 02 [Interrupt Source Override] +[1CB3h 7347 1] Length : 0A +[1CB4h 7348 1] Bus : 00 +[1CB5h 7349 1] Source : 05 +[1CB6h 7350 4] Interrupt : 00000005 +[1CBAh 7354 2] Flags (decoded below) : 000D + Polarity : 1 + Trigger Mode : 3 + +[1CBCh 7356 1] Subtable Type : 02 [Interrupt Source Override] +[1CBDh 7357 1] Length : 0A +[1CBEh 7358 1] Bus : 00 +[1CBFh 7359 1] Source : 09 +[1CC0h 7360 4] Interrupt : 00000009 +[1CC4h 7364 2] Flags (decoded below) : 000D + Polarity : 1 + Trigger Mode : 3 + +[1CC6h 7366 1] Subtable Type : 02 [Interrupt Source Override] +[1CC7h 7367 1] Length : 0A +[1CC8h 7368 1] Bus : 00 +[1CC9h 7369 1] Source : 0A +[1CCAh 7370 4] Interrupt : 0000000A +[1CCEh 7374 2] Flags (decoded below) : 000D + Polarity : 1 + Trigger Mode : 3 + +[1CD0h 7376 1] Subtable Type : 02 [Interrupt Source Override] +[1CD1h 7377 1] Length : 0A +[1CD2h 7378 1] Bus : 00 +[1CD3h 7379 1] Source : 0B +[1CD4h 7380 4] Interrupt : 0000000B +[1CD8h 7384 2] Flags (decoded below) : 000D + Polarity : 1 + Trigger Mode : 3 + +[1CDAh 7386 1] Subtable Type : 0A [Local x2APIC NMI] +[1CDBh 7387 1] Length : 0C +[1CDCh 7388 2] Flags (decoded below) : 0000 + Polarity : 0 + Trigger Mode : 0 +[1CDEh 7390 4] Processor UID : FFFFFFFF +[1CE2h 7394 1] Interrupt Input LINT : 01 +[1CE3h 7395 3] Reserved : 000000 ... DSDT: +/* + * Intel ACPI Component Architecture + * AML/ASL+ Disassembler version 20200925 (64-bit version) + * Copyright (c) 2000 - 2020 Intel Corporation + * + * Disassembling to symbolic ASL+ operators + * + * Disassembly of /tmp/aml-LWJ191, Wed Aug 23 22:29:53 2023 + * + * Original Table Header: + * Signature "DSDT" + * Length 0x0000F8B7 (63671) + * Revision 0x01 **** 32-bit table (V1), no 64-bit math support + * Checksum 0xB7 + * OEM ID "BOCHS " + * OEM Table ID "BXPC " + * OEM Revision 0x00000001 (1) + * Compiler ID "BXPC" + * Compiler Version 0x00000001 (1) + */ +DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ", 0x00000001) +{ + Scope (\) + { + OperationRegion (DBG, SystemIO, 0x0402, One) + Field (DBG, ByteAcc, NoLock, Preserve) + { + DBGB, 8 + } + + Method (DBUG, 1, NotSerialized) + { + ToHexString (Arg0, Local0) + ToBuffer (Local0, Local0) + Local1 = (SizeOf (Local0) - One) + Local2 = Zero + While ((Local2 < Local1)) + { + DBGB = DerefOf (Local0 [Local2]) + Local2++ + } + + DBGB = 0x0A + } + } [snip] + Processor (C000, 0x00, 0x00000000, 0x00) + { + Method (_STA, 0, Serialized) // _STA: Status + { + Return (CSTA (Zero)) + } + + Name (_MAT, Buffer (0x08) // _MAT: Multiple APIC Table Entry + { + 0x00, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 // ........ + }) + Method (_OST, 3, Serialized) // _OST: OSPM Status Indication + { + COST (Zero, Arg0, Arg1, Arg2) + } + } + + Processor (C001, 0x01, 0x00000000, 0x00) + { + Method (_STA, 0, Serialized) // _STA: Status + { + Return (CSTA (One)) + } + + Name (_MAT, Buffer (0x08) // _MAT: Multiple APIC Table Entry + { + 0x00, 0x08, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00 // ........ + }) + Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device, x=0-9 + { + CEJ0 (One) + } + + Method (_OST, 3, Serialized) // _OST: OSPM Status Indication + { + COST (One, Arg0, Arg1, Arg2) + } + } [snip] + Processor (C081, 0x81, 0x00000000, 0x00) + { + Method (_STA, 0, Serialized) // _STA: Status + { + Return (CSTA (0x81)) + } + + Name (_MAT, Buffer (0x08) // _MAT: Multiple APIC Table Entry + { + 0x00, 0x08, 0x81, 0x81, 0x01, 0x00, 0x00, 0x00 // ........ + }) + Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device, x=0-9 + { + CEJ0 (0x81) + } + + Method (_OST, 3, Serialized) // _OST: OSPM Status Indication + { + COST (0x81, Arg0, Arg1, Arg2) + } + } ... Signed-off-by: Zhao Liu Message-Id: <20230928125943.1816922-17-zhao1.liu@linux.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/q35/APIC.thread-count2 | Bin 0 -> 7398 bytes tests/data/acpi/q35/DSDT.thread-count2 | Bin 0 -> 63671 bytes tests/data/acpi/q35/FACP.thread-count2 | Bin 0 -> 244 bytes 4 files changed, 3 deletions(-) diff --git a/tests/data/acpi/q35/APIC.thread-count2 b/tests/data/acpi/q35/APIC.thread-count2 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..2c6ab5d96c275f8e4872ff91ce3006f992ef3c36 100644 GIT binary patch literal 7398 zcmXxoWpotg7DnMOKp+Y34hin=9^BpC-QA_`?(XjHrQT9^_m;Z5!JW<7Hw*gC!%TiO zbe%oZ!qG$e?XQ(m(S3bK^&31czwhMH{qi$kSt%tRvnhRa;Lzrz6q}V5Tck*A(W0@% zip6GU#}+RhTcSj4PEKrYZfss&Y{`N2X9$TYEY|WanwQ9xIt{q#aPHf$}vGH?BIRypbdi7%K*N<(` zAhuz{*hYNN)7WOsVw*RQZP6mOWy{!BtzuiZj&0K>wr$(kcI{%@w~y`6 zA+}@3*iM~dJ9m!l(j~TQ*Vt~|V!L;b?a?E)XV2JPy<&U!j_uPYwy-d^Z{OH{@!v^K z|Nh|t17Zgbj2$#6cJScXAwyz^4vif)EOz+t*byUQM~;jgH7a)W=-4r1V#kh+9XBp^ z{P@@j6JjS$jGZ(ocJk!dDN|ynPK}*5Eq40!*cmfoXU>eBH7j=Z?ASSTV&~3{oi{Ib z{`}Yl3t|^8j9s)ScJboaB}-zLE{$EbEOzew}FV%M&XUAHcF z{rcDq8)7$ZjNP;;cJt=gEn8x@ZjIfxEq43%*d04!ckYbcwJUb_?$|wh*xYiNe`Fr; z_%NNN57!(BoD@K0$M6@QIp( zgHO^N9(=Oq0O3U?ImGx@ z%|XVuX$~{KU2~xE9hyUp@6;S@e3#~MLkmm5?hcyAfdo>}zkLW)7QC+AX(*z>(D?P3W1%5&k4E&@Xpr6tM_0yV=@cL&o zLBabpVZqO80)wB^ga$va2@ZZi6CV7cCP4TlO^EQzI)aqaD>}lI(yKZGmC|cELY30% zI)atb8#=<3(wjO0meN}~LYC6oI)awcJ37La(z`kWm(qJWLYLC}I)azd2Rg!+(uX<% zn0W`NBZMh^tY`DX$b5a0`ArYz=udS7GNsRSgfgYibp$h|{d$4l|Ak(tztoHLS2}{4 z($_k|n$kBq0-MseIzpS$cRGTb()T*To6-+D0-Vy1IzpV%Pdb8}($6}=oYF5k0-e&Y zIzpY&Z#sgV((gLLozfpV0-n;JIzpb(Upj)G(%(A5p3*-$0-w^qIzpe)e>#Gn(g7Xe zPwAkJHvk!Ae(wDJ#v6eQ^=|(@=seHw(RBXM`-38x@6CMCd7P!QbrD@$7u6+nF-_adA!OaS2W5agL_*I9JnooTuqLE~)7}E~V)_F0JW2E~Du@F01K0E~n`{F0bi4 zuAu2WuBhoeuB7QauB_=iuA=EYuBz!guBPccuCD1kuA%8XuBqufuBG#JZC#-2Xgbg9 z>uNfW^EI8v1)9#|db*LWuN&(In$Gk3hMLafMw-s!#+uIKCYsLUrkc*H?wZcy9=eb2sS9;4P3L)iZ%yZMA5G_Rp{Db=ucq_3pB|+9YdX*K12mn- z12vt;gEXDTgEgJULo}VoLp7bp!!(`8!!@19BQ%}IBQ>4Jqcokzqcxq!V>F$|V>O+} z<20Se<29Yf6EvO26E&U3lQf;jlQo^kQ#75&Q#GB((=?sO)AejUL(kDOHJ#`6voxK@ zvo)Q^b2OdDb2XjE^E92u^EI8v3pAa_3pJg`i!`0bi#46cOEjIwOEsOx%QT(G%QcR+QD>a?Rt2CX*t2Ld+Yc!q5Yc-w6>olFm>ouLn8#JBA8#SHBn>3xrn>C%sTQr@= zTQ!}>+ccfW+x2d}L(_Sl->DDNyY%6Dw?0De(MRf3G~OQ^rL*+Wx`;kT7uCn=V){6p zt&i8m^$EI!K2hiBlXR{=S?B3fbV+@xE~QV?rS<8$j6Oq`)o1E*`Yc^upRFtCb96<0 zuCAod)0Or4x{AI)SJfBlYWgBwU0eW|XcFVnU4<+_f(Lf6$->U@2bF3?x& zdiok&Utg;m=<9SteZ6j^Z_thPjk<}xNjKFu>t^~E-CW)!ea-A6yE3-wdFuYOwh)6eMsdY>MkpVb5Pb9#_|UJuqU=pp(=JygG>hv}E~aQ%uN zpReqE2&Z|E`lO+8k>rN`;F^?3b`o}k~=6ZLy~l73%L)*t98`a?Zcf261B zkM(r@iJqZ9)id>HdY1lN&({0(9Q}o!tH0Fq^jCVm{#q~4-{^(#-}M^(hhD4y)a&$LdcFQzZ_xkfjrw1`N&lxe z>jQd=KB%|qlL(lG{Po8fY4iLqN0#OC{{L`3Iswz)1V2xDv_cTQHla$H)1cS*n97a zy({+Kd+&;scjoNup8uTt_+8)gTWCXYN&oqX-P#xI4dPBT)#HUtm&7M%-p?7OD0x?&zakJR%7GR zjg8@HO`++R=4_cht!e$H#_1uxXxa3pNQ4(TquV#sl{D0^t7=mdtIE%8sH`f@j_!zL zW;Vp)tJKVfiB+Yc+%YX0#?{5rHZKUpN+%a=9h=@fw{81KPJQ*;MZfpzKJu)|OQYNO ze|`4m1(7tmppgEXN&hWs;$Iq9HAZ?iZp}HPd0u!mr<;!zY;Au=v-xoRu^j$LQzJie zNp}1pE>*B?LGI}EveLThR$GTQ&kr@VO$~<{w{|@vzJVRXp8B+|cxCnJoxZB>@<^YuhW*ePgFkD4U;h{@+czcI|pFz6|B82<42)9mG!_KXLVIYGQR0 z!dct1BboJUb2y06;}i4fm(slYHFag9=u`D%b|j5HR~*Dj^2hwo-kzQhm14eNu>hwpM+%R(-bCeNu>hwo!eyQGK@2eNu>h=BPe% zRG&GzPYSWmwyMvzs?WB%PYSWmcB;>Is?T=1PYSWm_NveJs?YYiPYSWmT-9f;>N8jO zNg?*xLG{@|_1Qu9Ng?*xQT5qT_1RJPNg?)0V=VqP%Y0Spr26cn`=k*2?5z6itorP% z`=k*2>|!#b@|CcQ$t;mCc3t9`F&lDbsa)GtWp-7WU3DgfnAuHbc2k+%bS8zE*)CWV;ULuK|*nLTtSg_zmXWG24G_cWP_ukk(OnTapl6mn)_lJrt$FJ<=9CWUb` zlLlxM253cH713sxhG|W(3{VP)jR&a|Bv2Zl@$1ZQqHu__68j4i8ox9-Kq*YLMguf{ zZDN4Jr9436mnH`&g|wT*0F7TO5t~#sF)=wa@r>~RrI2=HuB8DQzg8mY(PZ)fjbEAw zu}>PH@vCJj)ylm}@1Qe*M}r7+Pa4bb?tCX)sz zT*?D9eyPdi0ZL(_Pa2@{YfUB%P`H!_X#7%>$pe(a#OIR+X#84}Ndpuv$pe(aM4vQ3o64^RpdebNAp zUu!aHfWoCbK;xI1Odg;VCiDNOW912lfE$)o`am+}CO zUurUWfKr&~lLjb7FhD870ZJhbPzqsyLM9DR$m9VEnLI!tlLjbc(g1}_9-xrP0~9i8 zfI=n>P{`x~3Yk1WA(I9uWYPeIOdg<+$paKJX@F9c`0UaErHDRb=E>v%N+Eq35+P?M zo?9BA6eXTp8lV&|vZ^J9^8`n9TQ)!ay% z5U;3EZGQc_F)e7$M-#8aWVeaG{*p;_UE7Y4_9wIswM?Z66{4@fA^K_>S`o@^(@-}d z8rsHNsHq(v&28IIT2&WX&Fjb-^GF+hL4&V|)tb0dLtSlMc=KG@1M~d2=p~LG{vY%b z&`XS7LirmboH(EO;z55kpg->M z7bo>&xf$kT>kgjX=5hW8QLsKL;IjIr=+Dpj`YhZ@Iwl>yEk{{lz3uF8-Le zT;TUTiTG9JJd{`CVr%`i65G_vN4j=xHbFq=EhKSBfTEGEwr`u>CMwZ zXHLrwefVqoHX4pJ()i`|wvpBw=vxpj9-?p7=mquMhKic_=do2ZR#TOqpFcE|vwnN4 z_#P`GQwOIeUU09eEvrjxH$q<|XuGXqH52nH7cFgCxNJ_|;#o@;En7Te){;QZ`nza3wh8mlWClSh}AMknOa>(*6ct1_EH{9ygMHMh5#YJN08JBsg8 z`YFigeZ+sTlAe3YS>f1(@`F;gMw;h_HpHmidAtnsvS8lUtme6q6kZp`*QvZNim%gn zJtV$P=XG&>ox$s&@pTJc4~wrec|AP7ZprHr@pXjP(fB%x*Cp|FHm_sxbt_(%#@DTR zT^3)r;dOa@okQya+CJ~OEw5$&?RYKwZ_jJle=e_O{~dTO`|rqW*?%Wq%l=%akJqyQ z{=Am`@5XD{{{UXg{&(lK?0*kl%l`M|wd{W&uVw#x@mlu3H?L*?gLp0bAIxjne?F~? zWd8-cmi-svj6>f zE&Jb}*RuZucrE)skk_*Rk+dEn`;YQk_Fuwl*?)}Jvj0+E%l^xFE&DI$wd}uw*Ruag zUd#TgcrE)M#cSFBXkN?y$M9PAU(IXT|5#qj{>SlJ_FqHmV%h(AUd#S#c`f^|055+5a?N%l@bHTJ}GK*Rubayq5jX;b9gQLpUZ36|2$sH{^#>r_P>DF zvj2s=mi-^bYuW$dyq5hh;=$P z6t89f%XuyPU%_kH|4LrV{#Wr@_J1_5W&f*rE&D%)*Rua(c`f^2L+jzP|Fyi9{jcM- z?0-G4W&g+VTK0cDuVw!mcrE+i$ZOgECSJ?_PvEuee>1OT|0nWV_J0zuW&bDhTK0bm zuVw$I@>=$P8m&jj{!iz%?Eeg2%l?~rE&D%{*RuaDyq5i+#cSFB*}RthpTld}|GB)D z{h!Bc+5h>xmi=GAYuW#Wyq5i6#B16A#k`jNZ>4oq_J0YlW&fA*TK0b#uVw$+crE+C zoY%7dD|jvYzmnIo|EqW{`@fpkvj1y%E&IQg*RucXcrE+Cp4YPf8+a}IzmeCn|C?xC zBKyCY*RuaxcrE+CmDjTW+juSezn#~z|2uds`@fUdvj4kyE&IQl*Rub6crE+Cm)ElY z`*-NX; zwe0^%Ud#TU;Bwd{WftxIM9FY;RU{}Qid z|1a}e_Wug6W&f}8TK4}MuVw$Q^IG=*2CrrRZ}M99{}!)h|8MhJ_WusAW&iK;TK4}Q zuVw%5^IG=*0j=%)8LwskpYvMw{{^pQ|6lT2 z_Wu>HW&dCETK4}9uVw$=@>=%)9j|5o-}74b{{yYdW&c0&TK4}FuVw!~^IG=*3$JDW zzw%o4{~NDm|G)EE_P>+Yvj0DLE&KnI*Rub=crE+?o7b}ce|RnX|CiUY|6RPM{bx7N zrJsXrh!ybP|2YVofI8qH#RSv>2dO5Y9ymxd0X4xvx(TQY4l+zYZE(=S1k?uynI@n{ zIB01C>V$)c38)ngvP?j|aFA^RYKDVWCZKLOXl(*&hl4gIkbZJF;BN@{BW+C}{j@WI z^wZu1(oe1lq@NBZkbXLvK>F!q0_mr-38bGcCXjx*nn3#LW&-J_y9uP99wv}}dYVA` z>16`xCyxXE27&wOZ35}1j|rroz9x`<`k6rb>2Ct*XEzf_KLbo4{p@Z6>1PiUNI!d; zK>8VI0_kTj6G%UMn?U**WCH1DunDA}d=B^<2JWZ81kz8T38bGQ6G%TpOd$Ofn?U** zY69tJm8I2L(odNQq@QvVNIw-OkbWvnApKOCK>8VF0_kV838bGfCXjxrO(6Y@ zHG%Xq&IHm=4F~)U1@|-F1kz8f38bGo6G%T3Od$PCG=cOp$pq5RWD`g~Q%oTJ9ApCN z=U@{^KlLV%ex{m0`Z>e|($AqLkbW9WApJCQz~5kSKhsPg{Y*E3^fSW*($7p2NI$bo zApOiXf%G%S1kw+`cv8UMXs|QS1k%rZ6G%S`Od$O%G=cPUmn?U+mVgl)BsR^W?WhRh*jx>SvbCe0BpXDZyepZ-3`dMiL>1UM*q@SZr zApNX1f%J2X38bH6O(6ZO;efvZ;eOVdK>Ar{0_kVH38bInOd$OnZvyFOg9)UcjV6$O zHkm;BIl%u2($C2zkbX`vf%J2#38bIXIN)zcxS!KaApM+S0_msO z1k%r$CXjx%m_YhD%LLNT*(Q*F&M|@XbFK-bpYu#0{hV(C>E{9yNIw^vK>E4J1k%sN zCXjx%a=_o9a6gxrK>E4V1k%rCCXjx%nLzrv+yv6k6(*2=t~7!4bCn6CpQ}wE{aj-L z>E~J#NI%z^K>E4f1k%q9CXjw^G=cPU69@ba3-@!g38bG}Od$Q-Y69u!HWNrcx0^uv zxx)m~&z&Zae(o}X^mDffq@R0CApP8H0_o>I6G%Vzn?U+`zy#9IgC>xEwsXMWz;Hhg znLzq^*aXtgBPNi39yNjV^Oy;wpT|ug{XAg;>E}rkNIy@RK>B&w1k%qlCXjxfHG%Z= zoC&0#=S?8}ykG+9X9oxT4Gs76q6ws*mrNl2ylevL=M@u3Kd+iV`gzR+($DKAkbd4U zf%NmH38bI5Od$QdZ35}%9TP}D@0vjRdCvsW&-*5jem>xUzro>tJ~V;!^N|UppN~x- z{d{5q>E}}uNI##MK>GRI1k%qJCXjxB6G%V5n?U;6X#(lz4--f~f0{u0 z`O5^-&)+7He*Q6m^z*L?q@P_TkbXib8)AjY?|)1n{iK*c`bjl`^pj=+=_lO;(ocp7 zq@NZh7&b4rGJ{TKL|fMPojN!Te~iRG9^zva?!)w>oF+bK((HbKe?Zg}X+y^;0v{PO zdRt>|bvpmh=zoL4ZYiqZt)E-jF;*8FoB1DYWX8spO>UR6t0^?2DLnJi@^;NL!%d-? zP2t9-(6md(W}nvF7~V1?D>H>!YntJrre*g*`k~j>PFvhZ>Bn9(F5lX+d0J!_L62SDO@XI|K1g}XX7IVDvb6ZY zCN4NVG=qPhHiLlr0)KOXTC|^K)BR6$b<5bex(V6;@kIN7zXa;jlh-uQ^V~E=Qrt)R z()sR#^fY^SSHFHZ{q!xLe|#F^V>9$SJ98WV{-z%=R!1ka&5C4(=+02S-zc{=o!pv` z#m$7~&YNGqzATMW3(T!ZDwS^YNv4LwCN--;e*BpqhB9GOrjpAP(yhI0(9dWSJK+0u zl66v2Or7jxok$AZ6p`3ZB*j)LqO&q?CHgsZvQjD?`!cO2b`(j)N~yNe5c+AdTZ!(X zNmfcrb1S7`r8HZqm~XUlx}zInl9kfa-Ad_LDcx2YO1B2PmFUOT$x0a+Zlw&Ylwm6k zqg#dDN_3k_vQmo{ZlxAjsfDdHoPLA2mFVDKvQlQITPYJOW!g$3%+K-l?}C<4sinE` zjeeUZKX)y$QcGJY%D1&S&v*nXMI!E=B3LP6E0yrgaZaTys6;Pv@rPkgSy(B{R*KOL z5N@SxsFZC^2x6sdtdwmlmC~)qZlzXGsZ}d?Ppz<0D_g0IZcTP8wT4QqTf3E7W2M%% zQaRnK>{g;XG?Kpy+O%;iwZTell9dYb`Tiv58K*m#l9h6D+)6oEDaTeS;M=LB$*t50D|ND!hSROnZl%spsdHzyQfI8x*;X1sw^F;6 zxOWDN1LP+)7=cQrE6-rLI`1tF2T*w_3ZExeh))C(&0>g87Ig_U|GD;4JF1uNx2rT8Ix{5qb8mGW$*g5JSOy`fU?-tL}yW2N4< zQemH9r9M!pPan5ZAFR~JRx0Wntkf4O_3i6c>Wh{7+Db$E1uOM~O8xq|mHJ_&ezsC^ z|6ry5P^o`^w^Dzs)ZbPbx?8Z)Zcu5r-P}sMVWr({rC|etl?Fhi0R!Ah1F+HnTWR?2 z!AiSBrQLUTEA5VzcDI#A>=CTA2UOZ)54X}DSZNPiDY|E{(wE6LgdqbtY_jW7ojg|JcmC6PM zD-D85g9f>k24ST^wo>`vV5PxOY4BjT(qODKI9aJkzMWIwOVK~ck(`|Q`EI3rtdwsn z6%+*bQ~;F<%y)nIm979Q71&CJg~3XNP^qxc-BTe}Dzue~ih`Ajpi)thTd4>u71>Hd zh6F1Ofl5P$xRr)rr6IObadEIxF;prpb}JQQrD9uY=+I!Lp-^e)P`A=htTfbC8a6Cg zX&6)*Hq5Ow3@Z(@m4*)wRvHeKh7Wfu4aZ8uZKV+-f|W)+E5-H;R@x6L?YEy>X+NyApRH87f3VX2 zP-*}D-AemorTuNCvIByZ4uDDr9N<FesURAxM2BCJU+JPzw^9@mb!c5Lt@EFrM6OWS+EivkVsZ4 zD|0LHd9P%pGFxeAd9V_laY~djg>~*O0hA)N@JkXm@#gpF<5DgtyEeatVBnElFxW`wOgqg zD^=S{Wn+Vt#zLjBW8F$)vC>#useD|p(m1FzZk$_b999~atW=y|6RcDNm1=6-N;O!i z##SmAAFMPUDvclSRvM3$#@kATwZTfYP^q@otyGJZYHg*Wx?m+bT$KFW)z!I`>abFs ztu$mpuo9j9N>-XM!L2j_D^0MKiYEpuO@vAlC%Tm;Vx@_;($Go4N|T_{q)Be2Nmyx; ztu$taOmA z6g@at>0qdI@WF1SgR#=Vwo*xbuu?r#s;_q|)nlc4TPZd*SZOL$nmX03G!-jNwUtT_ z3067;Djjl&Tj>z2bcn4~c4)BDp-}12L)}V;Vx>cErSgVgr3R?f(BM{Tz)B6tN<;G- zgOwVgQe&fAsSztR+DZk}f|aI0rD@aLO4G2?G+U`~da%-Ts5E`LTWLC0nrRisd!ef(k!SnYnEGS7FL>ND-E3;tTY=c z&7SR6nvIoa+e*Xc1S`#fN^|D8mF8fjIkwX9xxq?vq0-#BZl$?cX|Am_VqUP)Jg78p zo?B@iR+?ukMdt@A&4)_!=ew2WW2O1FQpti~r3FxF!2-9^0<5&aR*EeQR$2&^7Sg|D zssHY~5GyUTl}Zl_RyqtS9d?*o=`gHxn5|THc(BspQ0ef)-AadJrNeEd@V(UM@LB~WR}61UP4thB^d8nQH4X(?1%y40<-6e}&Ym5P@ID=mXc%a*y7 zmSLr3w$jiegO!eiN=F{)Ryqsv|@!@X$4kVVJk&f1}m+EN-I~ol~!Vm6Y|3hS*vubq2@RKlM>tIhrzwGNdSl@q|I)2u*06ZHtEE8%n{@Xc^6 zobCvxqj0(v{PW=qC7hvz91+fNgfmb$!wUZS(5!@JCGgF2+(WY?G^5aL1^;|FQwe7( zp`8e4I>MPKoM{FBeAuFdElOxF!WKu^g2EOn_~*k}N;pdid=nl&OJ_O4Sty)k1^;|F zTM1_?p@Rr#JHpv0oNWdFd^kr5=O}@1+T$M1afEYFIL8Y9`Eafh&Q${6%*VpHj&Lpt z=UTx(AI?+4c}n1${8%{85za&5JS+I;!}&@$UkQBk9}DL@!ucqiZw3E+xIhUPD1mPZ zWZ?owxB!IX75wwzA|+g;1ip!og^L{FA`~vNf`2|- ztb~h|z&97NaIqs?jKal9A?lwGTa~a?34GHb3tJswD+*h!;GYkdDB%(%@Xd%UT;d3q zpm2#5{PW>bC0we6JP|H+giBGl)C&IjaG4S=Q$lYME^~y-P`Jzr{`s&?3EPywH#O4# zg|<1uHWap5!9O1^SHk5=;F}#;xZDvgN8xfS_~*kFO1MG^d=n%KS2)5IC|qF$|9rSo z30EqizX(@4!j&joX$Aj$xJn6EDS>aAo+a5V~7 zTfsjcu2I4@O5mF;S-8d#u0i1%EBNQbwMw{F34HS<3)ecrwJ2O`1^;}wP6^j3fp5xW z;W|gS4u$Ki;GYlIE8%)2@XeYmT<-|iqj0?y{PW=kCETC{zKN5C8yw*V6mGDBe?Hu( zgd3H>H+Qmdqa)mi!i`Cx#6KTyQo>D2;F~^KxXBT2Lg6MW_~*mTO1N1Gd^0EuH#@@3 zDBNrX|9rSb3AZSLZxUtU7Du=RgIk=@aH|#k^Wion+@^#= z5pHvY+fca83jX|*{f=-y3in&VKOY`Y!UIa+n`l{hz!4rm;Q=f7=fi_a zcu)y^b1e%GI>Lh}JeU+>{`s(73EP#xH{G(Z-4V8GxtBRqn_BUbRwhewt0s1o?5Ui!b# zqmJ+>3XfXBKOY`b!edI{n|)b$%n=?#;V~=t=fmSlcw7m56EF*pJHq2AJZ=U5e0V|$ zPbi^GgeM%~2^5~Nf`2|dse~t$P%grgj_@Q3Pg=o0AD&XeQ%c~QiTPQ2$`PJI;VCQl z=fl%Vcv=a3lQ9cVJHpc_JZ%O4e0W9)&nSU!K4#$=M|cK>XRP3#56>#$StamI$t*nU z2+yMMtQGw8;W;Hdrv$!PnT6*Z;W-qZvx0v!wx0vPy*ld%)$;w*nz?hEBNQbi%NJ=34Aj&3okmtizvKk z1^;|_NeM40fp3y#;U!0S35A!e;GYjKE8%4&@XgaKyzB@sqwum7{PW=zCA^}9S`l7x zgjY~_#R~rU@TwACRRZ5^%{{#82(O~>sule6;WZ_^rUbqTn}ydL;WZRqvx0v|9p5;32!QaZ{}v zpAT;-;VmWbP2McLTfsjcK2gFaO5mH?>Hk8X zIKn3=d}0OveE3uepDKZGc4y&JNB9(lPp#me51%RFGbQj%@GN}h2%n+wnHBu=;d3Q? zu7p`4eC`OJqwu*E{PW=pC48ZT*&=-52w$M^g%$ks;Y%fasf0NqeCY^ZqVS~^{PW=} zC48j>zR8~cFZ7ioe1*bSR`AbJQ;G6YX_|_4=Md4d3_~*lSO88C*d=ozl-#Nl}D12uH|9tpf3EwM$ zZ|-N|dq?;lh3}I>xqm+VpoAZkz&HJ~@Pi}#fWi+}@Xv=ImGGky_%HwqKRUvXDEw#z z|9tpK2|p=;4+*gFlOz0u!cSK4&xfCt@Us&5@Bj-xJHpQ>{A>mPeE3BPzbJtZ6|nG& zBm9EGFIMo+hhLTOs}lII0Smu6!mlX&Y6bs%_)Q7FDS;0mu<)BB{D#7BR`Ab<-<9yY z5|)YZyCeLL!tYk_&xf5#*r^0Qw7@;=bcCHK?6iV^KK!ACKa{|S8Cdwk5&l5o4=ecR z!=Fm{Qwe;?frURE;ZGF)w1R&={H27yl)#4{Soq5k{zBm|EBNQb-%9vf34ADmg})u) zZxsHvf`2~zqlAByz=tJR_{S0cLE#@O_~*mFO88d^e29XDe;wgp6#lh>e?II|!Y(E7 z;R+UZIl?X!b{U~GgWvAOclRm16%74LtI2;%l|p6ku?sf%7urhV-_zu*oa8@^K#^6v zGlJe@Mk!&f@R1Bw_#^=;lm$u{6z`m%H?L7jidNQ$!lwyPp)62RK=IBBdRH8!q-tfY zD14#-70Lo76%_BhptsvmN}5(eDe-5FPZgj-S)inW;++}vK0ZoG*GgEFbVs2qP|`v1 z&JB8lAf;qzB}J4BN1-fGGC=Xp4tnPyrL@pWswgcSg|a|t0g88i&|4ZQB~vSDqVOpL z{Jc;WD4C#mX9&Gll2Te~C0!IgX@Cl4fzlF`sQ1r)L@N=kWQfA24N##hP$HmsX9@ko zx2l&ct+Wt@PaL2^S)gQr;+-e-woyvS)=H)*eChxd$^s=D6z@!-_oGruE3LE?g-;%! zLRp}+0>wL5=#8$F(poDKQTX%$DwG9EYf!wih2B9+DQ&cpB?_NFK!vhEX=9ZF|9r{O zN{&{tMd4Ejs8ALtIiUFGOIxk9)k-T-_#^@ohW=d0Ts#ur6VZ*`O--%owU+k6h5JV3T1)P2^9Z)>8zE`TFDiK zPbr{6S)gtl&+xo=Sw%O zbkj;FQTW6HDwG9EH&FcZrMp(TYo)U&d};v|$^xZ3DE|4e9{3G$^vB%P@>-XvZq$|)XHw6@M#BBC<~N5LGjO*fm#`;l>wsgi3e0D z3zUJN_~*-BTG>l0yNkl79#EkyQ1$}FKVSCN%HCSpLli#wfC^=SvNtIH`7%f=gS4`z zD17<>70Lo-5GelnGFU5vwK7l?J^_IWWq~r-DnDbh-jRtAg0Cn8Xx zEKrI-@z0kbS{b61d{OvR1S*sT$`DZe^QBlT#aby4g-=GHLRp{`gW{hrL$xwgEBu~U z1cdl>1S*sT%1}`J^JSP;hH0fp6h0w=3T1&Z3>5!-8LpM#S{Wh=pOQd@vOpOQihsV0 z(8>s{6pO+qB~YO(P)2|f_0E@lw6c#@hKjfe7XV^$^xYv z6#smw&`O0?Vxm+y3T1&(0g8XVRBEMCE2X0FDGTg{vOuW>#Xn!Fv{I#&GEw-X1uB#U zN);$k?|d1hl~GzL7llt-ph8)oi~_|!Uq)+Xv{oua;S(3AP!=eoLGjO*FT`2@F&y3zTtIDfZ8o8m-i5WsE3%3Ii3&0;L8N|9ly*mGN4s7KKk@ph8)oj0eR( zUuv~dtCg{$@M#QGC<~NYQ2g_yPAhd<87B&#$Uud%K&b=8KVK$jWr9{}MB!5zs8ALt z6F~9Lmx)@LsFm@e@W~8RC<~N{p!ny@B&|%+O06h-Is+BT0%Z~?{`oRlE0eWSCkmg? zK!vhEnGA}5zD&`|6s=4Ug->aqLRp|p0mVOG4${g&TA3&cpVUBwvOqZql&E*U9ITat zwK7Q*KCOWYWr1=qDE|3Uua$bOOcsStY@k9}pwxrnpD$CjGF2;6MB!5#s8ALtQ$g|1 zmqWC2h*k~~g->pvLRp|30*ZgW9IBN=wQ{g1e0l>F$^zw3Q2g_yK`RYfsTYM$aG*k2 zpfp%zsDHjRYNb&tQ$=ZX6v_gn5fuM?nWmL#S~*0NX^ui!piBeBKVPP6Wx7@l6@^c8 z;4?;9piBqFKVN2OWrkK7MBx)1s8ALtGeGgrmzi3bsg*`i_*4fflm*I6Q2g^{mR4qI zWtu2_vI7;$0%aB`{`oRnE3>sST@*gufeK}TG8+{Ce3_$_Ia-+^3ZL*mg|a}I1B!pX z%+<X=R>PW{JWlJy4-6Q09RW_0E_1TA8nv*`n}i4^$`% zl=-0e=gR`EEYQjvQTW6MDwGAv0#N+(WuaCUYGtk{eCh)g$^vB}DE|3!m{tzc$~;l{ zxxtKVO=( z(xjDzqVOpYR45CSCQ$tIHmBpg)=@3*X3zQ>4@z0l|v~rYImWaY9L{OnDP>uq{KVOz>Ww}WNp)6320mVOGj@8PsT3ICupB+JkvOqc3D#QKrWsO$WXys^8 z);J1ffwBe^|9n}im9<(~Eef9ucW&zFr_*{GGUC>tGxvOw7gihsUr(#j^Sq=>S~Q78+PO`!Pa z%L!UJK`W`EoZu*w15S)iN-ihsVGu9efZk|oON zjzU?WoDPbAzMP?zGqjQ|${CJAS)iN&ihsT|Yo%E$twd>d6v_gn85I9~Ia4cVYNfR( zXF3XHfpR7&{`s;+D_gYEMwBg%LRp|}0mVOG&eFKZl=B>gvOqZx6#slVUn}QprGqHvI|^liay}^j`Er3)F3?IxQ7&*4$^zvAQ2g`d zLakh=l}@5u=qQv0%7vi#=gUP}xkxLWMY+gPC<~N}K=IF)i?wpGR=S9Cv7=BHC>LAB z|NbLcTeY%PD_up|>L`>2%2rVP^W_q)T%wh3qFmxAlm*Hqp!ny@rCPaEE8Ru8)KMr4 zluJSJ&zH-za+y|oh;o^uP!=ecf#RPp+qAMxD?LTo<|vc}$~I8^^W}1_T&|T~qFnAM zlm*J=p!ny@6$I|)DAzd(Wr1=XDE|3!y;iQ*$^cQWcNEG3<$6&3^W_Gu z+@O`+MY+LIC<~MuK=IF)8?|zyR`w9(Mn|D6P;Rt}|NTp{Zqmw4TG>;Sn;eC*K)DGN z|9rVwD>rLppeQ#x3T1(EGbsM~a*I}O(aK(;+~O#d1yYh{=y_d5z@fpR}6{`vBNRvysGa8Vv`6v_hS0Z{z&&7AOyc;-4>%Xyp;D>@UhAjzU?WJOYY;zC5axN40W*D33Y{Wr6Z2 zDE|5Km{uOs%7LOh<|vc}%44AT=gZ?-d0ZMsVGl7 z3T1)vG${W0@{CrV(Mp*p&o~NYf$|I}{`vB(R-V;LxhT&%3T1)vEGYi@@|;$l(@KRX z&p8TZf$|(E{`vB}R-V^Nr6|uk3T1)vJShJ8@`6@g&`OmkFE|Qif%1Y?{O_NVwL>dA zv@%MR9gad-pzHv}KVM$d%8ObVEy|0ILRp}^2#SBcyrh+vv@%ANmmGz%KzRui|9p8_ zD=%xMT9lU^g|a|-85I9~c||L)Xl1M@uQ&>2f$|C{{`vB%R$kT0I8k186v_hSRZ#r% z!A4O%NtsGLo2nSyx}O611qP*oOlm*ILp!ny@+gf>BD-%U|+fgVB zl(#|g&zET}PoTP~HW_KVRO{%6nRwBFcM? zLRp}^2a12byswq_wQ`Us?>h=*f%3jp{O`Y#^?_DC(8|H0eBdaQ1w zCt5jFlusOmvOxI+6#snrR4boqr9qTW9fh($`4klYeECc(pJ}C0l+PT6vOxI^6#snr zTq~bzWtu3TI|^li@;NB}`SOKUzR=2aQNC~#$^zvJQ2g`dORapVl^LRZ=_r&1%9o%- zz4PTOt$d}GnWB8>RnJdb7jzU?Wdhg0_As5{PSg} zR(5J-u_!wog|a}|35tKd{GpXUw6a8$KOBX!K=}idsCT~nsg*yqvQ(5m9fh($`4bfX zeECZ&e`#fzD1SK$Wr6Y+DE|5Kw^shv%8{b{?I@H5%HN>)=gU7@`9~{9iSm!5P!=fv zfa0Go|7zu5tt=PiUq_)VQ2qtQKVNofWtUb~h_cI3C<~NbNu}_=-v1>M^|5&}=Agi=rmr6k_}r7+(=U&2}mYh{%vVMn1X=p_t_f4-z>B}FSoi^A_Wg1t}{ zC@G-$=S!+qQnj*L6n?)ER45CSR8ai$B~2@7S~*4(e!me^C<~M{Q2g^HT`TEYIaU;Y zzY$a@3zT$F{PQJ4D;Zi@BMQIY2r85XN(LzY`O-owEwr*$6n?)ER45CS7OdoUn>whW zqNc2&EWa=`b#Q7!T}eZ%W@25eE;cr&x&wWX9;k^`(Sfp9ZC%?@S&=(7wF;$V^ZO*3 zcVh~LE5bXocV>q(>G3e%7at1!P9NTxos3)U;!+<_+wmva(89M!{o0VuL#wzi=|PY zaxkuDY)yVNe`qMPVPaKjD}Fq0@vJ3_mMxw!YY9C_{|0U(E8cOdNTed1mywqd&fy}X z(rPMeYU2}37ojI9uX54SriIJq{6A}L&)%LL?z|$Dv&U4HiW=Hwq=jkkv>wvXE;B8X z!f$#)Q89mnyU5wsej4i64Jw};lP{v<%c>{l=hG)HxZ|Akob+%uDP`TJ@~1GTx+{Mc z>(^z~<>xnKHbhHnshd6P@`uL*`izA`xm2g1G_=hu3KNSWUQp+`b>;TrUZMImHC46a zQzDI#?3`GdLF(7;GdPtQzLGy0uBja#&7@yS_?H;}QkogcqyLogx}1Nh;9n{;>(>n# zT~bP$sjMo^j_ycJjrY_h{#oc8=}-}F3^mf*W>th|hGx=#>7OF!Pe{M&aTAkSZQ84> z%t(5lkomL~j;Wat|7uOO)9Cr4Pdm*R{ydA26KPcuUY@!B|lIi52Vrq QIobSYGB<<%R2GE(4_Np=IsgCw literal 0 HcmV?d00001 diff --git a/tests/data/acpi/q35/FACP.thread-count2 b/tests/data/acpi/q35/FACP.thread-count2 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..31fa5dd19c213034eef4eeefa6a04e61dadd8a2a 100644 GIT binary patch literal 244 zcmZ>BbPo8!z`($~*~#D8BUr&HBEVSz2pEB4AU24G0Y(N+hD|^Y6El!tgNU*~X%LSC z$X0-fGcm9T0LA|E|L2FOWMD92VqjR>!otAF!NBm72Obk1 YBHITON2VDSAnpK(F*YFF1LDH~0O^Si0RR91 literal 0 HcmV?d00001 diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index d17d80e21a..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/q35/APIC.thread-count2", -"tests/data/acpi/q35/DSDT.thread-count2", -"tests/data/acpi/q35/FACP.thread-count2", From patchwork Wed Oct 18 15:55:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851112 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=GpXT4o5E; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9dN51rc2z20cx for ; Thu, 19 Oct 2023 04:37:39 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8wO-0000oV-Fw; Wed, 18 Oct 2023 11:58:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8ta-0002nM-E0 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8tW-0006r9-13 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644536; 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=axsLHZnyDqeJsUPQJ6Te7VvBOL93A3E/3UAHlG8ASYU=; b=GpXT4o5ElYXSEd/m9uMswnQkxvJjfBJyxqq4BTC9A7yZT/oTXIHACoCSAio7nrDOM1mceF RyA1oLMlx3lqmP+/iyumkNgFdisswT9SFKGGTSVWmyMEl9U4WZ/ic0Bq28sH87a1/3YYua dF/o9Ks4JlZHBayoq70uyeiPWPTmr2E= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-588-g66TNcWbNcCTrIxMF0A3PQ-1; Wed, 18 Oct 2023 11:55:30 -0400 X-MC-Unique: g66TNcWbNcCTrIxMF0A3PQ-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-402cd372b8bso54058305e9.2 for ; Wed, 18 Oct 2023 08:55:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644529; x=1698249329; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=axsLHZnyDqeJsUPQJ6Te7VvBOL93A3E/3UAHlG8ASYU=; b=ht8+5JDPA9D0RwEq7QoT+Fg7rhxA67gxEffgVGkE2mRP5SdNqCquwM+uwQA2bM7wfy 8lRru1bD+x2z5NvMBD2le8TupsbhSo0QFwiFSRJWtHwKKllpA3WgO1n01kRiwI1lbITz 3ZVRrnGTGc8DPRGsw7WnxrHtvKTCUDZJtRdufNBNfiEBo0SwIpVuia/ok2YNW4cDyuBp 2YcMHnyWwZA5Aobe5nGsY5lCgbg/qbhWh5EdNnhZOInjkrs4ZDQDCec/7gIV6258j6st /ah2+qAeQ7L+yT+MPsdsk3W5SpLIRE1YbUEWMAhZEcz9ktQOximfIJHw5M1pKyyIesmu niNg== X-Gm-Message-State: AOJu0YxG71cKxlzq82z5dowPw5ExkckvR1UtchcYQl7Nz7BngixIfDWE /eJJDkwm/hZPYykn1ljlr7bbmOCqDq2j3HndFHfzqww6hxA5vhsDw0PvP8IR4jKWCaLpCQmxhUo v09jTJDu30T/dWmoyEyZWOKkBJ+KLC+VI73nP0fgaUBII4R6Uz5DAv/xePoQjcgu+dl906PY= X-Received: by 2002:adf:f447:0:b0:32d:a910:6c2a with SMTP id f7-20020adff447000000b0032da9106c2amr4220789wrp.30.1697644528953; Wed, 18 Oct 2023 08:55:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHiTU+xrY2Wa39hEO14e8sVy8tRgj/VZ+xYps/WCTf6Xjj58e5TvQov+JOr0BNbUfYQYEPGSQ== X-Received: by 2002:adf:f447:0:b0:32d:a910:6c2a with SMTP id f7-20020adff447000000b0032da9106c2amr4220766wrp.30.1697644528598; Wed, 18 Oct 2023 08:55:28 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id f12-20020adfb60c000000b00318147fd2d3sm2382642wre.41.2023.10.18.08.55.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:55:28 -0700 (PDT) Date: Wed, 18 Oct 2023 11:55:21 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Laszlo Ersek , Eugenio Perez Martin , German Maglione , Liu Jiang , Sergio Lopez Pascual , Stefano Garzarella , Philippe =?utf-8?q?Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Albert Esteve Subject: [PULL 29/83] vhost-user: strip superfluous whitespace Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Laszlo Ersek Cc: "Michael S. Tsirkin" (supporter:vhost) Cc: Eugenio Perez Martin Cc: German Maglione Cc: Liu Jiang Cc: Sergio Lopez Pascual Cc: Stefano Garzarella Signed-off-by: Laszlo Ersek Reviewed-by: Stefano Garzarella Reviewed-by: Philippe Mathieu-Daudé Tested-by: Albert Esteve Reviewed-by: Eugenio Pérez Message-Id: <20231002203221.17241-2-lersek@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 68eb1f0c99..3e33a2e9e0 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -388,7 +388,7 @@ static int vhost_user_write(struct vhost_dev *dev, VhostUserMsg *msg, * operations such as configuring device memory mappings or issuing device * resets, which affect the whole device instead of individual VQs, * vhost-user messages should only be sent once. - * + * * Devices with multiple vhost_devs are given an associated dev->vq_index * so per_device requests are only sent if vq_index is 0. */ From patchwork Wed Oct 18 15:55:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851026 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cssE6n46; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bhW2cQSz20Pd for ; Thu, 19 Oct 2023 03:21:47 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8w3-00009l-9X; Wed, 18 Oct 2023 11:58:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8ta-0002nP-FC for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8tW-0006rF-CG for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644537; 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=E99g4CTTfhJ51zXlgqHdg/7C/6fC/h1geeLvGMNmvCc=; b=cssE6n46M0yr31XaW6fxuVPBj2ceey/6eYMtXaOKuQcz2xieXsTw2j/WbypMxf3H17eiYu c70nj/vemGuJOgHoznYp26bpYdasKdLA9Xi0mNn1XpF57uDLzGLrc4ZXiJ8OHlV+4OqaSI WMH/VJA7zVUAzGR6x9e4mtwCUtH4G1k= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-326-emroDSigMkygkpRJzwzE_g-1; Wed, 18 Oct 2023 11:55:36 -0400 X-MC-Unique: emroDSigMkygkpRJzwzE_g-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-32d58708cd5so4254841f8f.3 for ; Wed, 18 Oct 2023 08:55:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644534; x=1698249334; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=E99g4CTTfhJ51zXlgqHdg/7C/6fC/h1geeLvGMNmvCc=; b=uF4OmeKXhJe9NXiSpmjeuwq6ZydfwKEMwY7wyyakDNe/GiO/XGOjcWLQd8JmtCZGdz pDCUdDG1JynorCQUXBCC6XNszfLhFq4lO5pF9FEaPkd8RqwNIJhMjmumLl7i1NEKG/T+ Qa/EIgyyiaOckebmr+heQOK2/oHZWK7I5hSOLJgnUWtt2OkA2+L0csQIGbsPIs0H4L7U PcyZwNH5c8aHd1PLEbCmGZodCEFOmuLBqm820xHOCgT/HIvT+UghOPrHSTiEv2vdSHEr B8Nk06aQ1F2HrJ30i01OUakV7hb4kcGDoyD1jAGuJl4BkwRbbVsTlT6mHpBpgKXGCNpD BxGw== X-Gm-Message-State: AOJu0Yw6YqFF6F2bWs9cv2Jr1CKYFejG8uwgIt+8MaOBbwMemC+4qKjy U4Yo7IISvp7QFbN6OIcOcTGd5j1SavkbY2B1Fv72LTk6bymD4vtMq8hyiAetl7cJQVSYjgEXUWR 6ZAbROH2UgkiSPjwI1BeScUKkEAyGnDWwRGuHG8R4CGSh1KdFItcCxbCkFhSDA2++SeZZLwk= X-Received: by 2002:a05:6000:10a:b0:32d:82b4:1957 with SMTP id o10-20020a056000010a00b0032d82b41957mr4191910wrx.40.1697644534472; Wed, 18 Oct 2023 08:55:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHHWV5rSVJ0CiyhKKzLpH+ItnBouwoiBE5k7CQkyL0JsNcBIuou4CRqG0BaVSDoQS3cg7MLGQ== X-Received: by 2002:a05:6000:10a:b0:32d:82b4:1957 with SMTP id o10-20020a056000010a00b0032d82b41957mr4191886wrx.40.1697644534114; Wed, 18 Oct 2023 08:55:34 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id x3-20020adff0c3000000b0032dc74c093dsm2373998wro.103.2023.10.18.08.55.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:55:33 -0700 (PDT) Date: Wed, 18 Oct 2023 11:55:28 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Laszlo Ersek , Eugenio Perez Martin , German Maglione , Liu Jiang , Sergio Lopez Pascual , Stefano Garzarella , Albert Esteve , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= Subject: [PULL 30/83] vhost-user: tighten "reply_supported" scope in "set_vring_addr" Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Laszlo Ersek In the vhost_user_set_vring_addr() function, we calculate "reply_supported" unconditionally, even though we'll only need it if "wait_for_reply" is also true. Restrict the scope of "reply_supported" to the minimum. This is purely refactoring -- no observable change. Cc: "Michael S. Tsirkin" (supporter:vhost) Cc: Eugenio Perez Martin Cc: German Maglione Cc: Liu Jiang Cc: Sergio Lopez Pascual Cc: Stefano Garzarella Signed-off-by: Laszlo Ersek Reviewed-by: Stefano Garzarella Tested-by: Albert Esteve Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Eugenio Pérez Message-Id: <20231002203221.17241-3-lersek@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-user.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 3e33a2e9e0..6c7b4cc75c 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1321,17 +1321,18 @@ static int vhost_user_set_vring_addr(struct vhost_dev *dev, .hdr.size = sizeof(msg.payload.addr), }; - bool reply_supported = virtio_has_feature(dev->protocol_features, - VHOST_USER_PROTOCOL_F_REPLY_ACK); - /* * wait for a reply if logging is enabled to make sure * backend is actually logging changes */ bool wait_for_reply = addr->flags & (1 << VHOST_VRING_F_LOG); - if (reply_supported && wait_for_reply) { - msg.hdr.flags |= VHOST_USER_NEED_REPLY_MASK; + if (wait_for_reply) { + bool reply_supported = virtio_has_feature(dev->protocol_features, + VHOST_USER_PROTOCOL_F_REPLY_ACK); + if (reply_supported) { + msg.hdr.flags |= VHOST_USER_NEED_REPLY_MASK; + } } ret = vhost_user_write(dev, &msg, NULL, 0); From patchwork Wed Oct 18 15:55:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1850993 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=A0KHa+oA; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9b8b2wcxz20Pd for ; Thu, 19 Oct 2023 02:57:35 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8vG-0005R2-OU; Wed, 18 Oct 2023 11:57:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8tg-0002us-Bp for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8tc-0006tF-8C for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644543; 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=BFZkemHVKMpqq9uyVp58jnRD/h5a0Rr9UNCxOcsmGpE=; b=A0KHa+oAntlYqxuZMx3LBkstOkkxX49bS9Hu2msYlGkAZvpGI28/AflWWz2WG4zEmK1zJn ohRh+BSyke69+ugse0JNfFt+L+C8Yp8m1FytNbBnrMqMd9UIioX2HB61etSs/2WPN5jKIO x1rj+5Zj6b8Y54yotucmtLI3HDQWyvE= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-679-CYRu11aCPhyIrvf7sk4Dkw-1; Wed, 18 Oct 2023 11:55:41 -0400 X-MC-Unique: CYRu11aCPhyIrvf7sk4Dkw-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3fe182913c5so44442475e9.0 for ; Wed, 18 Oct 2023 08:55:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644539; x=1698249339; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BFZkemHVKMpqq9uyVp58jnRD/h5a0Rr9UNCxOcsmGpE=; b=xRaxN0NeGcAqPKP87V5XZRxDB+gmqpcx4PsRLQNk0zBUWTyBEvbs0m8h9M2UDOhvTk dpPS6CFRG9L+CrnLTI0ztH2+Q033Cz17os7P/W0iQg7qP65haqkdcp3EGTR5ePO5EWVr 3zNJwCPCQscr2EOBiY08xa7y95gtKaLN1nZcR71I0w1GbldC4kpEwT3oL695cbBHfJRQ 4hReCQ5ogH3yETEEAC18xmhuzCLbVdNihnBp7tYLjbpsISmH8pjcnum7csINbj8rZ0Qk 2WjV7RJ7jFjyoyn05DPKq66uo27PTMYBUfQ7Y5ZBX37gGUTeMWU3Wi5TOPCpI7pm8h91 04CQ== X-Gm-Message-State: AOJu0YyWRixEJw+B3tRYiEtyGPW83nGmeKFOgpJPFsHygqjPUBuPJyNH e7l4bvKfKvPM6Fl0VT1CIhfRu/3Pd25nzQuPwzgKkttNZoIdFXNsWz53NqezEZnjEyzMZhZX3ET uyICWcxQIpwcdhs/xpnfgkoJdEogKrfR//He+Q3nyHYOdd1A6viplUzogNGuKUjQvGS4ZJy0= X-Received: by 2002:a05:600c:1ca3:b0:407:5b54:bb10 with SMTP id k35-20020a05600c1ca300b004075b54bb10mr4448954wms.8.1697644539649; Wed, 18 Oct 2023 08:55:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE9vn47qs5u2wQGVPlcEdtlfp7ssigDL5o3gKQgrl/2iQk0eh1sr8rXi1faTv6c0rdUZTpm/Q== X-Received: by 2002:a05:600c:1ca3:b0:407:5b54:bb10 with SMTP id k35-20020a05600c1ca300b004075b54bb10mr4448926wms.8.1697644539202; Wed, 18 Oct 2023 08:55:39 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id g19-20020a05600c4ed300b003fefaf299b6sm2053484wmq.38.2023.10.18.08.55.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:55:38 -0700 (PDT) Date: Wed, 18 Oct 2023 11:55:34 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Laszlo Ersek , Eugenio Perez Martin , German Maglione , Liu Jiang , Sergio Lopez Pascual , Stefano Garzarella , Philippe =?utf-8?q?Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Albert Esteve Subject: [PULL 31/83] vhost-user: factor out "vhost_user_write_sync" Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Laszlo Ersek The tails of the "vhost_user_set_vring_addr" and "vhost_user_set_u64" functions are now byte-for-byte identical. Factor the common tail out to a new function called "vhost_user_write_sync". This is purely refactoring -- no observable change. Cc: "Michael S. Tsirkin" (supporter:vhost) Cc: Eugenio Perez Martin Cc: German Maglione Cc: Liu Jiang Cc: Sergio Lopez Pascual Cc: Stefano Garzarella Signed-off-by: Laszlo Ersek Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Stefano Garzarella Tested-by: Albert Esteve Reviewed-by: Eugenio Pérez Message-Id: <20231002203221.17241-4-lersek@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-user.c | 66 ++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 38 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 6c7b4cc75c..95dbf9880c 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1310,10 +1310,35 @@ static int enforce_reply(struct vhost_dev *dev, return vhost_user_get_features(dev, &dummy); } +/* Note: "msg->hdr.flags" may be modified. */ +static int vhost_user_write_sync(struct vhost_dev *dev, VhostUserMsg *msg, + bool wait_for_reply) +{ + int ret; + + if (wait_for_reply) { + bool reply_supported = virtio_has_feature(dev->protocol_features, + VHOST_USER_PROTOCOL_F_REPLY_ACK); + if (reply_supported) { + msg->hdr.flags |= VHOST_USER_NEED_REPLY_MASK; + } + } + + ret = vhost_user_write(dev, msg, NULL, 0); + if (ret < 0) { + return ret; + } + + if (wait_for_reply) { + return enforce_reply(dev, msg); + } + + return 0; +} + static int vhost_user_set_vring_addr(struct vhost_dev *dev, struct vhost_vring_addr *addr) { - int ret; VhostUserMsg msg = { .hdr.request = VHOST_USER_SET_VRING_ADDR, .hdr.flags = VHOST_USER_VERSION, @@ -1327,24 +1352,7 @@ static int vhost_user_set_vring_addr(struct vhost_dev *dev, */ bool wait_for_reply = addr->flags & (1 << VHOST_VRING_F_LOG); - if (wait_for_reply) { - bool reply_supported = virtio_has_feature(dev->protocol_features, - VHOST_USER_PROTOCOL_F_REPLY_ACK); - if (reply_supported) { - msg.hdr.flags |= VHOST_USER_NEED_REPLY_MASK; - } - } - - ret = vhost_user_write(dev, &msg, NULL, 0); - if (ret < 0) { - return ret; - } - - if (wait_for_reply) { - return enforce_reply(dev, &msg); - } - - return 0; + return vhost_user_write_sync(dev, &msg, wait_for_reply); } static int vhost_user_set_u64(struct vhost_dev *dev, int request, uint64_t u64, @@ -1356,26 +1364,8 @@ static int vhost_user_set_u64(struct vhost_dev *dev, int request, uint64_t u64, .payload.u64 = u64, .hdr.size = sizeof(msg.payload.u64), }; - int ret; - if (wait_for_reply) { - bool reply_supported = virtio_has_feature(dev->protocol_features, - VHOST_USER_PROTOCOL_F_REPLY_ACK); - if (reply_supported) { - msg.hdr.flags |= VHOST_USER_NEED_REPLY_MASK; - } - } - - ret = vhost_user_write(dev, &msg, NULL, 0); - if (ret < 0) { - return ret; - } - - if (wait_for_reply) { - return enforce_reply(dev, &msg); - } - - return 0; + return vhost_user_write_sync(dev, &msg, wait_for_reply); } static int vhost_user_set_status(struct vhost_dev *dev, uint8_t status) From patchwork Wed Oct 18 15:55:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851028 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Y4XnsliJ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bj86GfHz20Pd for ; Thu, 19 Oct 2023 03:22:20 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8vF-0005Jt-NZ; Wed, 18 Oct 2023 11:57:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8tn-00031Q-Uy for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8tm-0006uK-AY for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644553; 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=fxQyEGJG94rK4SLZUCeD2LfRemmWxcyxJsLSwEgXUzM=; b=Y4XnsliJtBIDxxhd4fYCmNPGRFMl3D0lQC2Ke/W+M9YR4LksFVEJlG2DiEcPdlkVruF5to Y7o9HyD4zBQwd2P3NqGO0cX9W2ItO/tlxUccL+2op/vd44h/OnGD+gSDWn25IzWBSMA26j fVPazA1wgpPjp907dodZ46rxglRq5pU= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-556-3Nc2FyMIMCKaYvrt8Lo3yQ-1; Wed, 18 Oct 2023 11:55:47 -0400 X-MC-Unique: 3Nc2FyMIMCKaYvrt8Lo3yQ-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-3f5df65f9f4so44564145e9.2 for ; Wed, 18 Oct 2023 08:55:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644545; x=1698249345; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fxQyEGJG94rK4SLZUCeD2LfRemmWxcyxJsLSwEgXUzM=; b=K7A3UmAqB61snNBCXUqyZRqzsBQo4mj4Z2MoODzbDUvOJfEWfYsx346UHJG0wWAbWs fD+KAKhfPbFKBiLY3oHAnpzR0qHkilIp/FeDK9O9vgj1yMTxGmiYSWvoTc60n4PsWpKy DEgcOB5t34OxE/1T5YVXCSv5ZwUPakSarrJ8L2zg6dCn20lKWVukxN23/sTw8rfYaA3/ BvZElbd9GJ7iwy82ZAuwJeJrmPcEJEyD9kUyJkhpGumlCIbpNYufmBJikmXuLRXAnC6I U108I4CEiU9aCdJ2GLXqfNmnMc/Dh8VllL5h3K+JOhDSPc6JP030dBR75S3iEVlwZdHV 7cgw== X-Gm-Message-State: AOJu0YxRz62r1nuHonWeFaLwqD7tCnopZGyrsXxiWUq/eTrwRdTVNR87 +Lu+fg+raIgkIrNByD1NDgVCgYRL/XHNw073X7y4BLhwyy6NVZjxt0S5C1+v6Os8nurHqOxJyRf ceOY/jwPPxqTHJGjZEHAoVgmxyc0Aj8+MpurN6rY4oUJLkPpm27T0FBoe/Ki2P6pFkWhSpg0= X-Received: by 2002:a05:600c:418c:b0:407:58e1:24ed with SMTP id p12-20020a05600c418c00b0040758e124edmr4286672wmh.39.1697644545079; Wed, 18 Oct 2023 08:55:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFOlYVfw/P+UGkIVXgQqpRfSqSASliyYCrvnzxZNy5KGTBcEW0zMHraK2m4bcO1YGoMJDmyLA== X-Received: by 2002:a05:600c:418c:b0:407:58e1:24ed with SMTP id p12-20020a05600c418c00b0040758e124edmr4286642wmh.39.1697644544571; Wed, 18 Oct 2023 08:55:44 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id k6-20020a05600c1c8600b0040839fcb217sm2045776wms.8.2023.10.18.08.55.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:55:44 -0700 (PDT) Date: Wed, 18 Oct 2023 11:55:39 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Laszlo Ersek , Eugenio Perez Martin , German Maglione , Liu Jiang , Sergio Lopez Pascual , Stefano Garzarella , Philippe =?utf-8?q?Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Albert Esteve Subject: [PULL 32/83] vhost-user: flatten "enforce_reply" into "vhost_user_write_sync" Message-ID: <999280bc8c079d5ff9d956bfb598a2f1a42bc682.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Laszlo Ersek At this point, only "vhost_user_write_sync" calls "enforce_reply"; embed the latter into the former. This is purely refactoring -- no observable change. Cc: "Michael S. Tsirkin" (supporter:vhost) Cc: Eugenio Perez Martin Cc: German Maglione Cc: Liu Jiang Cc: Sergio Lopez Pascual Cc: Stefano Garzarella Signed-off-by: Laszlo Ersek Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Stefano Garzarella Tested-by: Albert Esteve Reviewed-by: Eugenio Pérez Message-Id: <20231002203221.17241-5-lersek@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-user.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 95dbf9880c..23e9039922 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1292,24 +1292,6 @@ static int vhost_user_get_features(struct vhost_dev *dev, uint64_t *features) return 0; } -static int enforce_reply(struct vhost_dev *dev, - const VhostUserMsg *msg) -{ - uint64_t dummy; - - if (msg->hdr.flags & VHOST_USER_NEED_REPLY_MASK) { - return process_message_reply(dev, msg); - } - - /* - * We need to wait for a reply but the backend does not - * support replies for the command we just sent. - * Send VHOST_USER_GET_FEATURES which makes all backends - * send a reply. - */ - return vhost_user_get_features(dev, &dummy); -} - /* Note: "msg->hdr.flags" may be modified. */ static int vhost_user_write_sync(struct vhost_dev *dev, VhostUserMsg *msg, bool wait_for_reply) @@ -1330,7 +1312,19 @@ static int vhost_user_write_sync(struct vhost_dev *dev, VhostUserMsg *msg, } if (wait_for_reply) { - return enforce_reply(dev, msg); + uint64_t dummy; + + if (msg->hdr.flags & VHOST_USER_NEED_REPLY_MASK) { + return process_message_reply(dev, msg); + } + + /* + * We need to wait for a reply but the backend does not + * support replies for the command we just sent. + * Send VHOST_USER_GET_FEATURES which makes all backends + * send a reply. + */ + return vhost_user_get_features(dev, &dummy); } return 0; From patchwork Wed Oct 18 15:55:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1850997 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=B9N5+s44; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9b9V29Csz20Pd for ; Thu, 19 Oct 2023 02:58:22 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8vE-00055V-Bn; Wed, 18 Oct 2023 11:57:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8tn-000315-BT for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8tl-0006u7-HG for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:55:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644553; 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=qncmj8VSAhzCwEfF1DriYWvIMpvnvvg3uBD5Ms2hZSs=; b=B9N5+s4465yALBxU7jdoAyrDml9xkmfIdEu3LQJWVjWzUyaDikNVpyRTmwSoFAA1iuIcPV C7MxNytmh4J3DQFv6wKrh1xLAvM9OFWC2e3RPHNTRTEwwu212aLptcTXVxS4WxKjdIJPCc vd9WxuRHzQVd5W8HXFdrMRcrm4ELtfM= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-474-AHRQeYN1Ol6Y2YlQa8ESsQ-1; Wed, 18 Oct 2023 11:55:51 -0400 X-MC-Unique: AHRQeYN1Ol6Y2YlQa8ESsQ-1 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2c51d0f97e3so35963561fa.0 for ; Wed, 18 Oct 2023 08:55:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644549; x=1698249349; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qncmj8VSAhzCwEfF1DriYWvIMpvnvvg3uBD5Ms2hZSs=; b=W8SfHgY4PQEeKnQ4vsRRR0XmuuGxeJxyLIAMJOsb9e3W6M0guZKNQPKjyNA/i5Ks0Z otezGRKjEyZTGNev8BLyES8Pdb69eha2pLOsZh2vWoI2yeDmC/iz0yceais7Cr3+kXoE AuMhalS/LyaTeuwbd1jTjATefSEoD3fKoo8E8bSUF7SurAzeB5W2iYSdEz7EIUjUp6QK 9I9I6N3+iRBbMANXp5KXYFn3h454sUf0DxcRimMgJcWu81A4Emn5U41n2Hu+aRBJNUmo Dl2Er6l8nkNV5ALsooTVUzNv3m2vi5+wVRnH7J2OHOyQ/hoO3Jx83haetxfv8I60mY3Q uDqw== X-Gm-Message-State: AOJu0YxM2d7leP1iHuN6rKTwcf1Zq3b9DSELEQXsd0HZlTWjVikOHrOg a7wAxIXQKLznYYxhxssYKSbE2bUTdz33wxsrGTLc1iXfzO5RFAaZexoPfYIMKsQ7pymSij7hIEl ImjOLpeEN8x20aFOXBnPWQ5CfnOPuT1rr+FBinWt8lwh3Q32f2dQJ/gbyyeteThEbwb4PtI4= X-Received: by 2002:a05:651c:201a:b0:2bc:b821:84ad with SMTP id s26-20020a05651c201a00b002bcb82184admr3501291ljo.16.1697644549778; Wed, 18 Oct 2023 08:55:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFrs2PYUoQxYLZZjXxwrBj2p8DCYkhLmtnL5K9Hl6WH48qEzXCFxj78EZIwbpnCe55MIAQqlg== X-Received: by 2002:a05:651c:201a:b0:2bc:b821:84ad with SMTP id s26-20020a05651c201a00b002bcb82184admr3501274ljo.16.1697644549398; Wed, 18 Oct 2023 08:55:49 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id j20-20020a05600c1c1400b004065daba6casm2029931wms.46.2023.10.18.08.55.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:55:48 -0700 (PDT) Date: Wed, 18 Oct 2023 11:55:44 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Laszlo Ersek , Eugenio Perez Martin , German Maglione , Liu Jiang , Sergio Lopez Pascual , Stefano Garzarella , Albert Esteve , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= Subject: [PULL 33/83] vhost-user: hoist "write_sync", "get_features", "get_u64" Message-ID: <1769f7b19207998b62e8a46b267f3ccfab6becbb.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Laszlo Ersek In order to avoid a forward-declaration for "vhost_user_write_sync" in a subsequent patch, hoist "vhost_user_write_sync" -> "vhost_user_get_features" -> "vhost_user_get_u64" just above "vhost_set_vring". This is purely code movement -- no observable change. Cc: "Michael S. Tsirkin" (supporter:vhost) Cc: Eugenio Perez Martin Cc: German Maglione Cc: Liu Jiang Cc: Sergio Lopez Pascual Cc: Stefano Garzarella Signed-off-by: Laszlo Ersek Reviewed-by: Stefano Garzarella Tested-by: Albert Esteve Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Eugenio Pérez Message-Id: <20231002203221.17241-6-lersek@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-user.c | 170 ++++++++++++++++++++--------------------- 1 file changed, 85 insertions(+), 85 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 23e9039922..3c14947589 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1073,6 +1073,91 @@ static int vhost_user_set_vring_endian(struct vhost_dev *dev, return vhost_user_write(dev, &msg, NULL, 0); } +static int vhost_user_get_u64(struct vhost_dev *dev, int request, uint64_t *u64) +{ + int ret; + VhostUserMsg msg = { + .hdr.request = request, + .hdr.flags = VHOST_USER_VERSION, + }; + + if (vhost_user_per_device_request(request) && dev->vq_index != 0) { + return 0; + } + + ret = vhost_user_write(dev, &msg, NULL, 0); + if (ret < 0) { + return ret; + } + + ret = vhost_user_read(dev, &msg); + if (ret < 0) { + return ret; + } + + if (msg.hdr.request != request) { + error_report("Received unexpected msg type. Expected %d received %d", + request, msg.hdr.request); + return -EPROTO; + } + + if (msg.hdr.size != sizeof(msg.payload.u64)) { + error_report("Received bad msg size."); + return -EPROTO; + } + + *u64 = msg.payload.u64; + + return 0; +} + +static int vhost_user_get_features(struct vhost_dev *dev, uint64_t *features) +{ + if (vhost_user_get_u64(dev, VHOST_USER_GET_FEATURES, features) < 0) { + return -EPROTO; + } + + return 0; +} + +/* Note: "msg->hdr.flags" may be modified. */ +static int vhost_user_write_sync(struct vhost_dev *dev, VhostUserMsg *msg, + bool wait_for_reply) +{ + int ret; + + if (wait_for_reply) { + bool reply_supported = virtio_has_feature(dev->protocol_features, + VHOST_USER_PROTOCOL_F_REPLY_ACK); + if (reply_supported) { + msg->hdr.flags |= VHOST_USER_NEED_REPLY_MASK; + } + } + + ret = vhost_user_write(dev, msg, NULL, 0); + if (ret < 0) { + return ret; + } + + if (wait_for_reply) { + uint64_t dummy; + + if (msg->hdr.flags & VHOST_USER_NEED_REPLY_MASK) { + return process_message_reply(dev, msg); + } + + /* + * We need to wait for a reply but the backend does not + * support replies for the command we just sent. + * Send VHOST_USER_GET_FEATURES which makes all backends + * send a reply. + */ + return vhost_user_get_features(dev, &dummy); + } + + return 0; +} + static int vhost_set_vring(struct vhost_dev *dev, unsigned long int request, struct vhost_vring_state *ring) @@ -1245,91 +1330,6 @@ static int vhost_user_set_vring_err(struct vhost_dev *dev, return vhost_set_vring_file(dev, VHOST_USER_SET_VRING_ERR, file); } -static int vhost_user_get_u64(struct vhost_dev *dev, int request, uint64_t *u64) -{ - int ret; - VhostUserMsg msg = { - .hdr.request = request, - .hdr.flags = VHOST_USER_VERSION, - }; - - if (vhost_user_per_device_request(request) && dev->vq_index != 0) { - return 0; - } - - ret = vhost_user_write(dev, &msg, NULL, 0); - if (ret < 0) { - return ret; - } - - ret = vhost_user_read(dev, &msg); - if (ret < 0) { - return ret; - } - - if (msg.hdr.request != request) { - error_report("Received unexpected msg type. Expected %d received %d", - request, msg.hdr.request); - return -EPROTO; - } - - if (msg.hdr.size != sizeof(msg.payload.u64)) { - error_report("Received bad msg size."); - return -EPROTO; - } - - *u64 = msg.payload.u64; - - return 0; -} - -static int vhost_user_get_features(struct vhost_dev *dev, uint64_t *features) -{ - if (vhost_user_get_u64(dev, VHOST_USER_GET_FEATURES, features) < 0) { - return -EPROTO; - } - - return 0; -} - -/* Note: "msg->hdr.flags" may be modified. */ -static int vhost_user_write_sync(struct vhost_dev *dev, VhostUserMsg *msg, - bool wait_for_reply) -{ - int ret; - - if (wait_for_reply) { - bool reply_supported = virtio_has_feature(dev->protocol_features, - VHOST_USER_PROTOCOL_F_REPLY_ACK); - if (reply_supported) { - msg->hdr.flags |= VHOST_USER_NEED_REPLY_MASK; - } - } - - ret = vhost_user_write(dev, msg, NULL, 0); - if (ret < 0) { - return ret; - } - - if (wait_for_reply) { - uint64_t dummy; - - if (msg->hdr.flags & VHOST_USER_NEED_REPLY_MASK) { - return process_message_reply(dev, msg); - } - - /* - * We need to wait for a reply but the backend does not - * support replies for the command we just sent. - * Send VHOST_USER_GET_FEATURES which makes all backends - * send a reply. - */ - return vhost_user_get_features(dev, &dummy); - } - - return 0; -} - static int vhost_user_set_vring_addr(struct vhost_dev *dev, struct vhost_vring_addr *addr) { From patchwork Wed Oct 18 15:55:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851007 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=L6xcZIHc; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bF937RQz20Zj for ; Thu, 19 Oct 2023 03:01:33 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8wT-0000v3-1Q; Wed, 18 Oct 2023 11:58:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8tx-00039f-Mi for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8tw-0006uq-1j for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644563; 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=k3kB7c3/8mnVXhh3/qxXLsdRopBKANEVLkGnuRjvnEA=; b=L6xcZIHcYJZmX1HPgBcZBAgS2qaawU4/zPN8tn/kLA+Cn8yw0ue7SuqOgHkvQizcSlwSe3 E0AivUEhJ9BIAANFOOKp5eIFOHFU4B03EGJRgsA4MNy5MPA78nOq5SLdFshTgGUk8bpiH2 DG0X8cTxWOv6YuJL1ljZG6VNqqQ9rx4= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-91-gBvJ7Z4zOFeBgWkBvM1Pfw-1; Wed, 18 Oct 2023 11:55:57 -0400 X-MC-Unique: gBvJ7Z4zOFeBgWkBvM1Pfw-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-3fe182913c5so44443225e9.0 for ; Wed, 18 Oct 2023 08:55:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644555; x=1698249355; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=k3kB7c3/8mnVXhh3/qxXLsdRopBKANEVLkGnuRjvnEA=; b=LGvXdFZBaWJBKGUSqgaAE7w8mN9GpkCH+5qGRvPwDgTOX2Qw54SFa9FJw59XRRnfUM 7vnUlW1zdPlalSG0pVrk9rRf0+GRVY6IG8MViEjN0YHKZMKbikUFekfLw157Js5nZgsI RsmyWf9huSBSOa8ZYYryDAaSOr4Vz0zq48PUHs/GbHYbJA+mjB69VfOZt8nagfAmHmto lnn8+5qG29t+bs/E92wKkABLBreGzbxvKkvoUhiRPSu9aX4Cf0gMUF7dqGxMkh5vsWch ptSh9hl7S1v2uD/o8GCaGq7DAgVVmP+7Pxh0NO9GqyvqOJB5gozv7PO12AGpyiJExUhv Q8/Q== X-Gm-Message-State: AOJu0YztnfqaVtJdZyIRBMMgswAKs0s85uqc4kWFysX3uOEwHQudGtgp 6NGDHUYnlmUnT+c4tr4wiHncVtVF+pc1KrWk0uAIfUOzFMmOuyKLrL8QCs2O7KZzVZRKRMc1NeO wT+NCZva5xqulbRL+zn5qcGyzN50RoYTBZtEwkUDvnOVn0kdVk4aTSW2qRmtcLdqpAdx3jTc= X-Received: by 2002:a05:600c:3508:b0:407:4944:76d1 with SMTP id h8-20020a05600c350800b00407494476d1mr4445915wmq.17.1697644555360; Wed, 18 Oct 2023 08:55:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGwnTncaIrp1JRaO6+QfeejklWcuBG0WNfuMZOmITgvjh/UDYHeW4JjRhz2LfHhZmQLz0BjZw== X-Received: by 2002:a05:600c:3508:b0:407:4944:76d1 with SMTP id h8-20020a05600c350800b00407494476d1mr4445897wmq.17.1697644555029; Wed, 18 Oct 2023 08:55:55 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id p12-20020a05600c358c00b00401b242e2e6sm2003884wmq.47.2023.10.18.08.55.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:55:54 -0700 (PDT) Date: Wed, 18 Oct 2023 11:55:49 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Laszlo Ersek , Eugenio Perez Martin , German Maglione , Liu Jiang , Sergio Lopez Pascual , Stefano Garzarella , Philippe =?utf-8?q?Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Albert Esteve Subject: [PULL 34/83] vhost-user: allow "vhost_set_vring" to wait for a reply Message-ID: <3c501fe5baf0a50cda8f6da2d80c5f5c7c5c6eaf.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Laszlo Ersek The "vhost_set_vring" function already centralizes the common parts of "vhost_user_set_vring_num", "vhost_user_set_vring_base" and "vhost_user_set_vring_enable". We'll want to allow some of those callers to wait for a reply. Therefore, rebase "vhost_set_vring" from just "vhost_user_write" to "vhost_user_write_sync", exposing the "wait_for_reply" parameter. This is purely refactoring -- there is no observable change. That's because: - all three callers pass in "false" for "wait_for_reply", which disables all logic in "vhost_user_write_sync" except the call to "vhost_user_write"; - the fds=NULL and fd_num=0 arguments of the original "vhost_user_write" call inside "vhost_set_vring" are hard-coded within "vhost_user_write_sync". Cc: "Michael S. Tsirkin" (supporter:vhost) Cc: Eugenio Perez Martin Cc: German Maglione Cc: Liu Jiang Cc: Sergio Lopez Pascual Cc: Stefano Garzarella Signed-off-by: Laszlo Ersek Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Stefano Garzarella Tested-by: Albert Esteve Reviewed-by: Eugenio Pérez Message-Id: <20231002203221.17241-7-lersek@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-user.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 3c14947589..7e452849fa 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1160,7 +1160,8 @@ static int vhost_user_write_sync(struct vhost_dev *dev, VhostUserMsg *msg, static int vhost_set_vring(struct vhost_dev *dev, unsigned long int request, - struct vhost_vring_state *ring) + struct vhost_vring_state *ring, + bool wait_for_reply) { VhostUserMsg msg = { .hdr.request = request, @@ -1169,13 +1170,13 @@ static int vhost_set_vring(struct vhost_dev *dev, .hdr.size = sizeof(msg.payload.state), }; - return vhost_user_write(dev, &msg, NULL, 0); + return vhost_user_write_sync(dev, &msg, wait_for_reply); } static int vhost_user_set_vring_num(struct vhost_dev *dev, struct vhost_vring_state *ring) { - return vhost_set_vring(dev, VHOST_USER_SET_VRING_NUM, ring); + return vhost_set_vring(dev, VHOST_USER_SET_VRING_NUM, ring, false); } static void vhost_user_host_notifier_free(VhostUserHostNotifier *n) @@ -1206,7 +1207,7 @@ static void vhost_user_host_notifier_remove(VhostUserHostNotifier *n, static int vhost_user_set_vring_base(struct vhost_dev *dev, struct vhost_vring_state *ring) { - return vhost_set_vring(dev, VHOST_USER_SET_VRING_BASE, ring); + return vhost_set_vring(dev, VHOST_USER_SET_VRING_BASE, ring, false); } static int vhost_user_set_vring_enable(struct vhost_dev *dev, int enable) @@ -1224,7 +1225,7 @@ static int vhost_user_set_vring_enable(struct vhost_dev *dev, int enable) .num = enable, }; - ret = vhost_set_vring(dev, VHOST_USER_SET_VRING_ENABLE, &state); + ret = vhost_set_vring(dev, VHOST_USER_SET_VRING_ENABLE, &state, false); if (ret < 0) { /* * Restoring the previous state is likely infeasible, as well as From patchwork Wed Oct 18 15:55:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851086 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=X9yKe+F4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9cly3Qx5z20Pd for ; Thu, 19 Oct 2023 04:09:50 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8vK-0005wu-Hl; Wed, 18 Oct 2023 11:57:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8u0-0003Di-St for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8ty-0006vL-A9 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644565; 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=ySJRsoNBBcgqyKONkpVDvYCkflnLmxrOPirjci4NdfM=; b=X9yKe+F4jBaALb1HZAe7APAX8RbY0MpBZg4FqMJgm4oV2s+K/nf7zDQd2AboqjuCLZqxA5 jqZ8KOofk67DsgJBBoI9HDyNdQirwqXgeA2uA5Bz/k6mV6y9YNZXzsDZ1BzLVoXdfo5ks+ IycxHixr8Ps5nlljiDW/N859+dfXBgc= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-386-PPKDzwwSP2agZjUcacNYdQ-1; Wed, 18 Oct 2023 11:56:04 -0400 X-MC-Unique: PPKDzwwSP2agZjUcacNYdQ-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-32d83fd3765so4284056f8f.3 for ; Wed, 18 Oct 2023 08:56:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644562; x=1698249362; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ySJRsoNBBcgqyKONkpVDvYCkflnLmxrOPirjci4NdfM=; b=V6bUmaFhx/RazfB4NNdzGKFEnEYctxRZAS38y95H1QghINpMK1+t1otqQaaTTUBOv9 YjnfVzVd5wzz/DREVrEI+Sxnk45tSVFpUKelvvKqx/iCuKy94heFvJkRW83unNxgbf3i CvEGsh9bn5meCyuHV2yc9MlT6w3eV9hygS88qN7gMEetwVSA/mj68ZDt26SSKlELn8x8 OXHAdO6vof+kBBhI2WKkGfXKLRhj6ljqUfPiwXVz18gC6q8+En/ypkze9aF3n70uUhng cg27YE248UMZTHVQjYbiQrTAJvZcR8ZBHsyxtjsufkeI2uNt4LaFePmw8o/sudzch5i1 /NZA== X-Gm-Message-State: AOJu0YxV67cYopgwvCassUYv12c5jVcZ4l0n8lMYVfBNNxCYlVkaVKoW peOqkZGBcgbuJNKOikJG5cKxXd3UaM8H+RJ9PTIAwJSs+VW/6FL5lljxLh3WgrR7BvKI9ep1T80 4JOLw6KyVv1Ce6qOdK1zt4uVcNZDtfAeB6F8G5QeSc/gZDsLptWQWkpE5++DfrxlQ0zpRIeQ= X-Received: by 2002:adf:e387:0:b0:32d:9391:b3ac with SMTP id e7-20020adfe387000000b0032d9391b3acmr4517540wrm.60.1697644562075; Wed, 18 Oct 2023 08:56:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEy21dC1Fia4eHdmGNTNpqRhVdk4v6akZ2USc4SPpkw5jcBZdQS/2hzcBmIGgPScHIWo72cIg== X-Received: by 2002:adf:e387:0:b0:32d:9391:b3ac with SMTP id e7-20020adfe387000000b0032d9391b3acmr4517516wrm.60.1697644561664; Wed, 18 Oct 2023 08:56:01 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id d14-20020a056000114e00b003232380ffd5sm2363989wrx.106.2023.10.18.08.55.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:56:01 -0700 (PDT) Date: Wed, 18 Oct 2023 11:55:55 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Laszlo Ersek , Eugenio Perez Martin , German Maglione , Liu Jiang , Sergio Lopez Pascual , Stefano Garzarella , Albert Esteve Subject: [PULL 35/83] vhost-user: call VHOST_USER_SET_VRING_ENABLE synchronously Message-ID: <77b9150c60b3f26ea235cb7058b9b24bca6234f8.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Laszlo Ersek (1) The virtio-1.2 specification writes: > 3 General Initialization And Device Operation > 3.1 Device Initialization > 3.1.1 Driver Requirements: Device Initialization > > [...] > > 7. Perform device-specific setup, including discovery of virtqueues for > the device, optional per-bus setup, reading and possibly writing the > device’s virtio configuration space, and population of virtqueues. > > 8. Set the DRIVER_OK status bit. At this point the device is “live”. and > 4 Virtio Transport Options > 4.1 Virtio Over PCI Bus > 4.1.4 Virtio Structure PCI Capabilities > 4.1.4.3 Common configuration structure layout > 4.1.4.3.2 Driver Requirements: Common configuration structure layout > > [...] > > The driver MUST configure the other virtqueue fields before enabling the > virtqueue with queue_enable. > > [...] (The same statements are present in virtio-1.0 identically, at .) These together mean that the following sub-sequence of steps is valid for a virtio-1.0 guest driver: (1.1) set "queue_enable" for the needed queues as the final part of device initialization step (7), (1.2) set DRIVER_OK in step (8), (1.3) immediately start sending virtio requests to the device. (2) When vhost-user is enabled, and the VHOST_USER_F_PROTOCOL_FEATURES special virtio feature is negotiated, then virtio rings start in disabled state, according to . In this case, explicit VHOST_USER_SET_VRING_ENABLE messages are needed for enabling vrings. Therefore setting "queue_enable" from the guest (1.1) -- which is technically "buffered" on the QEMU side until the guest sets DRIVER_OK (1.2) -- is a *control plane* operation, which -- after (1.2) -- travels from the guest through QEMU to the vhost-user backend, using a unix domain socket. Whereas sending a virtio request (1.3) is a *data plane* operation, which evades QEMU -- it travels from guest to the vhost-user backend via eventfd. This means that operations ((1.1) + (1.2)) and (1.3) travel through different channels, and their relative order can be reversed, as perceived by the vhost-user backend. That's exactly what happens when OVMF's virtiofs driver (VirtioFsDxe) runs against the Rust-language virtiofsd version 1.7.2. (Which uses version 0.10.1 of the vhost-user-backend crate, and version 0.8.1 of the vhost crate.) Namely, when VirtioFsDxe binds a virtiofs device, it goes through the device initialization steps (i.e., control plane operations), and immediately sends a FUSE_INIT request too (i.e., performs a data plane operation). In the Rust-language virtiofsd, this creates a race between two components that run *concurrently*, i.e., in different threads or processes: - Control plane, handling vhost-user protocol messages: The "VhostUserSlaveReqHandlerMut::set_vring_enable" method [crates/vhost-user-backend/src/handler.rs] handles VHOST_USER_SET_VRING_ENABLE messages, and updates each vring's "enabled" flag according to the message processed. - Data plane, handling virtio / FUSE requests: The "VringEpollHandler::handle_event" method [crates/vhost-user-backend/src/event_loop.rs] handles the incoming virtio / FUSE request, consuming the virtio kick at the same time. If the vring's "enabled" flag is set, the virtio / FUSE request is processed genuinely. If the vring's "enabled" flag is clear, then the virtio / FUSE request is discarded. Note that OVMF enables the queue *first*, and sends FUSE_INIT *second*. However, if the data plane processor in virtiofsd wins the race, then it sees the FUSE_INIT *before* the control plane processor took notice of VHOST_USER_SET_VRING_ENABLE and green-lit the queue for the data plane processor. Therefore the latter drops FUSE_INIT on the floor, and goes back to waiting for further virtio / FUSE requests with epoll_wait. Meanwhile OVMF is stuck waiting for the FUSET_INIT response -- a deadlock. The deadlock is not deterministic. OVMF hangs infrequently during first boot. However, OVMF hangs almost certainly during reboots from the UEFI shell. The race can be "reliably masked" by inserting a very small delay -- a single debug message -- at the top of "VringEpollHandler::handle_event", i.e., just before the data plane processor checks the "enabled" field of the vring. That delay suffices for the control plane processor to act upon VHOST_USER_SET_VRING_ENABLE. We can deterministically prevent the race in QEMU, by blocking OVMF inside step (1.2) -- i.e., in the write to the device status register that "unleashes" queue enablement -- until VHOST_USER_SET_VRING_ENABLE actually *completes*. That way OVMF's VCPU cannot advance to the FUSE_INIT submission before virtiofsd's control plane processor takes notice of the queue being enabled. Wait for VHOST_USER_SET_VRING_ENABLE completion by: - setting the NEED_REPLY flag on VHOST_USER_SET_VRING_ENABLE, and waiting for the reply, if the VHOST_USER_PROTOCOL_F_REPLY_ACK vhost-user feature has been negotiated, or - performing a separate VHOST_USER_GET_FEATURES *exchange*, which requires a backend response regardless of VHOST_USER_PROTOCOL_F_REPLY_ACK. Cc: "Michael S. Tsirkin" (supporter:vhost) Cc: Eugenio Perez Martin Cc: German Maglione Cc: Liu Jiang Cc: Sergio Lopez Pascual Cc: Stefano Garzarella Signed-off-by: Laszlo Ersek Reviewed-by: Stefano Garzarella Tested-by: Albert Esteve [lersek@redhat.com: work Eugenio's explanation into the commit message, about QEMU containing step (1.1) until step (1.2)] Reviewed-by: Eugenio Pérez Message-Id: <20231002203221.17241-8-lersek@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-user.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 7e452849fa..427ee0ebfb 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1225,7 +1225,21 @@ static int vhost_user_set_vring_enable(struct vhost_dev *dev, int enable) .num = enable, }; - ret = vhost_set_vring(dev, VHOST_USER_SET_VRING_ENABLE, &state, false); + /* + * SET_VRING_ENABLE travels from guest to QEMU to vhost-user backend / + * control plane thread via unix domain socket. Virtio requests travel + * from guest to vhost-user backend / data plane thread via eventfd. + * Even if the guest enables the ring first, and pushes its first virtio + * request second (conforming to the virtio spec), the data plane thread + * in the backend may see the virtio request before the control plane + * thread sees the queue enablement. This causes (in fact, requires) the + * data plane thread to discard the virtio request (it arrived on a + * seemingly disabled queue). To prevent this out-of-order delivery, + * don't let the guest proceed to pushing the virtio request until the + * backend control plane acknowledges enabling the queue -- IOW, pass + * wait_for_reply=true below. + */ + ret = vhost_set_vring(dev, VHOST_USER_SET_VRING_ENABLE, &state, true); if (ret < 0) { /* * Restoring the previous state is likely infeasible, as well as From patchwork Wed Oct 18 15:56:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851038 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=bE8ktpEi; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bsc4gNlz23jS for ; Thu, 19 Oct 2023 03:29:40 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8vH-0005VL-Hz; Wed, 18 Oct 2023 11:57:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8u8-0003Ls-Dk for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8u3-0006wO-0d for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644569; 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=HAXg1GA35XKbMBiopu3Arj0qNQ/LAhb7uC4aAavHa34=; b=bE8ktpEi7yI2cgcdUGROFCKSlWT18O8srzdQYwvPgqViWohsjhyP7cFeJLFLK2zt9l5N/0 RBtCrQBRzMvEVJfPTPvK224AbncaqQtBcLmmYxAPJPk2DdInCguwaddRZBXcmGA1UJdFla TLx048UU/67FI3ur5CWOvLBc7OjZpMc= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-173-d8z93-ZtMSeIgnfiWxRugA-1; Wed, 18 Oct 2023 11:56:08 -0400 X-MC-Unique: d8z93-ZtMSeIgnfiWxRugA-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4083fec2c30so2976305e9.1 for ; Wed, 18 Oct 2023 08:56:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644567; x=1698249367; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=HAXg1GA35XKbMBiopu3Arj0qNQ/LAhb7uC4aAavHa34=; b=Yxs1zkjap4psrGoVlDqe551aGqKM8Tgyvqo6sG8ZXWLpwpX9Fen+CVBojoVGHFuvMd irXewwXPHOkw8JU2qA55LCt2pJ3cFn3uW9OVCETiTtWxhlJ+HRMWJX/3+ORUBiEtC/Vv wUAFRNdliIbQ8RKUMsKY3oGgTDGB9rHwbH+pVLXdeqD9lPnD8YNcuhoI/dVzPf9dprb8 DaUqhp+tWL0nHnRtSlD7kawfWB+Hmt8vdMuKtduCIqOEGCEBv2HENgunKw6ni8H3k2tL u5BR4Xt32bOqGropGRIsACb/laMxtpFWGX4bLGK38EsveQFWodtqrrOy9bRiDXU7uhl6 jpig== X-Gm-Message-State: AOJu0YygXZj2UUlEu2+SVCGhrwxVrTah01gs4vfQ68DW2wLiLwzkwAAD tNoT3Rotkl3KFydbshioOKWs/pnysLNA0gdLNYb7JDseUX38NbgvRejURwBkT8HjoYFdzHM9bap Lj7S0bt/fSaTN8dHn8da2kuu8v8o5eLvMxmbezuyXrY+Dc8x0Ck1H5AQkuDz1Y4SqLfXv3lc= X-Received: by 2002:a05:600c:45cc:b0:405:1c14:9227 with SMTP id s12-20020a05600c45cc00b004051c149227mr4304234wmo.33.1697644566915; Wed, 18 Oct 2023 08:56:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGZueD3mHa1BRBjCgtj0WLZmW1tAHEoAOgpcxe/yLn2feyfcnsrwX+AVb0L0Nu/SgsluQPZng== X-Received: by 2002:a05:600c:45cc:b0:405:1c14:9227 with SMTP id s12-20020a05600c45cc00b004051c149227mr4304212wmo.33.1697644566459; Wed, 18 Oct 2023 08:56:06 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id g38-20020a05600c4ca600b004078d71be9csm1966656wmp.13.2023.10.18.08.56.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:56:06 -0700 (PDT) Date: Wed, 18 Oct 2023 11:56:01 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Ilya Maximets , David Hildenbrand , Stefan Hajnoczi , Paolo Bonzini , Peter Xu , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= Subject: [PULL 36/83] memory: initialize 'fv' in MemoryRegionCache to make Coverity happy Message-ID: <26f1dcaa0e9ff83187b8dba810545f8b2a940b5a.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Ilya Maximets Coverity scan reports multiple false-positive "defects" for the following series of actions in virtio.c: MemoryRegionCache indirect_desc_cache; address_space_cache_init_empty(&indirect_desc_cache); address_space_cache_destroy(&indirect_desc_cache); For some reason it's unable to recognize the dependency between 'mrs.mr' and 'fv' and insists that '!mrs.mr' check in address_space_cache_destroy may take a 'false' branch, even though it is explicitly initialized to NULL in the address_space_cache_init_empty(): *** CID 1522371: Memory - illegal accesses (UNINIT) /qemu/hw/virtio/virtio.c: 1627 in virtqueue_split_pop() 1621 } 1622 1623 vq->inuse++; 1624 1625 trace_virtqueue_pop(vq, elem, elem->in_num, elem->out_num); 1626 done: >>> CID 1522371: Memory - illegal accesses (UNINIT) >>> Using uninitialized value "indirect_desc_cache.fv" when >>> calling "address_space_cache_destroy". 1627 address_space_cache_destroy(&indirect_desc_cache); 1628 1629 return elem; 1630 1631 err_undo_map: 1632 virtqueue_undo_map_desc(out_num, in_num, iov); ** CID 1522370: Memory - illegal accesses (UNINIT) Instead of trying to silence these false positive reports in 4 different places, initializing 'fv' as well, as this doesn't result in any noticeable performance impact. Signed-off-by: Ilya Maximets Message-Id: <20231009104322.3085887-1-i.maximets@ovn.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: David Hildenbrand Reviewed-by: Stefan Hajnoczi --- include/exec/memory.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/exec/memory.h b/include/exec/memory.h index 653a32ea10..9087d02769 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -2793,6 +2793,8 @@ int64_t address_space_cache_init(MemoryRegionCache *cache, static inline void address_space_cache_init_empty(MemoryRegionCache *cache) { cache->mrs.mr = NULL; + /* There is no real need to initialize fv, but it makes Coverity happy. */ + cache->fv = NULL; } /** From patchwork Wed Oct 18 15:56:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851066 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=h6MPsRSw; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9cF04JgPz20Zj for ; Thu, 19 Oct 2023 03:46:28 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8wa-00013z-Il; Wed, 18 Oct 2023 11:58:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8u8-0003Lt-Ie for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8u7-0006xF-1N for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644574; 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=n62ZCYLMWQB+v9G4ohwIMDOGfFG/zqXCKAbKv3KvAW8=; b=h6MPsRSwexB1piUbv1g4SgLlXCKXC3QmZqMaOukHxSP7dlVwex9KkFvPF8ZcHax8TAtt6M yAjOOQfI6Zp8w6Z/6qRRYDCosPKGth+xmtYmTVaW6kJ4tquMdz4myZpmP4ZTDmUK+vt2yE ZpMtOFJy2atVMNkaS3YK/0aLGdzlCFc= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-544-rqgZ_0V4N_milR0Z4MKygg-1; Wed, 18 Oct 2023 11:56:13 -0400 X-MC-Unique: rqgZ_0V4N_milR0Z4MKygg-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4053a5c6a59so44803295e9.3 for ; Wed, 18 Oct 2023 08:56:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644571; x=1698249371; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=n62ZCYLMWQB+v9G4ohwIMDOGfFG/zqXCKAbKv3KvAW8=; b=X/837KvuataE/IufwmsBySsXikf5IbGRzxc4eC8Wyhh210QJ9YPpV0tC3EGnYNI1JG /FrPyEExp4okCDfDrHTWSgfrb5A6Fax3cFqMzzoqj65VcRD8BHxLyg5XUTpEMB6EaHzs xW2CVXAMagKMdSzQkvQ2D+bxHbbsUBtwEWpysrbkhz0iciw40bXEsz4998uJn9f3c1yF 3I8JBPOML0omV7tztCHcvFDXAmS05eJQQKF+ujRrBTJaaqUkEgMDEsboFeWzJaLtiQZp LtIhndLeE97QrjxXNfFP/ZvyKAZNPl4IQvWY051rOepCPDzbsGUonUjuP65v0FQFhrgB rxpg== X-Gm-Message-State: AOJu0Yy8JzQNYv3CaVHxOTAVh2/dS6qXqbjJERtKP1yZxBRZRc+N4phR jO9LY9Z0czSBXIJ5NJBY4xKPT/dVSCGEqOH7+I7doRQL5QVXvHKvQ8AFfV0TJ5oucyhEqJZM0qm dxW99UO0f3BlWXrN3N/T99qFRvqVaLhio+peMKvTSZ5mQJthjqCyX9EUuqEXaTRBqG+wq+JM= X-Received: by 2002:a05:600c:46c6:b0:406:7d74:a2a6 with SMTP id q6-20020a05600c46c600b004067d74a2a6mr4371134wmo.24.1697644571153; Wed, 18 Oct 2023 08:56:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFDvMbCkZcCP+baXwAbNV0BwtseK+A+qqmRi04dO+1BFvCnCOH6f0hFRFZ3wEyq19QH1Og+gA== X-Received: by 2002:a05:600c:46c6:b0:406:7d74:a2a6 with SMTP id q6-20020a05600c46c600b004067d74a2a6mr4371119wmo.24.1697644570744; Wed, 18 Oct 2023 08:56:10 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id v21-20020a05600c12d500b004081a011c0esm1957200wmd.12.2023.10.18.08.56.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:56:10 -0700 (PDT) Date: Wed, 18 Oct 2023 11:56:06 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefan Hajnoczi , Raphael Norwitz , Paolo Bonzini , Fam Zheng Subject: [PULL 37/83] vhost-user: do not send RESET_OWNER on device reset Message-ID: <984f07e6172035498cd9c9614074a3ee0e775c13.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Stefan Hajnoczi The VHOST_USER_RESET_OWNER message is deprecated in the spec: This is no longer used. Used to be sent to request disabling all rings, but some back-ends interpreted it to also discard connection state (this interpretation would lead to bugs). It is recommended that back-ends either ignore this message, or use it to disable all rings. The only caller of vhost_user_reset_device() is vhost_user_scsi_reset(). It checks that F_RESET_DEVICE was negotiated before calling it: static void vhost_user_scsi_reset(VirtIODevice *vdev) { VHostSCSICommon *vsc = VHOST_SCSI_COMMON(vdev); struct vhost_dev *dev = &vsc->dev; /* * Historically, reset was not implemented so only reset devices * that are expecting it. */ if (!virtio_has_feature(dev->protocol_features, VHOST_USER_PROTOCOL_F_RESET_DEVICE)) { return; } if (dev->vhost_ops->vhost_reset_device) { dev->vhost_ops->vhost_reset_device(dev); } } Therefore VHOST_USER_RESET_OWNER is actually never sent by vhost_user_reset_device(). Remove the dead code. This effectively moves the vhost-user protocol specific code from vhost-user-scsi.c into vhost-user.c where it belongs. Signed-off-by: Stefan Hajnoczi Message-Id: <20231004014532.1228637-2-stefanha@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Raphael Norwitz --- hw/scsi/vhost-user-scsi.c | 9 --------- hw/virtio/vhost-user.c | 13 +++++++++---- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index df6b66cc1a..78aef4765f 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -67,15 +67,6 @@ static void vhost_user_scsi_reset(VirtIODevice *vdev) VHostSCSICommon *vsc = VHOST_SCSI_COMMON(vdev); struct vhost_dev *dev = &vsc->dev; - /* - * Historically, reset was not implemented so only reset devices - * that are expecting it. - */ - if (!virtio_has_feature(dev->protocol_features, - VHOST_USER_PROTOCOL_F_RESET_DEVICE)) { - return; - } - if (dev->vhost_ops->vhost_reset_device) { dev->vhost_ops->vhost_reset_device(dev); } diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 427ee0ebfb..f9414f03de 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1482,12 +1482,17 @@ static int vhost_user_reset_device(struct vhost_dev *dev) { VhostUserMsg msg = { .hdr.flags = VHOST_USER_VERSION, + .hdr.request = VHOST_USER_RESET_DEVICE, }; - msg.hdr.request = virtio_has_feature(dev->protocol_features, - VHOST_USER_PROTOCOL_F_RESET_DEVICE) - ? VHOST_USER_RESET_DEVICE - : VHOST_USER_RESET_OWNER; + /* + * Historically, reset was not implemented so only reset devices + * that are expecting it. + */ + if (!virtio_has_feature(dev->protocol_features, + VHOST_USER_PROTOCOL_F_RESET_DEVICE)) { + return -ENOSYS; + } return vhost_user_write(dev, &msg, NULL, 0); } From patchwork Wed Oct 18 15:56:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851085 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Iq6Np3Ww; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9ckm1xYSz20Pd for ; Thu, 19 Oct 2023 04:08:48 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8vK-0005tP-0r; Wed, 18 Oct 2023 11:57:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8uE-0003uE-Jg for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8uC-0006zF-64 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644579; 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=pK7tbuaeKJdZf3nB4jRfGMSAPSPT/dWMGPTuzqv6QUY=; b=Iq6Np3WwX0/bQVD0UotOfk2n9VbccmLoIyRiJg4oQ7TWHu4dOq/6ywthGZcXCGaVJf/Y6k BCe/oSWqCaceRhktYFc2id10Q5ZNe3emI4vXzJKKuMVj1UKaYM9WsQ8aa0OP2kiONvWENY rFhgMNbBMmBcYa54vKoD+DeUBYg9JdA= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-475-zOAIXCenMm6D0DcBPdpSoQ-1; Wed, 18 Oct 2023 11:56:17 -0400 X-MC-Unique: zOAIXCenMm6D0DcBPdpSoQ-1 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2c50dcd377eso47365151fa.2 for ; Wed, 18 Oct 2023 08:56:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644575; x=1698249375; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=pK7tbuaeKJdZf3nB4jRfGMSAPSPT/dWMGPTuzqv6QUY=; b=BNARhEYgFbpV0TYU3GWHeAda5i/+0uf0900XfnxM0YNMktPChWCFPgWZFutCZHrkLP U3PhF1s1McJOfnyvaV5ZkOwlv1Nt75EQ3Ud2alnJLffU+uhgGBdCqy4RF6LjssfS53Aj nfj0VEoTZ6j/XpAAuCjI/CYRpvkEpA7ouulGmzjQrrEhL5fZt7DQ6nKdz2l5z8MtXL02 60YuOy1WlFXKYkOzAfI6O/qS8rC4/pfDJCJQAxhvwtPoTan1g5ACqglNYrjqVzKWGRtk uR2eg3jQVU2LjSsY7iT+nN7jUEHCbEyfPKIUUg92qZjqGPTorJusYWhnfJpvJ336QnUh k1VA== X-Gm-Message-State: AOJu0YyEVD6r3/R9loz+xfl9KSp+DtCuNyf+pY1pYi73NRkPfg2/SPb8 EenPrBxE21Jl/x+U/eJzbyA/YLu+BhUUFJZt0Belw61WNFIa9gM//lsNWbakJqwI19krqc2WmRx oYvxvI9I69hPmIhpFAHPg5CkP3+Q8Ju9p41EGBtT+AQW1ifroB7FLkoWRJoIlIlWaHGikfKs= X-Received: by 2002:a05:651c:1198:b0:2c4:fef7:c41e with SMTP id w24-20020a05651c119800b002c4fef7c41emr3768473ljo.0.1697644575808; Wed, 18 Oct 2023 08:56:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHx+Q7d75V+zu5Xic4w1SZu941JfJgmRPwFNgSCI7Vh3lQ+OXIktkHNDyvxItal7Qc1pLv9A== X-Received: by 2002:a05:651c:1198:b0:2c4:fef7:c41e with SMTP id w24-20020a05651c119800b002c4fef7c41emr3768447ljo.0.1697644575508; Wed, 18 Oct 2023 08:56:15 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id o30-20020a05600c511e00b004063cd8105csm2044729wms.22.2023.10.18.08.56.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:56:15 -0700 (PDT) Date: Wed, 18 Oct 2023 11:56:11 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefan Hajnoczi , Raphael Norwitz , Hanna Czenczek Subject: [PULL 38/83] vhost-backend: remove vhost_kernel_reset_device() Message-ID: <4c8cad564f032f9ecc0b726df9211df717629dab.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Stefan Hajnoczi vhost_kernel_reset_device() invokes RESET_OWNER, which disassociates the owner process from the device. The device is left non-operational since SET_OWNER is only called once during startup in vhost_dev_init(). vhost_kernel_reset_device() is never called so this latent bug never appears. Get rid of vhost_kernel_reset_device() for now. If someone needs it in the future they'll need to implement it correctly. Signed-off-by: Stefan Hajnoczi Message-Id: <20231004014532.1228637-3-stefanha@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Raphael Norwitz Reviewed-by: Hanna Czenczek --- hw/virtio/vhost-backend.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/hw/virtio/vhost-backend.c b/hw/virtio/vhost-backend.c index 8e581575c9..17f3fc6a08 100644 --- a/hw/virtio/vhost-backend.c +++ b/hw/virtio/vhost-backend.c @@ -197,11 +197,6 @@ static int vhost_kernel_set_owner(struct vhost_dev *dev) return vhost_kernel_call(dev, VHOST_SET_OWNER, NULL); } -static int vhost_kernel_reset_device(struct vhost_dev *dev) -{ - return vhost_kernel_call(dev, VHOST_RESET_OWNER, NULL); -} - static int vhost_kernel_get_vq_index(struct vhost_dev *dev, int idx) { assert(idx >= dev->vq_index && idx < dev->vq_index + dev->nvqs); @@ -322,7 +317,6 @@ const VhostOps kernel_ops = { .vhost_get_features = vhost_kernel_get_features, .vhost_set_backend_cap = vhost_kernel_set_backend_cap, .vhost_set_owner = vhost_kernel_set_owner, - .vhost_reset_device = vhost_kernel_reset_device, .vhost_get_vq_index = vhost_kernel_get_vq_index, .vhost_vsock_set_guest_cid = vhost_kernel_vsock_set_guest_cid, .vhost_vsock_set_running = vhost_kernel_vsock_set_running, From patchwork Wed Oct 18 15:56:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851084 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=L5fNP8/b; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9ckS30xbz20Pd for ; Thu, 19 Oct 2023 04:08:32 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8vK-0005xn-Hx; Wed, 18 Oct 2023 11:57:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8uK-00044G-Kg for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8uH-00071p-5t for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644584; 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=fsLh7ia6XRW9dnJHrit24Lv0bVF86UyjHpRok70ZRQs=; b=L5fNP8/bUsedZQZmm9pmf07fAWYry1rTPWxomh93+DfoHhrI/RrVTZMa4LcZM/38NJEM9v fwzc+lxHd5Uk0GFf2GBmbGnCEgUfBDcftdtI/1tjoKYhGwZOgXwSEuFDJuTtj7528igUbs zmj5H2j7TNqc0zxD+khYC2voEr2dJPU= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-690-GxmzIErtO86OYowOTaogxg-1; Wed, 18 Oct 2023 11:56:23 -0400 X-MC-Unique: GxmzIErtO86OYowOTaogxg-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-3172a94b274so4245796f8f.0 for ; Wed, 18 Oct 2023 08:56:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644581; x=1698249381; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fsLh7ia6XRW9dnJHrit24Lv0bVF86UyjHpRok70ZRQs=; b=ezzYtedN1ReLrgVWpeNQ25oqv2jgwbRr+v99gmcbIH1Zi75x7wynT1DNeHoMHi2Xi8 WO+6hvivbRTmUlk6eeT5QntVxgHvAT/we5LyFG+LxMbBk0KSrKVFLSj+tPYFOTcGxrXs 7oAmHKrqyI2Fw/dDcUIQIVRrBePAC7BUk8pHO0fXA0mjzlHhOko6uCBksnZCMI93yBbW 7GXIsoYZ161e7G3CT3cHEhY2kf19YnHOFCAvRi8CI8jsB+Ys2zNMCYTnHWvbBPoJA0SM Pk0N4mvmcwfRNnXq02z6gCWIL6pYqp/+DC6h32BeXW8l/pUrGNOghwyFXYDp3Jmgz/jK eePw== X-Gm-Message-State: AOJu0YwZ2C3ZRtQ4CBHJpDJDWePCRyu+wkIisFzIE40RjvaQSDC18Ly1 vluhRYIlh6xcHCDa89Hsl/9E7fusg86MsCppmL3vfNVQXgTf4Ul5NEZ552VfyBjjp/9vLpN8uSt 6FkvZWrPqbhTxMPHE1TFlgnGGWbL6FIBSWk/D2bwGFNIDvyaG8B7vlniISpjMZ8Z8jhakaBU= X-Received: by 2002:a5d:6087:0:b0:32d:9b80:e2c6 with SMTP id w7-20020a5d6087000000b0032d9b80e2c6mr4205928wrt.26.1697644581453; Wed, 18 Oct 2023 08:56:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFwA69fOc+1X4JF5MdB4cd2D+ED0XqJNnMXun73yih18Fg5bJ5Ca9A0Gm2xxNvKt9dCvKoP0w== X-Received: by 2002:a5d:6087:0:b0:32d:9b80:e2c6 with SMTP id w7-20020a5d6087000000b0032d9b80e2c6mr4205904wrt.26.1697644581081; Wed, 18 Oct 2023 08:56:21 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id v14-20020a5d4a4e000000b0032196c508e3sm2362620wrs.53.2023.10.18.08.56.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:56:20 -0700 (PDT) Date: Wed, 18 Oct 2023 11:56:15 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefan Hajnoczi , Raphael Norwitz , Hanna Czenczek , Paolo Bonzini , Fam Zheng , =?utf-8?q?Marc-Andr=C3=A9?= Lureau , Daniel =?utf-8?b?UC4gQmVycmFuZ8Op?= , Thomas Huth , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= Subject: [PULL 39/83] virtio: call ->vhost_reset_device() during reset Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Stefan Hajnoczi vhost-user-scsi has a VirtioDeviceClass->reset() function that calls ->vhost_reset_device(). The other vhost devices don't notify the vhost device upon reset. Stateful vhost devices may need to handle device reset in order to free resources or prevent stale device state from interfering after reset. Call ->vhost_device_reset() from virtio_reset() so that that vhost devices are notified of device reset. This patch affects behavior as follows: - vhost-kernel: No change in behavior since ->vhost_reset_device() is not implemented. - vhost-user: back-ends that negotiate VHOST_USER_PROTOCOL_F_RESET_DEVICE now receive a VHOST_USER_DEVICE_RESET message upon device reset. Otherwise there is no change in behavior. DPDK, SPDK, libvhost-user, and the vhost-user-backend crate do not negotiate VHOST_USER_PROTOCOL_F_RESET_DEVICE automatically. - vhost-vdpa: an extra SET_STATUS 0 call is made during device reset. Signed-off-by: Stefan Hajnoczi Message-Id: <20231004014532.1228637-4-stefanha@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Raphael Norwitz Reviewed-by: Hanna Czenczek --- include/hw/virtio/vhost.h | 10 ++++++++++ hw/scsi/vhost-user-scsi.c | 11 ----------- hw/virtio/vhost.c | 9 +++++++++ hw/virtio/virtio.c | 4 ++++ meson.build | 1 + 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index c7e5467693..00e0a669b8 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -339,4 +339,14 @@ int vhost_dev_set_inflight(struct vhost_dev *dev, int vhost_dev_get_inflight(struct vhost_dev *dev, uint16_t queue_size, struct vhost_inflight *inflight); bool vhost_dev_has_iommu(struct vhost_dev *dev); + +#ifdef CONFIG_VHOST +int vhost_reset_device(struct vhost_dev *hdev); +#else +static inline int vhost_reset_device(struct vhost_dev *hdev) +{ + return -ENOSYS; +} +#endif /* CONFIG_VHOST */ + #endif diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index 78aef4765f..b7c6100f3e 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -62,16 +62,6 @@ static void vhost_user_scsi_set_status(VirtIODevice *vdev, uint8_t status) } } -static void vhost_user_scsi_reset(VirtIODevice *vdev) -{ - VHostSCSICommon *vsc = VHOST_SCSI_COMMON(vdev); - struct vhost_dev *dev = &vsc->dev; - - if (dev->vhost_ops->vhost_reset_device) { - dev->vhost_ops->vhost_reset_device(dev); - } -} - static void vhost_dummy_handle_output(VirtIODevice *vdev, VirtQueue *vq) { } @@ -191,7 +181,6 @@ static void vhost_user_scsi_class_init(ObjectClass *klass, void *data) vdc->get_features = vhost_scsi_common_get_features; vdc->set_config = vhost_scsi_common_set_config; vdc->set_status = vhost_user_scsi_set_status; - vdc->reset = vhost_user_scsi_reset; fwc->get_dev_path = vhost_scsi_common_get_fw_dev_path; } diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 9f37206ba0..92a6933f66 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -2154,3 +2154,12 @@ int vhost_net_set_backend(struct vhost_dev *hdev, return -ENOSYS; } + +int vhost_reset_device(struct vhost_dev *hdev) +{ + if (hdev->vhost_ops->vhost_reset_device) { + return hdev->vhost_ops->vhost_reset_device(hdev); + } + + return -ENOSYS; +} diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 6facd64fbc..fb24bc927b 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2136,6 +2136,10 @@ void virtio_reset(void *opaque) vdev->device_endian = virtio_default_endian(); } + if (vdev->vhost_started) { + vhost_reset_device(k->get_vhost(vdev)); + } + if (k->reset) { k->reset(vdev); } diff --git a/meson.build b/meson.build index e0d1f84b26..cbee764817 100644 --- a/meson.build +++ b/meson.build @@ -2134,6 +2134,7 @@ config_host_data.set('CONFIG_TPM', have_tpm) config_host_data.set('CONFIG_TSAN', get_option('tsan')) config_host_data.set('CONFIG_USB_LIBUSB', libusb.found()) config_host_data.set('CONFIG_VDE', vde.found()) +config_host_data.set('CONFIG_VHOST', have_vhost) config_host_data.set('CONFIG_VHOST_NET', have_vhost_net) config_host_data.set('CONFIG_VHOST_NET_USER', have_vhost_net_user) config_host_data.set('CONFIG_VHOST_NET_VDPA', have_vhost_net_vdpa) From patchwork Wed Oct 18 15:56:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851003 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XxT4y1Q+; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bDd0tDfz20Zj for ; Thu, 19 Oct 2023 03:01:05 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8vS-00074f-FA; Wed, 18 Oct 2023 11:57:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8ub-00048b-90 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8uY-000772-1N for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644600; 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=zsFr5HTvA8+mbntnG9MNra2wwSZ6tjasq8RRYVZ+VPU=; b=XxT4y1Q+f0Xw2mkLxneGc6wD23ceLwtjcsvSxios5FytaXfQdfPxob0lFGLPZLDpLE/TYq 2nhJ6Y2H68xlsLctrGXZ65ljrXuDCNEAGID3xa1KuFOTEQEQKjuG/vJZ8RcocHgoGOCEgO rq6+Bh1gxKTyCg6O3DiJnPoBbG1cCOc= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-310-PHG2fDefMhivwpQy28yBjQ-1; Wed, 18 Oct 2023 11:56:28 -0400 X-MC-Unique: PHG2fDefMhivwpQy28yBjQ-1 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-5079c865541so5173488e87.3 for ; Wed, 18 Oct 2023 08:56:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644587; x=1698249387; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zsFr5HTvA8+mbntnG9MNra2wwSZ6tjasq8RRYVZ+VPU=; b=GKhSAW+C0etILP+ZaeaffMtKaRMS0RztwpE9q2NxggFfPOdtqaq7JqXDKvUosV5eCL et2yfasL6pehIReGWQIrq8TgNjfixxWJLhwmyOI6N0l4fJiqhkTmwtuZz9wBHCDgJF3b gNZ5Nqj31Ed2A70Cdeko5kCgiYIjPAFXdR6fi3SneDsLVVvFmDJKBrcf9cX8B7G380yE 0p+2ows7gy/1iQqaX+LqGeDfj/vKT43ij9nbFQkE9OQhsq+Vl045gdkLVfBNXdmZPOaS SUubI5sJ5/bzaVxDBZsms98jqCdsvq3/EeIDHS4q2nwnAld1nyHn+1Tfqj5HT+mtGaE/ 4DaA== X-Gm-Message-State: AOJu0Yy88Zgf/9eBgNuMv6eJzAaq7Cg05DaSXwyoAACmihteY6ExAa++ ujk7j/L53rgSCW4x2bF3SwMbGF8OEdJr9srzaxuAzGPZs6WvT9LWbQqTzuc/FqSBduUjCN5Y9Ia JYE/5CT4kzKOhbkDg3LUVf4h7ftjw8JzKn1uwxJFK214Ohz6yJh/CzqSt2O6ltXaRbh7cu7o= X-Received: by 2002:ac2:55bc:0:b0:507:a96c:e76 with SMTP id y28-20020ac255bc000000b00507a96c0e76mr4418628lfg.21.1697644586819; Wed, 18 Oct 2023 08:56:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG26f17YTSp1BywFsAAcKHhAcN5haKhpJ/GGhsjBCwWxbk1SZKvWOw8LT5Bi3rZoidzKwBcag== X-Received: by 2002:ac2:55bc:0:b0:507:a96c:e76 with SMTP id y28-20020ac255bc000000b00507a96c0e76mr4418609lfg.21.1697644586507; Wed, 18 Oct 2023 08:56:26 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id f14-20020a5d664e000000b0032d687fd9d0sm2439179wrw.19.2023.10.18.08.56.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:56:26 -0700 (PDT) Date: Wed, 18 Oct 2023 11:56:21 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Ani Sinha , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Igor Mammedov , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 40/83] hw/i386/acpi-build: Remove build-time assertion on PIIX/ICH9 reset registers being identical Message-ID: <88638e868aa507c6047f8b3a51b1b73aa51ba3a1.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow Commit 6103451aeb74 ("hw/i386: Build-time assertion on pc/q35 reset register being identical.") introduced a build-time check where the addresses of the reset registers are expected to be equal. Back then rev3 of the FADT was used which required the reset register to be populated and there was common code. In commit 3a3fcc75f92a ("pc: acpi: force FADT rev1 for 440fx based machine types") the FADT was downgraded to rev1 for PIIX where the reset register isn't available. Thus, there is no need for the assertion any longer, so remove it. Signed-off-by: Bernhard Beschow Reviewed-by: Ani Sinha Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20231004092355.12929-1-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 3f2b27cf75..b0e1f074f1 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -56,7 +56,6 @@ /* Supported chipsets: */ #include "hw/southbridge/ich9.h" -#include "hw/southbridge/piix.h" #include "hw/acpi/pcihp.h" #include "hw/i386/fw_cfg.h" #include "hw/i386/pc.h" @@ -242,10 +241,6 @@ static void acpi_get_pm_info(MachineState *machine, AcpiPmInfo *pm) pm->pcihp_io_len = object_property_get_uint(obj, ACPI_PCIHP_IO_LEN_PROP, NULL); - /* The above need not be conditional on machine type because the reset port - * happens to be the same on PIIX (pc) and ICH9 (q35). */ - QEMU_BUILD_BUG_ON(ICH9_RST_CNT_IOPORT != PIIX_RCR_IOPORT); - /* Fill in optional s3/s4 related properties */ o = object_property_get_qobject(obj, ACPI_PM_PROP_S3_DISABLED, NULL); if (o) { From patchwork Wed Oct 18 15:56:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851125 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gwDvjT92; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9dXW1xhZz20Zj for ; Thu, 19 Oct 2023 04:44:59 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8vM-0006GB-O8; Wed, 18 Oct 2023 11:57:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8uS-00045b-If for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8uR-00075X-7c for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644594; 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=r9P1PewEfPu9iKkwPBAPgV0XPlfzyAO697drDJLVfyA=; b=gwDvjT92WIYKWi5DvilI2JT5r2qjEhEOE1s7Niq0ywA22hCdea9Z1rNQKVVYRPgVdyPrCB dfn9P4gpyg3RCh0aYBHBv4ncASVGCIarYLWO0FUDlVBCSlJ/lXyzrS8hG5ieK3MwxgSvm2 PnUTluKzoS8U0frU3HFgTAGchyCYfw4= Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-421-sMkx8DoaPSGTItzatujwOA-1; Wed, 18 Oct 2023 11:56:33 -0400 X-MC-Unique: sMkx8DoaPSGTItzatujwOA-1 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2c5032ab59eso56462981fa.3 for ; Wed, 18 Oct 2023 08:56:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644591; x=1698249391; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=r9P1PewEfPu9iKkwPBAPgV0XPlfzyAO697drDJLVfyA=; b=Py+y2QvUDTCY9KsVs1c2QxAFmyhyZ3ZW1Uws8HK6NdDlaK3XqnyoYLCoNa6NMQzYHz TYQNTls8/xqq0PUbwGV2o4xdsRReGhDe0Egd1+CRwCUqGJN0JmuJZpHRRIxnSP9yZctx LXZKJQSJEh9UK2BvHdecCLfJCQbKdDZRQqXz9Y6I0SgEtLsTbcAIRejMBRBNlTZjOIB2 BVb7PGdEF+46A8EDEGXrH5bK2Z7evlVf3+WGZMdV2dfmPaO50BSiWv5Gkgavg+H5UgzW TocCfv4MUSu8h6NzqYG/ltTPUY3ExDQ6Gy3mw/mrSsYBV0WKHVWmWLxgJr5X/TlA7eRq CkvA== X-Gm-Message-State: AOJu0YwelINCXLC9oEl+1ZelD3a/DTAj7IgU+19uT0VnwyaCbDdEo+42 pWPMYdm4/qeeoCD+vSDawWnK/cNLP11606KZpykEghKvxszWpeh4NwP5ckLk5eyuNXye2/FP0Ty 3weN9kvrgT2X6Hs+9ncS26JeXEDyIqb8ycDQ633lbbnxc75B+XuWPR7wKWolWrnZphnN5Vz8= X-Received: by 2002:a2e:a54d:0:b0:2c5:1b02:2d37 with SMTP id e13-20020a2ea54d000000b002c51b022d37mr2551014ljn.6.1697644591054; Wed, 18 Oct 2023 08:56:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFGTmI8xfFMaIrBeh9By0cjzp+MK7nNx5lcT33F3Gvw64c6mpbYgCT3yae6aZSP6SPfp86u/w== X-Received: by 2002:a2e:a54d:0:b0:2c5:1b02:2d37 with SMTP id e13-20020a2ea54d000000b002c51b022d37mr2550996ljn.6.1697644590741; Wed, 18 Oct 2023 08:56:30 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id z4-20020a05600c0a0400b0040775501256sm2033331wmp.16.2023.10.18.08.56.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:56:30 -0700 (PDT) Date: Wed, 18 Oct 2023 11:56:26 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Damien Zammit , Paolo Bonzini Subject: [PULL 41/83] timer/i8254: Fix one shot PIT mode Message-ID: <83def49ca026a1707f4923266280b14c766a5bc3.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Damien Zammit Currently, the one-shot (mode 1) PIT expires far too quickly, due to the output being set under the wrong logic. This change fixes the one-shot PIT mode to behave similarly to mode 0. TESTED: using the one-shot PIT mode to calibrate a local apic timer. Signed-off-by: Damien Zammit Message-Id: <20230226015755.52624-1-damien@zamaudio.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/timer/i8254_common.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/timer/i8254_common.c b/hw/timer/i8254_common.c index e4093e2904..b25da448c8 100644 --- a/hw/timer/i8254_common.c +++ b/hw/timer/i8254_common.c @@ -52,10 +52,8 @@ int pit_get_out(PITChannelState *s, int64_t current_time) switch (s->mode) { default: case 0: - out = (d >= s->count); - break; case 1: - out = (d < s->count); + out = (d >= s->count); break; case 2: if ((d % s->count) == 0 && d != 0) { From patchwork Wed Oct 18 15:56:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851006 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Ub2pKsiq; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bF610vxz20Zj for ; Thu, 19 Oct 2023 03:01:30 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8vP-0006bG-Ap; Wed, 18 Oct 2023 11:57:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8uZ-00048Z-Os for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8uW-00076x-5M for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644599; 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=uQ6e9TBmbkGr/609GK2LAExHu2tk4bgtDcm3tAT8ROI=; b=Ub2pKsiqWSeVOFqTa6HfOvhf/wwO31QS7xSO3wON7ORXCHMhPvLveuYhnFEUFcY3lYOaBI E37iQ3e92gVVtUuFloATUZHnx+RTodTU9cgdiFZggmkRGjwPLx9gbepCxFzdScgezwEOmV HGVXgq5TCuWfYjmn8ygtRztwepia8OE= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-299-94XvcYtUOseZ2VzqQELFTw-1; Wed, 18 Oct 2023 11:56:37 -0400 X-MC-Unique: 94XvcYtUOseZ2VzqQELFTw-1 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2c5073588cbso50588721fa.3 for ; Wed, 18 Oct 2023 08:56:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644595; x=1698249395; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=uQ6e9TBmbkGr/609GK2LAExHu2tk4bgtDcm3tAT8ROI=; b=fj8iZ/69V9rD8X68flidhINixf3BSGerbnFJ3e7FQHTQtNG38RqzQM2Tu1kOCavPCM SMDq53fvRNwm2Znx0/qtffkLp5ZBdq+eVdv1P5GmYYuPjmn/TkHQu5nMUodCdc0Nwi7N kklToz0b1SOAo2QqP8KS8SFNnK0hW5rEGrvMZtbrha3Zgq/0wGjgctTkcLSAwZVHxzkG n6dspzitZgD9b6q2dj9gkMNQ7BXrV5s3o/rwtOUZ2e9ls1rIvHgUnyXkObiOg3COt+IL FFKOzjByJdgIKEtElGfrGdGm9wo0rtRC0IIlUd08LOffWpWzYfloNm+xx9BHqTzWCDKU GQ+g== X-Gm-Message-State: AOJu0YynLV6nayBBPMoiE2kClwrv2kEtr1PCQ48hf+t98LxtUJ0z4BPj ziDThsNlvZQXHhpsGPYzeir/5luOf2igstD5ECQ71Z6npG6OmgoGZhUwSVXhMIp3k8CZIKQdFgO lmGhfnrv3YwVTPS00516iWKdvWxe44fPKd6QQpAqayVRNfBDaol8qoUJFhTAqf8VyE6qdouE= X-Received: by 2002:a05:651c:2da:b0:2b9:412a:111d with SMTP id f26-20020a05651c02da00b002b9412a111dmr3838521ljo.42.1697644595383; Wed, 18 Oct 2023 08:56:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGznMRwmkTUoE5twce4EX/Z+xcGgQsuVRgfEjefk/q3bjSW8DIG+6yV1cvpMJG01wOS3XjiwQ== X-Received: by 2002:a05:651c:2da:b0:2b9:412a:111d with SMTP id f26-20020a05651c02da00b002b9412a111dmr3838503ljo.42.1697644595041; Wed, 18 Oct 2023 08:56:35 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id z4-20020a05600c0a0400b0040775501256sm2033475wmp.16.2023.10.18.08.56.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:56:34 -0700 (PDT) Date: Wed, 18 Oct 2023 11:56:30 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Matheus Tavares Bernardino , Albert Esteve , Matheus@redhat.com, Tavares@redhat.com, Bernardino@redhat.com, <@redhat.com Subject: [PULL 42/83] hw/display: fix memleak from virtio_add_resource Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Matheus Tavares Bernardino When the given uuid is already present in the hash table, virtio_add_resource() does not add the passed VirtioSharedObject. In this case, free it in the callers to avoid leaking memory. This fixed the following `make check` error, when built with --enable-sanitizers: 4/166 qemu:unit / test-virtio-dmabuf ERROR 1.51s exit status 1 ==7716==ERROR: LeakSanitizer: detected memory leaks Direct leak of 320 byte(s) in 20 object(s) allocated from: #0 0x7f6fc16e3808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144 #1 0x7f6fc1503e98 in g_malloc (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x57e98) #2 0x564d63cafb6b in test_add_invalid_resource ../tests/unit/test-virtio-dmabuf.c:100 #3 0x7f6fc152659d (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x7a59d) SUMMARY: AddressSanitizer: 320 byte(s) leaked in 20 allocation(s). The changes at virtio_add_resource() itself are not strictly necessary for the memleak fix, but they make it more obvious that, on an error return, the passed object is not added to the hash. Signed-off-by: Matheus Tavares Bernardino Message-Id: Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Albert Esteve Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
--- hw/display/virtio-dmabuf.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hw/display/virtio-dmabuf.c b/hw/display/virtio-dmabuf.c index 4a8e430f3d..3dba4577ca 100644 --- a/hw/display/virtio-dmabuf.c +++ b/hw/display/virtio-dmabuf.c @@ -29,7 +29,7 @@ static int uuid_equal_func(const void *lhv, const void *rhv) static bool virtio_add_resource(QemuUUID *uuid, VirtioSharedObject *value) { - bool result = false; + bool result = true; g_mutex_lock(&lock); if (resource_uuids == NULL) { @@ -39,7 +39,9 @@ static bool virtio_add_resource(QemuUUID *uuid, VirtioSharedObject *value) g_free); } if (g_hash_table_lookup(resource_uuids, uuid) == NULL) { - result = g_hash_table_insert(resource_uuids, uuid, value); + g_hash_table_insert(resource_uuids, uuid, value); + } else { + result = false; } g_mutex_unlock(&lock); @@ -57,6 +59,9 @@ bool virtio_add_dmabuf(QemuUUID *uuid, int udmabuf_fd) vso->type = TYPE_DMABUF; vso->value = GINT_TO_POINTER(udmabuf_fd); result = virtio_add_resource(uuid, vso); + if (!result) { + g_free(vso); + } return result; } @@ -72,6 +77,9 @@ bool virtio_add_vhost_device(QemuUUID *uuid, struct vhost_dev *dev) vso->type = TYPE_VHOST_DEV; vso->value = dev; result = virtio_add_resource(uuid, vso); + if (!result) { + g_free(vso); + } return result; } From patchwork Wed Oct 18 15:56:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851008 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=bMqzSCdj; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bFL52Hkz20Zj for ; Thu, 19 Oct 2023 03:01:42 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8wf-0001Bb-VA; Wed, 18 Oct 2023 11:58:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8uh-0004Kv-Bn for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8uf-00077k-HW for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644608; 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=Pzl+3SpXCzlVlixQWa1M8uUNysQnsBwV7t6Y2e5urE4=; b=bMqzSCdjVY2i4bDiCT16xJgCGWMOtiIj97JACnxS69JZ5dAyDCvqllbWPBdT6+lR0A7Qu4 UvndNA39G/pYnt4ib0sGPwkPLchbfokoVPVWLEBvJ9AqOlFE7n2aI6SwzCPGji6fy4957O YpmFPQCNzyZJCCkZWDR7sXvqMg3q6x0= Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-553-BcrutSg3OZmJi6lcji0sGQ-1; Wed, 18 Oct 2023 11:56:41 -0400 X-MC-Unique: BcrutSg3OZmJi6lcji0sGQ-1 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2c53c85e482so17633321fa.1 for ; Wed, 18 Oct 2023 08:56:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644600; x=1698249400; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Pzl+3SpXCzlVlixQWa1M8uUNysQnsBwV7t6Y2e5urE4=; b=kB8KGmURjgaJhwsiWjQsTjJVVKRRokTZK6bshDnDV2Wm3akVM9qAPyI4Rftu/c0++Y 2yrRLS7tN0xdstOAVvBDrVmAiL0a1GS7lp2Yyr55yW4u9Xz4g/u1aH8nufEP+18HbWCw F1k6BeozLDr6g8Hyb7rQl0pnNRclL0X6yTz8EJ+rv8q9jEdMP8kNXigsU0JbPKQ3P4eu fp3sg20ulY8Mpm7ZTmZs5BVZ1ngBgm/vMRBQYCXabcGqIt2/N3yCDhG7JZLWDk9LqnyS icuYB9VC0ot8JISc8pd/vyHKaAWh7hq18Qf0MY3r53hF1njZDY/pYiJJ0gSeo96af6WZ JF0A== X-Gm-Message-State: AOJu0Yw41F4ILfOygZxgTCC3SZ9aWA0Vb4VTAAKQFyi8bvaMY9ypQNuS 9sO86OBWhuH/kR2IEY9UGZhjDPHPkyu5woZeGoZ7KNn6XYHp9roXC2VLuw4G+eHZthX7gniMMzX vspaiTelfYMW5aA/W+pqrAJdoB/eVFLuDRkYMxGcDeXVUzDm0tj+x/ts556fRk2qEEn/ef34= X-Received: by 2002:a2e:7d04:0:b0:2c5:2fa8:716a with SMTP id y4-20020a2e7d04000000b002c52fa8716amr4341469ljc.9.1697644599801; Wed, 18 Oct 2023 08:56:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH4cl0C62/P20R7jbQyYrUvQzg9wOIpAsbNlwtwp88CbQ5TWbJkI+yLvdLZfRXUcxMrbo/i2w== X-Received: by 2002:a2e:7d04:0:b0:2c5:2fa8:716a with SMTP id y4-20020a2e7d04000000b002c52fa8716amr4341455ljc.9.1697644599513; Wed, 18 Oct 2023 08:56:39 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id b12-20020a05600c150c00b0040586360a36sm1971567wmg.17.2023.10.18.08.56.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:56:39 -0700 (PDT) Date: Wed, 18 Oct 2023 11:56:35 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 43/83] hw/i386/pc: Merge two if statements into one Message-ID: <237b90d33a12914d4174d34269edf26c765b3b87.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow By being the only entity assigning a non-NULL value to "rtc_irq", the first if statement determines whether the second if statement is executed. So merge the two statements into one. Signed-off-by: Bernhard Beschow Message-Id: <20231007123843.127151-2-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/pc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index bb3854d1d0..7e6c4dc526 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1199,7 +1199,6 @@ void pc_basic_device_init(struct PCMachineState *pcms, DeviceState *hpet = NULL; int pit_isa_irq = 0; qemu_irq pit_alt_irq = NULL; - qemu_irq rtc_irq = NULL; ISADevice *pit = NULL; MemoryRegion *ioport80_io = g_new(MemoryRegion, 1); MemoryRegion *ioportF0_io = g_new(MemoryRegion, 1); @@ -1219,6 +1218,8 @@ void pc_basic_device_init(struct PCMachineState *pcms, */ if (pcms->hpet_enabled && (!kvm_irqchip_in_kernel() || kvm_has_pit_state2())) { + qemu_irq rtc_irq; + hpet = qdev_try_new(TYPE_HPET); if (!hpet) { error_report("couldn't create HPET device"); @@ -1243,9 +1244,6 @@ void pc_basic_device_init(struct PCMachineState *pcms, pit_isa_irq = -1; pit_alt_irq = qdev_get_gpio_in(hpet, HPET_LEGACY_PIT_INT); rtc_irq = qdev_get_gpio_in(hpet, HPET_LEGACY_RTC_INT); - } - - if (rtc_irq) { qdev_connect_gpio_out(DEVICE(rtc_state), 0, rtc_irq); } else { uint32_t irq = object_property_get_uint(OBJECT(rtc_state), @@ -1253,6 +1251,7 @@ void pc_basic_device_init(struct PCMachineState *pcms, &error_fatal); isa_connect_gpio_out(rtc_state, 0, irq); } + object_property_add_alias(OBJECT(pcms), "rtc-time", OBJECT(rtc_state), "date"); From patchwork Wed Oct 18 15:56:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851032 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Ku+iGh7y; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bmK3fyxz20cx for ; Thu, 19 Oct 2023 03:25:05 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8vg-0007pk-Ht; Wed, 18 Oct 2023 11:57:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8ug-0004KX-8f for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8ue-00077c-5J for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:56:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644607; 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=Gq5a9cgklusamAnqr6u4RtpwEQcuiHF1hB7JetLkRXQ=; b=Ku+iGh7yFukVWYrOyS0kJ6BpHjYggFbcEEWCI4WR/IUlWd5pKYkUDfkzedol78oeuD8H/O Ctl4auLxhzwB97XlG/7/KHnrPWzY56hIrhwI0p8lx0Va+Dq0PvbZjkwINaq34h/timx2m4 Jawm48dY5gpSwtfIZsKhNOg+0VO5JVw= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-584-5p_aU2uYPd25nygGLH7BZg-1; Wed, 18 Oct 2023 11:56:46 -0400 X-MC-Unique: 5p_aU2uYPd25nygGLH7BZg-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4077e9112b4so25265795e9.2 for ; Wed, 18 Oct 2023 08:56:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644604; x=1698249404; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Gq5a9cgklusamAnqr6u4RtpwEQcuiHF1hB7JetLkRXQ=; b=hAatImKDBW8alAcXOH/E1kyBNAZt51VK5dEN8boeMzDe5B6EmVzrZZ4AcviQ4TY/74 Lb/bAjRs/tV2mS5bMgiT2tcDKyDWmRLyxcBKFptJFZ7HfLht5nMWd8DWFrOoAR166wz/ YOeXgljXHIsjtaI9e5t+hNu8o6tCopsoEafSDf5GUZo2xW+bYEFrJHqTfesjrR0ChDWd ThDJX4Pa6DVBBuX6y4Sy9IF14b4Mcy7gLSkTvHQMc9PtmOhRsXjitFq30Yw6TDUgy0jI ToipzwVpxN55YGYMv6EpqVFuiMU56Ms3ba8fUDJjU8oW+tvDD5OK/VL0vJSQLDFQHPPb ah+g== X-Gm-Message-State: AOJu0Yy1sOVef+QRpMKK8tb6s/6SmhvWeCRz6EBLyvsQJxeuX4nNEKKW m5QInzvDcHdjkjOudGfc5f5Ju5ODPa8gW4JUI/W/TsX1PaHYLGsvbWWo1iC+NI4ck/YzB5RAWv6 Td5YHWgzAJyI923b7r7295faW29jfRWworwvGGz6LrlWTe0iKWFAPl6lLX3tXN1ewBby8WDU= X-Received: by 2002:a05:600c:468e:b0:405:3d04:5f52 with SMTP id p14-20020a05600c468e00b004053d045f52mr4279735wmo.24.1697644604607; Wed, 18 Oct 2023 08:56:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEznV9EVqIusTp62/1f18QBj8l2IikeCzaV1LA+nTS/NXjgogVee9IRBftVMpfsqBGb8WZzPA== X-Received: by 2002:a05:600c:468e:b0:405:3d04:5f52 with SMTP id p14-20020a05600c468e00b004053d045f52mr4279718wmo.24.1697644604140; Wed, 18 Oct 2023 08:56:44 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id m13-20020a7bca4d000000b00402ff8d6086sm1990012wml.18.2023.10.18.08.56.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:56:43 -0700 (PDT) Date: Wed, 18 Oct 2023 11:56:39 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 44/83] hw/i386/pc_piix: Allow for setting properties before realizing PIIX3 south bridge Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow The next patches will need to take advantage of it. Signed-off-by: Bernhard Beschow Reviewed-by: Peter Maydell Reviewed-by: Michael S. Tsirkin Message-Id: <20231007123843.127151-3-shentey@gmail.com> Signed-off-by: Michael S. Tsirkin --- hw/i386/pc_piix.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index e36a3262b2..6d2f5509e6 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -264,7 +264,8 @@ static void pc_init1(MachineState *machine, PIIX3State *piix3; PCIDevice *pci_dev; - pci_dev = pci_create_simple_multifunction(pci_bus, -1, TYPE_PIIX3_DEVICE); + pci_dev = pci_new_multifunction(-1, TYPE_PIIX3_DEVICE); + pci_realize_and_unref(pci_dev, pci_bus, &error_fatal); if (xen_enabled()) { pci_device_set_intx_routing_notifier( From patchwork Wed Oct 18 15:56:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851051 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=f61k1oqt; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9c6L5fh7z20cx for ; Thu, 19 Oct 2023 03:40:42 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8vN-0006Ks-Ck; Wed, 18 Oct 2023 11:57:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8uu-0004X6-Bo for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8us-00078f-QI for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644622; 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=R8vGmlEfppo+TqGZX0HrmOY6HWL1WGWh7BLfVKf8if4=; b=f61k1oqtWNKC2UFG/9/wuMEYvz1j6UvJD2/ZDAA46qd3jD0oJ+t+QHJrJqp5b/zp4gY3x9 cIZc112egOoGz6VNiopirQOBP4Ep+OXusjztTE68dlNoPsqQP76MeI9P8Lk+SazgOOJQ12 +P39/B494kpU1dEgc1nggjp+gixit/k= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-19-JDIJTJE4P3msmGhqaZ9kUg-1; Wed, 18 Oct 2023 11:56:50 -0400 X-MC-Unique: JDIJTJE4P3msmGhqaZ9kUg-1 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2c520e0a9a7so34428291fa.3 for ; Wed, 18 Oct 2023 08:56:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644609; x=1698249409; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=R8vGmlEfppo+TqGZX0HrmOY6HWL1WGWh7BLfVKf8if4=; b=X5fBNQ7K0a66vk/5EIAhkXpR2GA6GVEXLOaVF2cSkPzfcyoWVkiz7IXjLpV5GlRtN2 Fo5BKWJfDpihDrxYeRs/9WBdynT17Aj2nJtnj5GLfHVBy9x93MnvxFjrb6OE5siXdv66 vg388D6xhv0Tb7UbU29nQNENE1XIitx2hh6oKptUjiOrH7p67FcF/voNDFstrzqgn1P7 hDUD5x2XRUYKzBE151DHkwokAHNe8A+smBHKsLV2K/5AhaR/OWpQ3sZ2QCidK8jX+7LM SisKc5Du0frXy8pl99sLkv9bAN/pVTuiDmoG2cW/bqNRa3ypeyej9XL9LTY7oBwXoc2q RBHA== X-Gm-Message-State: AOJu0YyLbDzIfGm37Siaa3OejrXzD7ChwItkTL8OF4NugC8kyL+9kgxQ T6pZgQZdJeL7Y/SWSOzVogGqXrbkXyJKaawb8VwEGQaav3MF7IYS2SVOsZ8X5UPNRqD3Rc78Aqk FJs7+LtLTk6MB4H1TtXzOChLuRYrQ+rk3yZts3cRmVeQQouQh6HyO0bKqS9B86ILbycyVvIg= X-Received: by 2002:a2e:878d:0:b0:2b6:e958:5700 with SMTP id n13-20020a2e878d000000b002b6e9585700mr4426902lji.4.1697644608866; Wed, 18 Oct 2023 08:56:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGGxBSVeKm7PIZnk3OUL9d/jCO70NXoy64yYxolzV5NUed3DUY8rRx0lGE68xWghWsbdMDtLQ== X-Received: by 2002:a2e:878d:0:b0:2b6:e958:5700 with SMTP id n13-20020a2e878d000000b002b6e9585700mr4426887lji.4.1697644608584; Wed, 18 Oct 2023 08:56:48 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id h14-20020a05600c314e00b003fbe4cecc3bsm2024920wmo.16.2023.10.18.08.56.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:56:48 -0700 (PDT) Date: Wed, 18 Oct 2023 11:56:44 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 45/83] hw/i386/pc_piix: Assign PIIX3's ISA interrupts before its realize() Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow Unlike its PIIX4 counterpart, TYPE_PIIX3_DEVICE doesn't instantiate a PIC itself. Instead, it relies on the board to do so. This means that the board needs to wire the ISA IRQs to the PIIX3 device model. As long as the board assigns the ISA IRQs after PIIX3's realize(), internal devices can't be wired in pci_piix3_realize() since the qemu_irqs are still NULL. Fix that by assigning the ISA interrupts before realize(). This will allow for embedding child devices into the host device as already done for PIIX4. Signed-off-by: Bernhard Beschow Message-Id: <20231007123843.127151-4-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/pc_piix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 6d2f5509e6..a003923788 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -265,6 +265,8 @@ static void pc_init1(MachineState *machine, PCIDevice *pci_dev; pci_dev = pci_new_multifunction(-1, TYPE_PIIX3_DEVICE); + piix3 = PIIX3_PCI_DEVICE(pci_dev); + piix3->pic = x86ms->gsi; pci_realize_and_unref(pci_dev, pci_bus, &error_fatal); if (xen_enabled()) { @@ -281,8 +283,6 @@ static void pc_init1(MachineState *machine, XEN_IOAPIC_NUM_PIRQS); } - piix3 = PIIX3_PCI_DEVICE(pci_dev); - piix3->pic = x86ms->gsi; piix3_devfn = piix3->dev.devfn; isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0")); rtc_state = ISA_DEVICE(object_resolve_path_component(OBJECT(pci_dev), From patchwork Wed Oct 18 15:56:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851024 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=amAMzs8+; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bgq21wjz20Pd for ; Thu, 19 Oct 2023 03:21:11 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8vF-0005Lm-SZ; Wed, 18 Oct 2023 11:57:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8ur-0004X2-Rc for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8uq-00078M-7P for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644619; 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=nKoG7nE4OqpTmQziCVVo5UYOj3kP9c6/O8kpxrPA3Qc=; b=amAMzs8+bhiRryuwM29mFqpSTZZc92FT712Mcn8FNl8KGTPa6mDKU8TrbwqT1QbJaGD8ek NAPrcjq7Q3pB1zQaS+e6r2roS9awIrXK6FKqsfwMm4IY+qaEBpd9tREMOeKDd+WkcQnaDi nwc3EagdZkw0CBDDp7PbYo/OfMbF2C8= Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-365-AmsoKaWAMc66fsiGx_oPIw-1; Wed, 18 Oct 2023 11:56:57 -0400 X-MC-Unique: AmsoKaWAMc66fsiGx_oPIw-1 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-50433324cf3so7208711e87.3 for ; Wed, 18 Oct 2023 08:56:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644614; x=1698249414; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=nKoG7nE4OqpTmQziCVVo5UYOj3kP9c6/O8kpxrPA3Qc=; b=GhsZLwzKvfrbS6lL38NP3osfqM/l3UzFtuO2o5o+Bx9W19JVlrcyqAsakmcNAKaSHx D6uenAhjE8Yt7gUOCQ77pSi0bpyq2qhjTGAs47I896vLP5FPxIYJnY1a1Zwn7SEbpYin jxx/DJ/fGK0SAT8woMHPDROR9ruFaoWLS0X/QVEwR0V4jcUWg4ataNPZFR9HNRDywxFg CODriGItlyK+pEL8ry2+DT9qBmqRbGKcN1Fx6xrMbdoSLtGQam1ZCq7QikW186ZKINGd SgG/GJFvz+RdEcKagHAv6Qf1J5YcH15A10pl5L8MH/pGKjgr9VlgRm6GbGILIL0K7tbN 3jNg== X-Gm-Message-State: AOJu0YwTNsjfmm96wsY0tX5tQpOOuCFnkl4VJFtLsyPd4XQgFTGaW6+G 4PtdRg0yiALF2zcxOpm0zRkl3alvq8tm5EjLQa8QFd1e81YFZwetA8gYx2K+IUZOE7NB6xvglQN vXaesp8HkoxlMP9zX8oyYoXz4f5VyMe+1xRMl8XqgRLDDr59fpay2UBeWDv7tGhfWNwfV85U= X-Received: by 2002:ac2:4c4b:0:b0:507:974d:80f9 with SMTP id o11-20020ac24c4b000000b00507974d80f9mr5545154lfk.34.1697644614520; Wed, 18 Oct 2023 08:56:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGzbAh6StzWo2jxEcdIlOFuLN/MpwtON0PKi8xXltTZmtuN/OsImGlttGW/iiF8rOrKGQF4JQ== X-Received: by 2002:ac2:4c4b:0:b0:507:974d:80f9 with SMTP id o11-20020ac24c4b000000b00507974d80f9mr5545137lfk.34.1697644614202; Wed, 18 Oct 2023 08:56:54 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id o18-20020a05600c4fd200b0040472ad9a3dsm2026258wmq.14.2023.10.18.08.56.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:56:53 -0700 (PDT) Date: Wed, 18 Oct 2023 11:56:48 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Aurelien Jarno , =?utf-8?b?SGVydsOp?= Poussineau , Marcel Apfelbaum Subject: [PULL 46/83] hw/isa/piix3: Resolve redundant PIIX_NUM_PIC_IRQS Message-ID: <79583234651968bf9f73437eb2de14a485bd398a.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow PIIX_NUM_PIC_IRQS is assumed to be the same as ISA_NUM_IRQS, otherwise inconsistencies can occur. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin Message-Id: <20231007123843.127151-5-shentey@gmail.com> Signed-off-by: Michael S. Tsirkin --- include/hw/southbridge/piix.h | 5 ++--- hw/isa/piix3.c | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index 278171752f..2317bb7974 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -27,7 +27,6 @@ */ #define PIIX_RCR_IOPORT 0xcf9 -#define PIIX_NUM_PIC_IRQS 16 /* i8259 * 2 */ #define PIIX_NUM_PIRQS 4ULL /* PIRQ[A-D] */ struct PIIXState { @@ -39,10 +38,10 @@ struct PIIXState { * So one PIC level is tracked by PIIX_NUM_PIRQS bits. * * PIRQ is mapped to PIC pins, we track it by - * PIIX_NUM_PIRQS * PIIX_NUM_PIC_IRQS = 64 bits with + * PIIX_NUM_PIRQS * ISA_NUM_IRQS = 64 bits with * pic_irq * PIIX_NUM_PIRQS + pirq */ -#if PIIX_NUM_PIC_IRQS * PIIX_NUM_PIRQS > 64 +#if ISA_NUM_IRQS * PIIX_NUM_PIRQS > 64 #error "unable to encode pic state in 64bit in pic_levels." #endif uint64_t pic_levels; diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index 117024e450..7240c91440 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -48,7 +48,7 @@ static void piix3_set_irq_level_internal(PIIX3State *piix3, int pirq, int level) uint64_t mask; pic_irq = piix3->dev.config[PIIX_PIRQCA + pirq]; - if (pic_irq >= PIIX_NUM_PIC_IRQS) { + if (pic_irq >= ISA_NUM_IRQS) { return; } @@ -62,7 +62,7 @@ static void piix3_set_irq_level(PIIX3State *piix3, int pirq, int level) int pic_irq; pic_irq = piix3->dev.config[PIIX_PIRQCA + pirq]; - if (pic_irq >= PIIX_NUM_PIC_IRQS) { + if (pic_irq >= ISA_NUM_IRQS) { return; } @@ -83,7 +83,7 @@ static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opaque, int pin) int irq = piix3->dev.config[PIIX_PIRQCA + pin]; PCIINTxRoute route; - if (irq < PIIX_NUM_PIC_IRQS) { + if (irq < ISA_NUM_IRQS) { route.mode = PCI_INTX_ENABLED; route.irq = irq; } else { @@ -115,7 +115,7 @@ static void piix3_write_config(PCIDevice *dev, pci_bus_fire_intx_routing_notifier(pci_get_bus(&piix3->dev)); piix3_update_irq_levels(piix3); - for (pic_irq = 0; pic_irq < PIIX_NUM_PIC_IRQS; pic_irq++) { + for (pic_irq = 0; pic_irq < ISA_NUM_IRQS; pic_irq++) { piix3_set_irq_pic(piix3, pic_irq); } } From patchwork Wed Oct 18 15:56:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851067 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=URqiGQBQ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9cHZ3G1Cz20Zj for ; Thu, 19 Oct 2023 03:48:42 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8wj-0001G5-9H; Wed, 18 Oct 2023 11:58:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8v3-0004YV-MG for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8uz-0007DM-LR for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644628; 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=o+ER8U4zTaPMQSzbJAzk8GehGsCBqp1JYIJr1D7ENQ0=; b=URqiGQBQtfrp1wOPWiEIfyhtx8W9Ng/5Jgq1VzNVnCK/IyJpARPfQy3GOnHuFYyXqHr8Rl flBOtowsyIOPcnyQjbBDwwVE8iqa65q0IaNM1wVV+6EVHws8iCEB5gSkizrszyXotSYoEM K4mV2BIDxyJG7mQzCbH2jMVMV0FETPk= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-216-naKvYCdJPj6HGLThrM2dBg-1; Wed, 18 Oct 2023 11:57:01 -0400 X-MC-Unique: naKvYCdJPj6HGLThrM2dBg-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4084001846eso3580815e9.1 for ; Wed, 18 Oct 2023 08:57:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644620; x=1698249420; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=o+ER8U4zTaPMQSzbJAzk8GehGsCBqp1JYIJr1D7ENQ0=; b=S8cNKgufEPFBcnHYlMMnR5x7b5ITnkkUB4xXHuOtwhjTFvog4WBIExnQg4950VbtZu fDp5X34m/J7+zHjbibqGT1gQmIsz7I/o99wTY3FwELAAd0tIJskupHopHC2Z3WhFUU1K tJjaImNXYHcqIGEGVkk4Gy7Ri7l2pZJtUVwlVVKxIFp2A90pqP9uSU0volkrphXn1dSH YftH+TC0V2Nkd+cSUB8lnlW1+PTHqcpPunLLR+E1uZQK40e7oZWZWiWO1DnC4gUr/g6q 5H3ru4RR2ycrzDj5NayqmySkdvlKJmsaWbulNB0EWK0H+IYTihzJyUCoqUVuPRBX5j0L CefA== X-Gm-Message-State: AOJu0YwCqxwMgWWKtt/HZwamnWIUcIt6Nl8hae9RYSWASN5mW9KETImx 0wYzIgjlMv3mrA1nLZ3XhXjPtXF1XiW9ysPDTF5Hb3Iz05Y+hEYYFeIdprz1EGCxqmKBt09Gbrp PkxWPm6da0acx1ZorpGHETRvr6dwyCzgfcZhBqmGr7KHufk5u32V1zEAK0MvGhL6kAcrGU9Q= X-Received: by 2002:a5d:6308:0:b0:32d:a6f5:a511 with SMTP id i8-20020a5d6308000000b0032da6f5a511mr4208135wru.13.1697644620158; Wed, 18 Oct 2023 08:57:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFbKurOWUKoDT/MGxEF9R3whiG8pe13SZgkGotCctbNjS+W67QN9JQoZ7M8zk6ntZUnyRhrNw== X-Received: by 2002:a5d:6308:0:b0:32d:a6f5:a511 with SMTP id i8-20020a5d6308000000b0032da6f5a511mr4208117wru.13.1697644619716; Wed, 18 Oct 2023 08:56:59 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id b3-20020adff243000000b003258934a4bcsm2401664wrp.42.2023.10.18.08.56.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:56:59 -0700 (PDT) Date: Wed, 18 Oct 2023 11:56:54 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost , =?utf-8?b?SGVydsOp?= Poussineau , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Aurelien Jarno Subject: [PULL 47/83] hw/i386/pc_piix: Wire PIIX3's ISA interrupts by new "isa-irqs" property Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow Avoid assigning the private member of struct PIIX3State from outside which goes against best QOM practices. Instead, implement best QOM practice by adding an "isa-irqs" array property to TYPE_PIIX3_DEVICE and assign it in board code, i.e. from outside. Signed-off-by: Bernhard Beschow Message-Id: <20231007123843.127151-6-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/southbridge/piix.h | 2 +- hw/i386/pc_piix.c | 7 ++++++- hw/isa/piix3.c | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index 2317bb7974..bb898c6c88 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -46,7 +46,7 @@ struct PIIXState { #endif uint64_t pic_levels; - qemu_irq *pic; + qemu_irq pic[ISA_NUM_IRQS]; /* This member isn't used. Just for save/load compatibility */ int32_t pci_irq_levels_vmstate[PIIX_NUM_PIRQS]; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index a003923788..4dc7298c15 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -263,10 +263,15 @@ static void pc_init1(MachineState *machine, if (pcmc->pci_enabled) { PIIX3State *piix3; PCIDevice *pci_dev; + DeviceState *dev; + size_t i; pci_dev = pci_new_multifunction(-1, TYPE_PIIX3_DEVICE); piix3 = PIIX3_PCI_DEVICE(pci_dev); - piix3->pic = x86ms->gsi; + dev = DEVICE(pci_dev); + for (i = 0; i < ISA_NUM_IRQS; i++) { + qdev_connect_gpio_out_named(dev, "isa-irqs", i, x86ms->gsi[i]); + } pci_realize_and_unref(pci_dev, pci_bus, &error_fatal); if (xen_enabled()) { diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index 7240c91440..c17547a2c0 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -312,6 +312,8 @@ static void pci_piix3_init(Object *obj) { PIIX3State *d = PIIX3_PCI_DEVICE(obj); + qdev_init_gpio_out_named(DEVICE(obj), d->pic, "isa-irqs", ISA_NUM_IRQS); + object_initialize_child(obj, "rtc", &d->rtc, TYPE_MC146818_RTC); } From patchwork Wed Oct 18 15:56:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851114 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fyIMJde8; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9dSj08WZz20Zj for ; Thu, 19 Oct 2023 04:41:41 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8vM-00069N-8K; Wed, 18 Oct 2023 11:57:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8v1-0004YQ-JZ for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8uz-0007DI-1t for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644628; 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=Zb7+9uBs0aVVSmIJfkcKx4/iAP+jZ8ER447ZRZ+1lm8=; b=fyIMJde8eJKmrjbLE31aUZdYrft3ltCHGWvI6z6VhjP8/3rsbLpNI8IHfFTYu4snsTo60t 0XlLmA5ma1RoGAMDyS30t+py8/qDXjtDNfSz+jok2E14iyODUJDtYIsbETj/LYb9J3HE9E 5HIb8ZvmlktcMw/ovw+4F2T2C1iX3Qk= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-577-TeSHBGmtPKe8M52AS_j3xA-1; Wed, 18 Oct 2023 11:57:07 -0400 X-MC-Unique: TeSHBGmtPKe8M52AS_j3xA-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4055ce1e8c4so36991075e9.0 for ; Wed, 18 Oct 2023 08:57:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644625; x=1698249425; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Zb7+9uBs0aVVSmIJfkcKx4/iAP+jZ8ER447ZRZ+1lm8=; b=R/ueXKeWh3uXTDXU5gNCpjop1tvyaKjfrrB77cdF/+VLk5aba6FuikG44z6uGQp+q1 iiFyHiz52it9Y47lskbRr0fpEw5/bpN2aPU+vcEq1eaIhH32mJAEo1q3STR2n23fYcW2 CDF3R8r74Bi6vcZ7nuc9jm6S5ZF3ZE9JH/c0trTGTwg70PQI7wVAwxX+YpUsmzIakn9T PMssf2dWRRA0Jz6+71RH2iIo7LnSwMDZTCVNdfb+h8kDmH5eWZktvyVJxJcz+3XuQ+XR OzuCdOAcbE3slEJ8w/L32Hc35eKmPt6AhCMRf5gYAouR5yKzY9HMha2myC7sAFdU0SFg 4NsQ== X-Gm-Message-State: AOJu0YwNmv38Rr+E2E1ronSHS9WFEkMnX+9ASRfF2bjTXYJwgxizlxXK khskB6oMjzSrxpRs6pXxZbkrASn6zyRwPNf4u7yeGgCny3r6jrX7wYYzjXxY6q9ZovnoeZWu7/g oXdg3oxOqH7Q0JLUmEL0OByLCcpVc1OqonJsqhDybKRlWJFCQGGY6SqByw+8OD8yIfn49AJ0= X-Received: by 2002:a05:600c:3d14:b0:405:2d29:1648 with SMTP id bh20-20020a05600c3d1400b004052d291648mr5324422wmb.19.1697644625438; Wed, 18 Oct 2023 08:57:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGG8t3Do19EdyXZG8RCuoxvusSgLlINcXxvxXQndb7Cj5OCAh9F7BsUK9YDo408KdxGdCLLxQ== X-Received: by 2002:a05:600c:3d14:b0:405:2d29:1648 with SMTP id bh20-20020a05600c3d1400b004052d291648mr5324397wmb.19.1697644624927; Wed, 18 Oct 2023 08:57:04 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id v7-20020adfebc7000000b003196b1bb528sm2387972wrn.64.2023.10.18.08.57.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:57:04 -0700 (PDT) Date: Wed, 18 Oct 2023 11:56:59 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 48/83] hw/i386/pc_piix: Remove redundant "piix3" variable Message-ID: <16880173d8a76d4423d377dd966a12d1f312d894.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow The variable is never used by its declared type. Eliminate it. Signed-off-by: Bernhard Beschow Message-Id: <20231007123843.127151-7-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/pc_piix.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 4dc7298c15..cd6c00c0b3 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -261,13 +261,11 @@ static void pc_init1(MachineState *machine, gsi_state = pc_gsi_create(&x86ms->gsi, pcmc->pci_enabled); if (pcmc->pci_enabled) { - PIIX3State *piix3; PCIDevice *pci_dev; DeviceState *dev; size_t i; pci_dev = pci_new_multifunction(-1, TYPE_PIIX3_DEVICE); - piix3 = PIIX3_PCI_DEVICE(pci_dev); dev = DEVICE(pci_dev); for (i = 0; i < ISA_NUM_IRQS; i++) { qdev_connect_gpio_out_named(dev, "isa-irqs", i, x86ms->gsi[i]); @@ -288,8 +286,8 @@ static void pc_init1(MachineState *machine, XEN_IOAPIC_NUM_PIRQS); } - piix3_devfn = piix3->dev.devfn; - isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0")); + piix3_devfn = pci_dev->devfn; + isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(pci_dev), "isa.0")); rtc_state = ISA_DEVICE(object_resolve_path_component(OBJECT(pci_dev), "rtc")); } else { From patchwork Wed Oct 18 15:57:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851035 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=eCWxuHqq; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bpP0VQxz20cx for ; Thu, 19 Oct 2023 03:26:53 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8wn-0001LL-5f; Wed, 18 Oct 2023 11:59:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8v7-0004Zn-Gx for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8v3-0007Fr-UX for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644633; 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=EV0w/juyamhfIdi/nYYRPk3ACWIP8V+WfsiMSqIQCVQ=; b=eCWxuHqqBJXeJMzPRKX9637cQlqARWSYnmlfMEp3AIf8phHj/FGhFmdihgOmNv13c8fuee sfBRuswgh7vWPvEo5skmM/4neb9U72jn1DhZwHMpzKNfYiTUMlif975DXNrjhEA3P00W1P QFsocUzG0mXx+kW8EhunVQze1FtYstY= Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-222-ym-Qq55sMzKWa_S4tY39aQ-1; Wed, 18 Oct 2023 11:57:11 -0400 X-MC-Unique: ym-Qq55sMzKWa_S4tY39aQ-1 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-507c8a8e5d1so915150e87.3 for ; Wed, 18 Oct 2023 08:57:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644629; x=1698249429; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=EV0w/juyamhfIdi/nYYRPk3ACWIP8V+WfsiMSqIQCVQ=; b=l7H5zCK+UoGTj+0Gp3ednK+jUheXIx8XpHmD0hVSuDegIJ6qi6CHDj1LsvNyR5IK6Y mkCEtOwLZ7USTUiiNx0/y5cIlMCFNbhKbTiLCNN98hcvjE0kNGrmWMjTxE0fj2Nm+y5A YGIjMX+GP4N8M83UySTDZuZy+lvS2TDf1QXKJhX3MX6+mxZslCiNzs9W1Th9Di5vonl2 no1nd0+27YNaKX2yQ3v8EaEdfhCf0Q+FzrCdcstq28V2lB0frYgOxhA0KocFNEQmRivH nFDuH7d0C9rr8Gr0awzUyOQ5K9dNUg1CFPCGlRwO7vytG1YljDcR1ZGJBXzgkHOt1V+G /Y7A== X-Gm-Message-State: AOJu0YxVfbUbDDXkBMHk/LqEhtwalpYBf4E9XGJGyPw1ZvaoFKyVHPLm UiGEltxV+bj9JC09yAPq9NQgUewHccUkEdVSQI2QlO9ghbC8W0xYfPuudPJU6kr37DO+xIntj5F Mz6QsUsSLLjLqf4w8y3pZvIm4iPsSDrf9FpWckxiIMxqoHcgcDY2QjAE8x7POLL6SVXB65Kk= X-Received: by 2002:a05:6512:3b90:b0:503:35bb:1e74 with SMTP id g16-20020a0565123b9000b0050335bb1e74mr5164358lfv.61.1697644629630; Wed, 18 Oct 2023 08:57:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGKG5tSMgXUUTyfIRSW8fVaTQhAUQqFbXFV+KCT0FukA3EQEB2I5XxNoskhp8cHCb+lVKgIFQ== X-Received: by 2002:a05:6512:3b90:b0:503:35bb:1e74 with SMTP id g16-20020a0565123b9000b0050335bb1e74mr5164334lfv.61.1697644629193; Wed, 18 Oct 2023 08:57:09 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id t16-20020a05600c199000b004068e09a70bsm2023905wmq.31.2023.10.18.08.57.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:57:08 -0700 (PDT) Date: Wed, 18 Oct 2023 11:57:05 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Aurelien Jarno , =?utf-8?b?SGVydsOp?= Poussineau , Marcel Apfelbaum Subject: [PULL 49/83] hw/isa/piix3: Rename "pic" attribute to "isa_irqs_in" Message-ID: <23926d6e3aeae32c0de63353af8b18e379b9e60c.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow TYPE_PIIX3_DEVICE doesn't instantiate a PIC since it relies on the board to do so. The "pic" attribute, however, suggests that there is one. Rename the attribute to reflect that it represents ISA interrupt lines. Use the same naming convention as in the VIA south bridges as well as in TYPE_I82378. Signed-off-by: Bernhard Beschow Message-Id: <20231007123843.127151-8-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/southbridge/piix.h | 2 +- hw/isa/piix3.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index bb898c6c88..b07ff6bb26 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -46,7 +46,7 @@ struct PIIXState { #endif uint64_t pic_levels; - qemu_irq pic[ISA_NUM_IRQS]; + qemu_irq isa_irqs_in[ISA_NUM_IRQS]; /* This member isn't used. Just for save/load compatibility */ int32_t pci_irq_levels_vmstate[PIIX_NUM_PIRQS]; diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index c17547a2c0..616f5418fa 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -36,7 +36,7 @@ static void piix3_set_irq_pic(PIIX3State *piix3, int pic_irq) { - qemu_set_irq(piix3->pic[pic_irq], + qemu_set_irq(piix3->isa_irqs_in[pic_irq], !!(piix3->pic_levels & (((1ULL << PIIX_NUM_PIRQS) - 1) << (pic_irq * PIIX_NUM_PIRQS)))); @@ -312,7 +312,8 @@ static void pci_piix3_init(Object *obj) { PIIX3State *d = PIIX3_PCI_DEVICE(obj); - qdev_init_gpio_out_named(DEVICE(obj), d->pic, "isa-irqs", ISA_NUM_IRQS); + qdev_init_gpio_out_named(DEVICE(obj), d->isa_irqs_in, "isa-irqs", + ISA_NUM_IRQS); object_initialize_child(obj, "rtc", &d->rtc, TYPE_MC146818_RTC); } From patchwork Wed Oct 18 15:57:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851094 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HUiA9mcm; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9crN5Pdmz20Zj for ; Thu, 19 Oct 2023 04:13:40 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8vQ-0006ju-9p; Wed, 18 Oct 2023 11:57:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vK-0005zi-Nh for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vI-0007JF-R8 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644648; 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=4mhfXj45nr0zKARw7EbZ1yJ39RO40+yefJvQYbdbnLw=; b=HUiA9mcm3aPVd3QEeKGYL4bgUBjVIUPzYMF/gXy3O/8OGNDLK8cf6Aa8kTgLfZjUsnwXPS II9o06ZN6m+DzwTNjTtOdAxrT5oQYlIQTiwGc8m5iTHmDXaT19nNxzJNwHaoja6ldIeEcU +AAAmC2QzH6lW+D+PssnCtS3mmJOTic= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-633-7c3685XpM0q3jFiybGFrIQ-1; Wed, 18 Oct 2023 11:57:16 -0400 X-MC-Unique: 7c3685XpM0q3jFiybGFrIQ-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4053a5c6a59so44809395e9.3 for ; Wed, 18 Oct 2023 08:57:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644635; x=1698249435; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=4mhfXj45nr0zKARw7EbZ1yJ39RO40+yefJvQYbdbnLw=; b=bfenzwEwx3mJKcqrkXtzMLPh4nSWY5BENKyRRgCwQH3o3wcO/2IQ+efS1EZ1ySv2Sz Stv13cSgZKJ7VUF/JiBy7xVVkzA6QsCm+behJNqKJ8zEudgm3v9o6d+899xq9usfCh9m dWhdFblq8EAiQcEItxSbkVVhz42WMOb9sc685iSo2NT+wMITqruiWtICt1HxldiRUx1K OaJuEFXf/2Sq5V6eFv48ft8hT0Q5bOGfZgcwlcyIj8RUwmN+HEAdU+Jm7IasByt8KqdN JYWgBGDAjdCs90dXhl43LSKJWkMj0L0etUvpZZPF9mPlxWg7qN36yGyZaX7IgMg3nq65 6f6w== X-Gm-Message-State: AOJu0YwTELoiKGvly3eXvpCbKKyy2VMURjjL+O9uQztEHOYqMe0r7cFA g1Ah99xSTDW7rkM8HN/2cqLmZPWuxeiXELoC6xjG+h27aedHDM6fSF5AkZzqxOqH4qWkHmjuN5C gl6EU+CoWdEY/nyYBOqFPYkqMxMqYrDjqiebOnXQTHOFQtCQ1fxF6eu8h/n60KWGncHTuM9w= X-Received: by 2002:a05:600c:3b2a:b0:406:847a:2934 with SMTP id m42-20020a05600c3b2a00b00406847a2934mr4426143wms.28.1697644634870; Wed, 18 Oct 2023 08:57:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHfE8AQgClSjGCnYIj1Px+ZWiGoaw4sLEpmfFVGXbzrbahUkm9t1Agci4QuFZwWnbhR8cPKJw== X-Received: by 2002:a05:600c:3b2a:b0:406:847a:2934 with SMTP id m42-20020a05600c3b2a00b00406847a2934mr4426117wms.28.1697644634405; Wed, 18 Oct 2023 08:57:14 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id f13-20020a1c6a0d000000b003fe23b10fdfsm1964667wmc.36.2023.10.18.08.57.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:57:13 -0700 (PDT) Date: Wed, 18 Oct 2023 11:57:09 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 50/83] hw/i386/pc_q35: Wire ICH9 LPC function's interrupts before its realize() Message-ID: <1594e3eee0f85bdc017a7ebf089167296ef394a7.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow When the board assigns the ISA IRQs after the device's realize(), internal devices such as the RTC can't be wired in ich9_lpc_realize() since the qemu_irqs are still NULL. Fix that by assigning the ISA interrupts before realize(). This change is necessary for PIIX consolidation because PIIX4 wires the RTC interrupts in its realize() method, so PIIX3 needs to do so as well. Since the PC and Q35 boards share RTC code, and since PIIX3 needs the change, ICH9 needs to be adapted as well. Signed-off-by: Bernhard Beschow Message-Id: <20231007123843.127151-9-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/pc_q35.c | 14 +++++++------- hw/isa/lpc_ich9.c | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index a7386f2ca2..597943ff1b 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -242,11 +242,18 @@ static void pc_q35_init(MachineState *machine) host_bus = PCI_BUS(qdev_get_child_bus(DEVICE(phb), "pcie.0")); pcms->bus = host_bus; + /* irq lines */ + gsi_state = pc_gsi_create(&x86ms->gsi, pcmc->pci_enabled); + /* create ISA bus */ lpc = pci_new_multifunction(PCI_DEVFN(ICH9_LPC_DEV, ICH9_LPC_FUNC), TYPE_ICH9_LPC_DEVICE); qdev_prop_set_bit(DEVICE(lpc), "smm-enabled", x86_machine_is_smm_enabled(x86ms)); + lpc_dev = DEVICE(lpc); + for (i = 0; i < IOAPIC_NUM_PINS; i++) { + qdev_connect_gpio_out_named(lpc_dev, ICH9_GPIO_GSI, i, x86ms->gsi[i]); + } pci_realize_and_unref(lpc, host_bus, &error_fatal); rtc_state = ISA_DEVICE(object_resolve_path_component(OBJECT(lpc), "rtc")); @@ -273,13 +280,6 @@ static void pc_q35_init(MachineState *machine) "true", true); } - /* irq lines */ - gsi_state = pc_gsi_create(&x86ms->gsi, pcmc->pci_enabled); - - lpc_dev = DEVICE(lpc); - for (i = 0; i < IOAPIC_NUM_PINS; i++) { - qdev_connect_gpio_out_named(lpc_dev, ICH9_GPIO_GSI, i, x86ms->gsi[i]); - } isa_bus = ISA_BUS(qdev_get_child_bus(lpc_dev, "isa.0")); if (x86ms->pic == ON_OFF_AUTO_ON || x86ms->pic == ON_OFF_AUTO_AUTO) { diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index 3f59980aa0..3fcefc5a8a 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -675,6 +675,9 @@ static void ich9_lpc_initfn(Object *obj) object_initialize_child(obj, "rtc", &lpc->rtc, TYPE_MC146818_RTC); + qdev_init_gpio_out_named(DEVICE(lpc), lpc->gsi, ICH9_GPIO_GSI, + IOAPIC_NUM_PINS); + object_property_add_uint8_ptr(obj, ACPI_PM_PROP_SCI_INT, &lpc->sci_gsi, OBJ_PROP_FLAG_READ); object_property_add_uint8_ptr(OBJECT(lpc), ACPI_PM_PROP_ACPI_ENABLE_CMD, @@ -691,7 +694,6 @@ static void ich9_lpc_initfn(Object *obj) static void ich9_lpc_realize(PCIDevice *d, Error **errp) { ICH9LPCState *lpc = ICH9_LPC_DEVICE(d); - DeviceState *dev = DEVICE(d); PCIBus *pci_bus = pci_get_bus(d); ISABus *isa_bus; @@ -734,8 +736,6 @@ static void ich9_lpc_realize(PCIDevice *d, Error **errp) ICH9_RST_CNT_IOPORT, &lpc->rst_cnt_mem, 1); - qdev_init_gpio_out_named(dev, lpc->gsi, ICH9_GPIO_GSI, IOAPIC_NUM_PINS); - isa_bus_register_input_irqs(isa_bus, lpc->gsi); i8257_dma_init(isa_bus, 0); From patchwork Wed Oct 18 15:57:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851068 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=c1cSMVqW; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9cJ51FmFz20Zj for ; Thu, 19 Oct 2023 03:49:09 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8wz-0001UT-JW; Wed, 18 Oct 2023 11:59:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vF-0005JS-H0 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vD-0007J0-TB for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644643; 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=uLW4nacuIeTJ5EH0RbV4BQZpdBCvivCuyeSzP1OfKNM=; b=c1cSMVqWC0dXTI64PjN3M/sSh4SBc2X27TaHEPV3DfXeKTYc0WYw27VQh5/CpwGvwnUWaw vGCDOkFzTtXt1SVb8DiMsZuHIfiMPK0BMf/X46CsrGJ4S1JEkMDMX/AC6J5weownaPcz17 gg2DTdgMQpnrdrF2gdQFmH2CLgLFT/E= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-686-iCJRQtHZPda8w0ahRN18Uw-1; Wed, 18 Oct 2023 11:57:21 -0400 X-MC-Unique: iCJRQtHZPda8w0ahRN18Uw-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-40566c578b7so50252355e9.0 for ; Wed, 18 Oct 2023 08:57:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644640; x=1698249440; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=uLW4nacuIeTJ5EH0RbV4BQZpdBCvivCuyeSzP1OfKNM=; b=lCkCQ3Tn+Lf5iBIbnk4Tzz4dR6u3L4yqTvAdZKva6NvEGXONAppfGwSvNuZIjarS6N r0BZ8+oJ5pjLqLgIsXGWU8WPbdeetqKHBbyFiKaPmRcMJ1l3Y+1swMzO/qggUzDef+4x Ps+xFVlG/8/0byE/WjbdTWr1U6ediVzQx80/DbJURXCXStN30phKBqpjL11YiIv/ePxi RiMBYZd8OIwOpaJl9Rb7pEwPRYjj4TDdNY7QfcidezLh2zR8y6dpxcihW8vUCKVlR0OA 1IIyRlPU6wYgjR8I2ZydVPB/F0XseCdHjyH13eKjQ3io4C4/lbVQuVfCnQv6FeIBaZyn KO+A== X-Gm-Message-State: AOJu0Yxmxy4aE81NNK/H3ciBFJYeG33MpOIrBSNA4T4QjAq34YD3YgwN XKkQDrkVAPESCKIo0qeuLInzc3rWkEyzt34iLReeqy7gEeCv0TeBXXliuvH4yMOowc+YvlhX4sn 3w6UVSR/Mis0GcgQY8n9SIyEkRIkFyWgulCg4FkzB5N4/4uzcNMgIPEG0fqRm7UZDKc/G9+c= X-Received: by 2002:adf:f20e:0:b0:32d:a781:111 with SMTP id p14-20020adff20e000000b0032da7810111mr4872921wro.15.1697644639773; Wed, 18 Oct 2023 08:57:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGhF8nQF+ovBq1uagItTQQS/ECiw8zvrwiOCNT68g+hghMkMgwPeoQeBP5lhsAq21OWCNPzWQ== X-Received: by 2002:adf:f20e:0:b0:32d:a781:111 with SMTP id p14-20020adff20e000000b0032da7810111mr4872898wro.15.1697644639374; Wed, 18 Oct 2023 08:57:19 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id f12-20020adfb60c000000b00318147fd2d3sm2385909wre.41.2023.10.18.08.57.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:57:18 -0700 (PDT) Date: Wed, 18 Oct 2023 11:57:14 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 51/83] hw/isa/piix3: Wire PIC IRQs to ISA bus in host device Message-ID: <3cccc57a6adad904fe5e94e05326160965cfc4a6.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow Thie PIIX3 south bridge implements both the PIC and the ISA bus, so wiring the interrupts there makes the device model more self-contained. Furthermore, this allows the ISA interrupts to be wired to internal child devices in pci_piix3_realize() which will be performed in subsequent patches. Signed-off-by: Bernhard Beschow Message-Id: <20231007123843.127151-10-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/pc_piix.c | 2 +- hw/isa/piix3.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index cd6c00c0b3..5988656279 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -293,6 +293,7 @@ static void pc_init1(MachineState *machine, } else { isa_bus = isa_bus_new(NULL, system_memory, system_io, &error_abort); + isa_bus_register_input_irqs(isa_bus, x86ms->gsi); rtc_state = isa_new(TYPE_MC146818_RTC); qdev_prop_set_int32(DEVICE(rtc_state), "base_year", 2000); @@ -301,7 +302,6 @@ static void pc_init1(MachineState *machine, i8257_dma_init(isa_bus, 0); pcms->hpet_enabled = false; } - isa_bus_register_input_irqs(isa_bus, x86ms->gsi); if (x86ms->pic == ON_OFF_AUTO_ON || x86ms->pic == ON_OFF_AUTO_AUTO) { pc_i8259_create(isa_bus, gsi_state->i8259_irq); diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index 616f5418fa..3e7c42fa68 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -278,6 +278,8 @@ static void pci_piix3_realize(PCIDevice *dev, Error **errp) memory_region_add_subregion_overlap(pci_address_space_io(dev), PIIX_RCR_IOPORT, &d->rcr_mem, 1); + isa_bus_register_input_irqs(isa_bus, d->isa_irqs_in); + i8257_dma_init(isa_bus, 0); /* RTC */ From patchwork Wed Oct 18 15:57:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851097 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=N0LE5Cdx; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9cv543Z6z20cx for ; Thu, 19 Oct 2023 04:16:01 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8vX-0007P7-Ak; Wed, 18 Oct 2023 11:57:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vL-00062b-31 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vJ-0007JL-Bj for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644648; 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=fwUMxQ8ncCyAsWqYRxNdCC8jhYTNvx8/arhoeUue154=; b=N0LE5CdxthspnbsIds78wqKhvHBeX7ZfmYi/zuwhmaR6ygl/ihqqOA5upIvHJIKe1keNxc +KIfafHFo+XjdJVaj2zPp8ee0ngEQWlgrNyull7K2CAmmNMAQiNqc8DVWx+kjiiUwoWDNA 47mgbsZ5Pfwj37yV7HOQMf2vSbcpvc0= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-266-aTlagBoxNvuDmQifwPFhOw-1; Wed, 18 Oct 2023 11:57:25 -0400 X-MC-Unique: aTlagBoxNvuDmQifwPFhOw-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-406de77fb85so44710995e9.0 for ; Wed, 18 Oct 2023 08:57:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644643; x=1698249443; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fwUMxQ8ncCyAsWqYRxNdCC8jhYTNvx8/arhoeUue154=; b=NL0KMuUeFtXEg6caIeuibGpIUwG9ps5UtvtoB7pHvxvZHlAb/pVoyr2KeGHS/Jc8uX oDB4+z9KdmGcMe9lKGvVtT889haQ5yS9EW/hKXyvPaTuACbJdP+1yY/5CyiP1xnMTg8C +13PHGS6S9jkXi7tdfL13tH8fEJEqJlb2Zisq/3z0BrDddhZLdv2bx50lQB9SFEDnyso XBZyFR2r/PHAICgRbVSJf34nKIUkBC/Uy/g2gzIjpf+rMHex+f2FGqUL9p0rdqdpWbi9 cyM2dPLZ8wQC/E940WSF+353lXuzH2FKBdbUG3ji76J5gNqRD45rRngDZ5WMgUPXAHbj lE8Q== X-Gm-Message-State: AOJu0YzCa5EigZbGr+Mx0Vs8SiorSa+Jyiwv1xxsKlteZQ01Okia7yDT nYYE1sDA72WxcXRQ5EbG5AuVwaCh5fCtWBiUaIYzyTI55KhaUFyoK+WfkDJKm4IT/+IEusiW6Nk 7EhfT2XKf6nodPO5lrEWHwHjoCfr0KSZPDXm3OCVu8Ew77SkyZY7bvwim7tKEA5pHlOFjfxE= X-Received: by 2002:a05:600c:1393:b0:402:cc9a:31a7 with SMTP id u19-20020a05600c139300b00402cc9a31a7mr4575267wmf.19.1697644643504; Wed, 18 Oct 2023 08:57:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9rohLRA6JBGXgDJeX5oGo0An68aqWKUPuiA9NN78phgSbKQ3FZ6z97L2X6dTG3j8FTX0xnA== X-Received: by 2002:a05:600c:1393:b0:402:cc9a:31a7 with SMTP id u19-20020a05600c139300b00402cc9a31a7mr4575249wmf.19.1697644643162; Wed, 18 Oct 2023 08:57:23 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id j17-20020a05600c489100b0040776008abdsm1980675wmp.40.2023.10.18.08.57.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:57:22 -0700 (PDT) Date: Wed, 18 Oct 2023 11:57:19 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 52/83] hw/i386/pc: Wire RTC ISA IRQs in south bridges Message-ID: <899e94ffd8ecd3b399d466a31928f2eae790829b.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow Makes the south bridges a bit more self-contained and aligns PIIX3 more with PIIX4. The latter is needed for consolidating the PIIX south bridges. Signed-off-by: Bernhard Beschow Message-Id: <20231007123843.127151-11-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/pc.c | 7 ++----- hw/isa/lpc_ich9.c | 3 +++ hw/isa/piix3.c | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 7e6c4dc526..355e1b7cf6 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1244,12 +1244,9 @@ void pc_basic_device_init(struct PCMachineState *pcms, pit_isa_irq = -1; pit_alt_irq = qdev_get_gpio_in(hpet, HPET_LEGACY_PIT_INT); rtc_irq = qdev_get_gpio_in(hpet, HPET_LEGACY_RTC_INT); + + /* overwrite connection created by south bridge */ qdev_connect_gpio_out(DEVICE(rtc_state), 0, rtc_irq); - } else { - uint32_t irq = object_property_get_uint(OBJECT(rtc_state), - "irq", - &error_fatal); - isa_connect_gpio_out(rtc_state, 0, irq); } object_property_add_alias(OBJECT(pcms), "rtc-time", OBJECT(rtc_state), diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index 3fcefc5a8a..23eba64f22 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -696,6 +696,7 @@ static void ich9_lpc_realize(PCIDevice *d, Error **errp) ICH9LPCState *lpc = ICH9_LPC_DEVICE(d); PCIBus *pci_bus = pci_get_bus(d); ISABus *isa_bus; + uint32_t irq; if ((lpc->smi_host_features & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT)) && !(lpc->smi_host_features & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT))) { @@ -745,6 +746,8 @@ static void ich9_lpc_realize(PCIDevice *d, Error **errp) if (!qdev_realize(DEVICE(&lpc->rtc), BUS(isa_bus), errp)) { return; } + irq = object_property_get_uint(OBJECT(&lpc->rtc), "irq", &error_fatal); + isa_connect_gpio_out(ISA_DEVICE(&lpc->rtc), 0, irq); pci_bus_irqs(pci_bus, ich9_lpc_set_irq, d, ICH9_LPC_NB_PIRQS); pci_bus_map_irqs(pci_bus, ich9_lpc_map_irq); diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index 3e7c42fa68..11d72ca2bb 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -266,6 +266,7 @@ static void pci_piix3_realize(PCIDevice *dev, Error **errp) { PIIX3State *d = PIIX3_PCI_DEVICE(dev); ISABus *isa_bus; + uint32_t irq; isa_bus = isa_bus_new(DEVICE(d), pci_address_space(dev), pci_address_space_io(dev), errp); @@ -287,6 +288,8 @@ static void pci_piix3_realize(PCIDevice *dev, Error **errp) if (!qdev_realize(DEVICE(&d->rtc), BUS(isa_bus), errp)) { return; } + irq = object_property_get_uint(OBJECT(&d->rtc), "irq", &error_fatal); + isa_connect_gpio_out(ISA_DEVICE(&d->rtc), 0, irq); } static void build_pci_isa_aml(AcpiDevAmlIf *adev, Aml *scope) From patchwork Wed Oct 18 15:57:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851005 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VP3j2Ns1; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bF42XbJz20Zj for ; Thu, 19 Oct 2023 03:01:28 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8wS-0000uS-24; Wed, 18 Oct 2023 11:58:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vP-0006ho-Uz for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vN-0007K1-Vz for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644653; 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=wdW5p2c96Dn9Sqn4Mq3yZdrJbR8XrzKqICqhYWPrQfc=; b=VP3j2Ns1dvBc81Cy2NM0KVKHH7szJ3RYF8eZoF1HT2W1yV3G/zBb3hVRS9LTqnO3M/A778 PmmbskFFmyK/Tq2Gx86z8c/nGd4KuW6FK69Dc8jv6hG7rEvmrOGogMyJHWNAbQOBq2UaWg uaDboWS6fWzWNv1vttbHRo0yxA/4b+I= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-651-XvKCq_HzMQWkmTPHP8fzBg-1; Wed, 18 Oct 2023 11:57:31 -0400 X-MC-Unique: XvKCq_HzMQWkmTPHP8fzBg-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-32db6a28e24so1980122f8f.0 for ; Wed, 18 Oct 2023 08:57:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644649; x=1698249449; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=wdW5p2c96Dn9Sqn4Mq3yZdrJbR8XrzKqICqhYWPrQfc=; b=BKnzaClnJll/BpM7Ce7gyFexbY1S+uXQrf2ByxdAFvKaXmTdYcaCZyhq1qHaVGV8Zt dNTzTxuZ+FUfWjRv0J1Kpi51YzygRhNheP/P0rzi+PAY0FkTMCPYxaEbgArj6nEH1qrL fj41jcKNK6TZl94AYzZtz+MZsjvoKkMt9wAlHBr54UzxUfW9Sz7NNh+t30q/i2rZNXse 8PYl5k7NRfz2/VIuzHCU4Zr5oT9ptamODr+o16W/JYUAvZDBKSeG+K9GWt0wa+oZGWNy RxwZXdI3uUfOWyyRQNdBmRLdinQDgKb5C7GMKUoBvPLwI3udRE3Q9uF1l94/BaNOhaou kkTQ== X-Gm-Message-State: AOJu0YyVDW7ce6j/cPxgReY5ghhNdCz+Vu7/OEe2iOVt/AIXVskSA+KK KXXX9FaYoqQzdsAKRHrVBPjhsTgOmmR21AJIum+7GOYCHutaujbgtkkh762GXGg9JE4YE1IkSHq 4xUqSwwPF14hkdPTy5Xr6pIzyEMhE3PyATZOK6NAhiRiuhc2YSVEyepvGI4T/QCk5E/abtZ8= X-Received: by 2002:a5d:470f:0:b0:32d:888a:c2cf with SMTP id y15-20020a5d470f000000b0032d888ac2cfmr4088418wrq.7.1697644648960; Wed, 18 Oct 2023 08:57:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGDvCZXuWhxewbG5kW/FjX6vfgy+wozFSFLc+mHqWHJLHpBLMKluHvUkP4qJ1MoptiwcDD5fQ== X-Received: by 2002:a5d:470f:0:b0:32d:888a:c2cf with SMTP id y15-20020a5d470f000000b0032d888ac2cfmr4088402wrq.7.1697644648608; Wed, 18 Oct 2023 08:57:28 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id w8-20020a5d6808000000b0031779a6b451sm2365060wru.83.2023.10.18.08.57.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:57:28 -0700 (PDT) Date: Wed, 18 Oct 2023 11:57:23 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Paolo Bonzini , Marcel Apfelbaum , Richard Henderson , Eduardo Habkost , =?utf-8?b?SGVydsOp?= Poussineau , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Aurelien Jarno Subject: [PULL 53/83] hw/isa/piix3: Create IDE controller in host device Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow The IDE controller is an integral part of PIIX3 (function 1). So create it as part of the south bridge. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin Message-Id: <20231007123843.127151-12-shentey@gmail.com> Signed-off-by: Michael S. Tsirkin --- include/hw/southbridge/piix.h | 2 ++ hw/i386/pc_piix.c | 13 ++++++------- hw/isa/piix3.c | 9 +++++++++ hw/i386/Kconfig | 1 - hw/isa/Kconfig | 1 + 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index b07ff6bb26..1daeff397c 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -13,6 +13,7 @@ #define HW_SOUTHBRIDGE_PIIX_H #include "hw/pci/pci_device.h" +#include "hw/ide/pci.h" #include "hw/rtc/mc146818rtc.h" /* PIRQRC[A:D]: PIRQx Route Control Registers */ @@ -52,6 +53,7 @@ struct PIIXState { int32_t pci_irq_levels_vmstate[PIIX_NUM_PIRQS]; MC146818RtcState rtc; + PCIIDEState ide; /* Reset Control Register contents */ uint8_t rcr; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 5988656279..c98a997482 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -43,7 +43,6 @@ #include "net/net.h" #include "hw/ide/isa.h" #include "hw/ide/pci.h" -#include "hw/ide/piix.h" #include "hw/irq.h" #include "sysemu/kvm.h" #include "hw/i386/kvm/clock.h" @@ -290,6 +289,10 @@ static void pc_init1(MachineState *machine, isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(pci_dev), "isa.0")); rtc_state = ISA_DEVICE(object_resolve_path_component(OBJECT(pci_dev), "rtc")); + dev = DEVICE(object_resolve_path_component(OBJECT(pci_dev), "ide")); + pci_ide_create_devs(PCI_DEVICE(dev)); + idebus[0] = qdev_get_child_bus(dev, "ide.0"); + idebus[1] = qdev_get_child_bus(dev, "ide.1"); } else { isa_bus = isa_bus_new(NULL, system_memory, system_io, &error_abort); @@ -301,6 +304,8 @@ static void pc_init1(MachineState *machine, i8257_dma_init(isa_bus, 0); pcms->hpet_enabled = false; + idebus[0] = NULL; + idebus[1] = NULL; } if (x86ms->pic == ON_OFF_AUTO_ON || x86ms->pic == ON_OFF_AUTO_AUTO) { @@ -329,12 +334,6 @@ static void pc_init1(MachineState *machine, pc_nic_init(pcmc, isa_bus, pci_bus); if (pcmc->pci_enabled) { - PCIDevice *dev; - - dev = pci_create_simple(pci_bus, piix3_devfn + 1, TYPE_PIIX3_IDE); - pci_ide_create_devs(dev); - idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0"); - idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1"); pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state); } #ifdef CONFIG_IDE_ISA diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index 11d72ca2bb..3f1dabade0 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -29,6 +29,7 @@ #include "hw/southbridge/piix.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/ide/piix.h" #include "hw/isa/isa.h" #include "sysemu/runstate.h" #include "migration/vmstate.h" @@ -265,6 +266,7 @@ static const MemoryRegionOps rcr_ops = { static void pci_piix3_realize(PCIDevice *dev, Error **errp) { PIIX3State *d = PIIX3_PCI_DEVICE(dev); + PCIBus *pci_bus = pci_get_bus(dev); ISABus *isa_bus; uint32_t irq; @@ -290,6 +292,12 @@ static void pci_piix3_realize(PCIDevice *dev, Error **errp) } irq = object_property_get_uint(OBJECT(&d->rtc), "irq", &error_fatal); isa_connect_gpio_out(ISA_DEVICE(&d->rtc), 0, irq); + + /* IDE */ + qdev_prop_set_int32(DEVICE(&d->ide), "addr", dev->devfn + 1); + if (!qdev_realize(DEVICE(&d->ide), BUS(pci_bus), errp)) { + return; + } } static void build_pci_isa_aml(AcpiDevAmlIf *adev, Aml *scope) @@ -321,6 +329,7 @@ static void pci_piix3_init(Object *obj) ISA_NUM_IRQS); object_initialize_child(obj, "rtc", &d->rtc, TYPE_MC146818_RTC); + object_initialize_child(obj, "ide", &d->ide, TYPE_PIIX3_IDE); } static void pci_piix3_class_init(ObjectClass *klass, void *data) diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig index 9051083c1e..ade817f1b6 100644 --- a/hw/i386/Kconfig +++ b/hw/i386/Kconfig @@ -73,7 +73,6 @@ config I440FX select PC_ACPI select PCI_I440FX select PIIX3 - select IDE_PIIX select DIMM select SMBIOS select FW_CFG_DMA diff --git a/hw/isa/Kconfig b/hw/isa/Kconfig index c10cbc5fc1..28345edbb3 100644 --- a/hw/isa/Kconfig +++ b/hw/isa/Kconfig @@ -34,6 +34,7 @@ config PC87312 config PIIX3 bool select I8257 + select IDE_PIIX select ISA_BUS select MC146818RTC From patchwork Wed Oct 18 15:57:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851098 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=M4yNgL2V; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9cwQ3wvBz20cx for ; Thu, 19 Oct 2023 04:17:10 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8wX-00010W-TB; Wed, 18 Oct 2023 11:58:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vZ-0007lk-Fw for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vX-0007LG-20 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644661; 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=NXZETaxS2RqyHqeZK3eUSLD+xTQl4eJ2LtfwIT3r2X0=; b=M4yNgL2VUbsndl3p2MfjAddbOmyhbc1UHBsubgAsK1stgyKt68hRvla8dgrMMaVO/CV84U ZOeneTXwgvF+OVCyCuvzh9n3mKhJoQirIjp8N+nqHNy0yKrslyP7H1pgZfuvRmtM25OfQa l6S5lTIU0dmc18pC8A7b53xKbWTUZj8= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-70-G7g8suwWPfmJhu9CMMy05w-1; Wed, 18 Oct 2023 11:57:35 -0400 X-MC-Unique: G7g8suwWPfmJhu9CMMy05w-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-32cbe54ee03so4138603f8f.1 for ; Wed, 18 Oct 2023 08:57:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644653; x=1698249453; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=NXZETaxS2RqyHqeZK3eUSLD+xTQl4eJ2LtfwIT3r2X0=; b=uoxfrneY1Iks+c9oRDNBJwwtGBtqxCuUpOyvvgFmpUNIbqv0lFTdV0Y2sxQb3nVjjD Y8MDPVGC092PiDVvEmN5eo6yIO+EsOE2FsihZhfC2OxtXNdMJLT1gfgfbnEOaW2Gmapq NTMn31/q5B7ThgtwjeB6wasQMIXBY0vjgsBnnhsGavVyiR2JVUEx81JLlSRzMftgKAN/ r2enbcGLXHNVtfxQi1G7DpaSw5vB8VOGfEweUu9RWDnaf0jEVkvQ3o6z0TB/rMIQKish /DyTj1fRV9GG4ciS2ltDHCoCnkNGYgifmYzrbKICoEJageYCEgKm+8IbrOT+FHmbxQYS HMAg== X-Gm-Message-State: AOJu0YxCVjkmgk5EYI4ysjxFkA5DUWFXBs3qOTiAW/LmgC/MalFHZGm5 EKK+nFFPrYOr1hvfDPUOhX0HxB13sfDIH/qSqITL7VXxp7t46jJzZfijuxr+axXPLUsHruGUdkG YFzirMIFY2bp7hILtzxXQMcicd7nZqXmrGzkFNRdCn5vBoOViL62t1xp9+IRm/sNbaYMAqjQ= X-Received: by 2002:a5d:490b:0:b0:32d:ae31:458f with SMTP id x11-20020a5d490b000000b0032dae31458fmr4423380wrq.30.1697644653449; Wed, 18 Oct 2023 08:57:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEdG3HREpZJ9H3ywi/AFPe0m0pBl79Wa5vrkvXCUvHHirNFuC0J3vyJZ7ebXEBLRkQVGwZE1w== X-Received: by 2002:a5d:490b:0:b0:32d:ae31:458f with SMTP id x11-20020a5d490b000000b0032dae31458fmr4423359wrq.30.1697644653073; Wed, 18 Oct 2023 08:57:33 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id q1-20020adffec1000000b00326b8a0e817sm2390420wrs.84.2023.10.18.08.57.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:57:32 -0700 (PDT) Date: Wed, 18 Oct 2023 11:57:28 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?b?SGVydsOp?= Poussineau , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Aurelien Jarno Subject: [PULL 54/83] hw/isa/piix3: Create USB controller in host device Message-ID: <3dc892613e32f09b6830fcbe3a3247e9cec88aaf.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow The USB controller is an integral part of PIIX3 (function 2). So create it as part of the south bridge. Note that the USB function is optional in QEMU. This is why it gets object_initialize_child()'ed in realize rather than in instance_init. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin Message-Id: <20231007123843.127151-13-shentey@gmail.com> Signed-off-by: Michael S. Tsirkin --- include/hw/southbridge/piix.h | 4 ++++ hw/i386/pc_piix.c | 7 ++----- hw/isa/piix3.c | 16 ++++++++++++++++ hw/isa/Kconfig | 1 + 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index 1daeff397c..5cd866f1f2 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -15,6 +15,7 @@ #include "hw/pci/pci_device.h" #include "hw/ide/pci.h" #include "hw/rtc/mc146818rtc.h" +#include "hw/usb/hcd-uhci.h" /* PIRQRC[A:D]: PIRQx Route Control Registers */ #define PIIX_PIRQCA 0x60 @@ -54,12 +55,15 @@ struct PIIXState { MC146818RtcState rtc; PCIIDEState ide; + UHCIState uhci; /* Reset Control Register contents */ uint8_t rcr; /* IO memory region for Reset Control Register (PIIX_RCR_IOPORT) */ MemoryRegion rcr_mem; + + bool has_usb; }; typedef struct PIIXState PIIX3State; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index c98a997482..8dcd6851d0 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -51,7 +51,6 @@ #include "exec/memory.h" #include "hw/acpi/acpi.h" #include "hw/acpi/piix4.h" -#include "hw/usb/hcd-uhci.h" #include "qapi/error.h" #include "qemu/error-report.h" #include "sysemu/xen.h" @@ -265,6 +264,8 @@ static void pc_init1(MachineState *machine, size_t i; pci_dev = pci_new_multifunction(-1, TYPE_PIIX3_DEVICE); + object_property_set_bool(OBJECT(pci_dev), "has-usb", + machine_usb(machine), &error_abort); dev = DEVICE(pci_dev); for (i = 0; i < ISA_NUM_IRQS; i++) { qdev_connect_gpio_out_named(dev, "isa-irqs", i, x86ms->gsi[i]); @@ -359,10 +360,6 @@ static void pc_init1(MachineState *machine, } #endif - if (pcmc->pci_enabled && machine_usb(machine)) { - pci_create_simple(pci_bus, piix3_devfn + 2, TYPE_PIIX3_USB_UHCI); - } - if (pcmc->pci_enabled && x86_machine_is_acpi_enabled(X86_MACHINE(pcms))) { PCIDevice *piix4_pm; diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index 3f1dabade0..aebc0da23b 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -298,6 +298,16 @@ static void pci_piix3_realize(PCIDevice *dev, Error **errp) if (!qdev_realize(DEVICE(&d->ide), BUS(pci_bus), errp)) { return; } + + /* USB */ + if (d->has_usb) { + object_initialize_child(OBJECT(dev), "uhci", &d->uhci, + TYPE_PIIX3_USB_UHCI); + qdev_prop_set_int32(DEVICE(&d->uhci), "addr", dev->devfn + 2); + if (!qdev_realize(DEVICE(&d->uhci), BUS(pci_bus), errp)) { + return; + } + } } static void build_pci_isa_aml(AcpiDevAmlIf *adev, Aml *scope) @@ -332,6 +342,11 @@ static void pci_piix3_init(Object *obj) object_initialize_child(obj, "ide", &d->ide, TYPE_PIIX3_IDE); } +static Property pci_piix3_props[] = { + DEFINE_PROP_BOOL("has-usb", PIIX3State, has_usb, true), + DEFINE_PROP_END_OF_LIST(), +}; + static void pci_piix3_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); @@ -352,6 +367,7 @@ static void pci_piix3_class_init(ObjectClass *klass, void *data) * pc_piix.c's pc_init1() */ dc->user_creatable = false; + device_class_set_props(dc, pci_piix3_props); adevc->build_dev_aml = build_pci_isa_aml; } diff --git a/hw/isa/Kconfig b/hw/isa/Kconfig index 28345edbb3..1076df69ca 100644 --- a/hw/isa/Kconfig +++ b/hw/isa/Kconfig @@ -37,6 +37,7 @@ config PIIX3 select IDE_PIIX select ISA_BUS select MC146818RTC + select USB_UHCI config PIIX4 bool From patchwork Wed Oct 18 15:57:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851093 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=aJMd5Hyz; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9cqK4ZPtz20Zj for ; Thu, 19 Oct 2023 04:12:45 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8wh-0001EF-9m; Wed, 18 Oct 2023 11:58:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vZ-0007ln-Gz for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vX-0007LK-FA for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644661; 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=pZy/qcc3rYAioh5DSCyMc5Ebvruw/qgaRKdAdK5HreA=; b=aJMd5HyzTs6V5GwvEyRaSyN7RONzHB5ZkrRmCItLNpoOMKuHFWLiCphKtbbIMwfqqUUOvL IKFCKHmo/+gyomP9q678E7Mt09L7cBmCuLtspxBFELt8rxBkRkuYsckPCURgebc64I/wtW 48C/2TX9GYC8mKqHshUkoUmp7wUz/84= Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-100-LqHjrpmbMwSmKAMkfyPYzg-1; Wed, 18 Oct 2023 11:57:40 -0400 X-MC-Unique: LqHjrpmbMwSmKAMkfyPYzg-1 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2c50ef18b04so46478521fa.1 for ; Wed, 18 Oct 2023 08:57:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644658; x=1698249458; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=pZy/qcc3rYAioh5DSCyMc5Ebvruw/qgaRKdAdK5HreA=; b=qxNge0wQdS0sTq/xew3S5NTotW2had9+e1hzFVdJpQFaIPhWVzJlJiLi9acM8kEFKe HjLkKbHBa3X6isBWSDtCSW6pdMdlNoE4Jw686RiKk8dxa8VmI6kFc+jK/5EyIE8fj/L8 rOfZh4d0RoDY+/uHZXMGrFA+NfwqPPrfo2qJQPgxrlJc7FtFswmCa3Dh8PI1SiBtK17S Y5PNP9oSeBwl6+ljGPHyin+4COD2m/kAtSGZlkz7qJWf9fUDa/XuFeMfIBXTq0nyrkqj f+LUMKA3z5SN6+Iff9ekOVIYtf6rEU2jBvHLmR26V6aGRLVfGrkX3QCdwtG4MiKGVi/q EuoQ== X-Gm-Message-State: AOJu0YxgIuYrI3nxahP8GnMeYkVkrLhiJY6tTHkTJwoW1npsJaPxaNp7 jptP09Nhn7eElsozjndnnh7s9u0JLdxdL/btb8QElh7cjT94hn7SAhjwR7GhT3Ab+H+XsruD90B DERNl1ei52ReIzXPTXGWl4eKsYpnV+yE7VLMkfF2hGvPwbCsaa5nYLFs/7SeHjh1o5xJYmGE= X-Received: by 2002:a2e:be03:0:b0:2c4:feef:84d with SMTP id z3-20020a2ebe03000000b002c4feef084dmr4980152ljq.43.1697644658289; Wed, 18 Oct 2023 08:57:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHxCdtpQC5PMLzMdlcPAw3qlA4h4A2ZWW41ReJi6lnaipPeFRvPL1AKjSf/6b5IaJFXXYPtCQ== X-Received: by 2002:a2e:be03:0:b0:2c4:feef:84d with SMTP id z3-20020a2ebe03000000b002c4feef084dmr4980128ljq.43.1697644657996; Wed, 18 Oct 2023 08:57:37 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id k3-20020a5d4283000000b003232f167df5sm2379130wrq.108.2023.10.18.08.57.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:57:37 -0700 (PDT) Date: Wed, 18 Oct 2023 11:57:33 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum , Philippe =?utf-8?q?Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Aurelien Jarno , =?utf-8?b?SGVydsOp?= Poussineau Subject: [PULL 55/83] hw/isa/piix3: Create power management controller in host device Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow The power management controller is an integral part of PIIX3 (function 3). So create it as part of the south bridge. Note that the ACPI function is optional in QEMU. This is why it gets object_initialize_child()'ed in realize rather than in instance_init. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin Message-Id: <20231007123843.127151-14-shentey@gmail.com> Signed-off-by: Michael S. Tsirkin --- include/hw/southbridge/piix.h | 6 ++++++ hw/i386/pc_piix.c | 24 +++++++++++------------- hw/isa/piix3.c | 15 +++++++++++++++ hw/isa/Kconfig | 1 + 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index 5cd866f1f2..c56ce49fd3 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -13,6 +13,7 @@ #define HW_SOUTHBRIDGE_PIIX_H #include "hw/pci/pci_device.h" +#include "hw/acpi/piix4.h" #include "hw/ide/pci.h" #include "hw/rtc/mc146818rtc.h" #include "hw/usb/hcd-uhci.h" @@ -56,6 +57,9 @@ struct PIIXState { MC146818RtcState rtc; PCIIDEState ide; UHCIState uhci; + PIIX4PMState pm; + + uint32_t smb_io_base; /* Reset Control Register contents */ uint8_t rcr; @@ -63,7 +67,9 @@ struct PIIXState { /* IO memory region for Reset Control Register (PIIX_RCR_IOPORT) */ MemoryRegion rcr_mem; + bool has_acpi; bool has_usb; + bool smm_enabled; }; typedef struct PIIXState PIIX3State; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 8dcd6851d0..70cffcfe4f 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -50,7 +50,6 @@ #include "hw/i2c/smbus_eeprom.h" #include "exec/memory.h" #include "hw/acpi/acpi.h" -#include "hw/acpi/piix4.h" #include "qapi/error.h" #include "qemu/error-report.h" #include "sysemu/xen.h" @@ -115,7 +114,7 @@ static void pc_init1(MachineState *machine, MemoryRegion *system_io = get_system_io(); PCIBus *pci_bus = NULL; ISABus *isa_bus; - int piix3_devfn = -1; + Object *piix4_pm = NULL; qemu_irq smi_irq; GSIState *gsi_state; BusState *idebus[MAX_IDE_BUS]; @@ -266,6 +265,13 @@ static void pc_init1(MachineState *machine, pci_dev = pci_new_multifunction(-1, TYPE_PIIX3_DEVICE); object_property_set_bool(OBJECT(pci_dev), "has-usb", machine_usb(machine), &error_abort); + object_property_set_bool(OBJECT(pci_dev), "has-acpi", + x86_machine_is_acpi_enabled(x86ms), + &error_abort); + qdev_prop_set_uint32(DEVICE(pci_dev), "smb_io_base", 0xb100); + object_property_set_bool(OBJECT(pci_dev), "smm-enabled", + x86_machine_is_smm_enabled(x86ms), + &error_abort); dev = DEVICE(pci_dev); for (i = 0; i < ISA_NUM_IRQS; i++) { qdev_connect_gpio_out_named(dev, "isa-irqs", i, x86ms->gsi[i]); @@ -286,10 +292,10 @@ static void pc_init1(MachineState *machine, XEN_IOAPIC_NUM_PIRQS); } - piix3_devfn = pci_dev->devfn; isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(pci_dev), "isa.0")); rtc_state = ISA_DEVICE(object_resolve_path_component(OBJECT(pci_dev), "rtc")); + piix4_pm = object_resolve_path_component(OBJECT(pci_dev), "pm"); dev = DEVICE(object_resolve_path_component(OBJECT(pci_dev), "ide")); pci_ide_create_devs(PCI_DEVICE(dev)); idebus[0] = qdev_get_child_bus(dev, "ide.0"); @@ -360,17 +366,9 @@ static void pc_init1(MachineState *machine, } #endif - if (pcmc->pci_enabled && x86_machine_is_acpi_enabled(X86_MACHINE(pcms))) { - PCIDevice *piix4_pm; - + if (piix4_pm) { smi_irq = qemu_allocate_irq(pc_acpi_smi_interrupt, first_cpu, 0); - piix4_pm = pci_new(piix3_devfn + 3, TYPE_PIIX4_PM); - qdev_prop_set_uint32(DEVICE(piix4_pm), "smb_io_base", 0xb100); - qdev_prop_set_bit(DEVICE(piix4_pm), "smm-enabled", - x86_machine_is_smm_enabled(x86ms)); - pci_realize_and_unref(piix4_pm, pci_bus, &error_fatal); - qdev_connect_gpio_out(DEVICE(piix4_pm), 0, x86ms->gsi[9]); qdev_connect_gpio_out_named(DEVICE(piix4_pm), "smi-irq", 0, smi_irq); pcms->smbus = I2C_BUS(qdev_get_child_bus(DEVICE(piix4_pm), "i2c")); /* TODO: Populate SPD eeprom data. */ @@ -382,7 +380,7 @@ static void pc_init1(MachineState *machine, object_property_allow_set_link, OBJ_PROP_LINK_STRONG); object_property_set_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP, - OBJECT(piix4_pm), &error_abort); + piix4_pm, &error_abort); } if (machine->nvdimms_state->is_enabled) { diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index aebc0da23b..5b867df299 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -308,6 +308,18 @@ static void pci_piix3_realize(PCIDevice *dev, Error **errp) return; } } + + /* Power Management */ + if (d->has_acpi) { + object_initialize_child(OBJECT(d), "pm", &d->pm, TYPE_PIIX4_PM); + qdev_prop_set_int32(DEVICE(&d->pm), "addr", dev->devfn + 3); + qdev_prop_set_uint32(DEVICE(&d->pm), "smb_io_base", d->smb_io_base); + qdev_prop_set_bit(DEVICE(&d->pm), "smm-enabled", d->smm_enabled); + if (!qdev_realize(DEVICE(&d->pm), BUS(pci_bus), errp)) { + return; + } + qdev_connect_gpio_out(DEVICE(&d->pm), 0, d->isa_irqs_in[9]); + } } static void build_pci_isa_aml(AcpiDevAmlIf *adev, Aml *scope) @@ -343,7 +355,10 @@ static void pci_piix3_init(Object *obj) } static Property pci_piix3_props[] = { + DEFINE_PROP_UINT32("smb_io_base", PIIX3State, smb_io_base, 0), + DEFINE_PROP_BOOL("has-acpi", PIIX3State, has_acpi, true), DEFINE_PROP_BOOL("has-usb", PIIX3State, has_usb, true), + DEFINE_PROP_BOOL("smm-enabled", PIIX3State, smm_enabled, false), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/isa/Kconfig b/hw/isa/Kconfig index 1076df69ca..17ddb25afc 100644 --- a/hw/isa/Kconfig +++ b/hw/isa/Kconfig @@ -33,6 +33,7 @@ config PC87312 config PIIX3 bool + select ACPI_PIIX4 select I8257 select IDE_PIIX select ISA_BUS From patchwork Wed Oct 18 15:57:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851029 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HbciJyF5; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bkL2xfhz20Pd for ; Thu, 19 Oct 2023 03:23:22 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8x3-0001dP-V6; Wed, 18 Oct 2023 11:59:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vc-0007wL-KW for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8va-0007LZ-Kx for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644665; 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=8ZNVaGsAOPPhl+5mNLWULAc38++TrKNMAMlYSymFqYg=; b=HbciJyF5DpyFi4bZfav1J7I7Z7RkgmRfrLf5jjjkQirHcwUvDMahLzcFF9Y5AW+7UtRAbh viULdaKF2tRjfZo7CyF3yLx/tKSKZQPWXcRt32NPRAFwaF/Xx3z8vzMJiMmPXHv6QyMNAl FpyDdSne0mb1ggKydPt3vSCAKMr2nn8= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-615-q2GpbHASPo2Pae6zAKeK_w-1; Wed, 18 Oct 2023 11:57:44 -0400 X-MC-Unique: q2GpbHASPo2Pae6zAKeK_w-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-406de77fb85so44713575e9.0 for ; Wed, 18 Oct 2023 08:57:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644662; x=1698249462; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=8ZNVaGsAOPPhl+5mNLWULAc38++TrKNMAMlYSymFqYg=; b=PP7FU7ej8giAtsz1bzM2DjJ9MJoBGNUpPN4yIGUIgWQ0F7hWceHBvM4KFyqH9H8Zw3 uxRAqHiFy4rFG/odGtIb/4ZaBq1pDN40cBvsB+NYIR3auIMDsMuW7UYhU166Kg9YMtaH 1nkXQeIlwQ1im9mE1Qv5I7XVL4bNJEPUHWzhjivd6hPDLtMy+LFrdm1IiWVsLDJzhBwi KaBQ5z4RP93/l7SUOUgF0YRN5tjbmGmfFwYXSffCUWCe/ur1gVDbVGZDScHTfvLOuYkF x9wSUW5lNsKLIhREphCyxbZ9Zui1bd/Mks73uJLum4pVe/c2bwB85OOIosJBLYJMxja9 ctFw== X-Gm-Message-State: AOJu0YxHgoDeel2LMqrnk6aMt5dlbqman2LSF2AGM9ArHb9PS8X4QzbI 48GAZflf9WHF8Yca3092uF3kgn+vjN5eSO2lePC41SR11dtDCO29SLX8qq5KZM0YYszh3FDblBn QI0FLyf1DW5F3kG5X/r26e0oHFvKIsw9+yIX9GVi4u/ZS0d8xLReKkz4xypWlsIWpN0EOTL8= X-Received: by 2002:a05:600c:350a:b0:405:a30:151e with SMTP id h10-20020a05600c350a00b004050a30151emr4539337wmq.12.1697644662607; Wed, 18 Oct 2023 08:57:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG65TajzvKOZYETI1pDCfdgg6FB54W0dVrYwhN087VAICwo4y6JRBDODj1Iyag4L7qujr1PIw== X-Received: by 2002:a05:600c:350a:b0:405:a30:151e with SMTP id h10-20020a05600c350a00b004050a30151emr4539317wmq.12.1697644662211; Wed, 18 Oct 2023 08:57:42 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id c16-20020a05600c0ad000b003fee567235bsm1998934wmr.1.2023.10.18.08.57.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:57:41 -0700 (PDT) Date: Wed, 18 Oct 2023 11:57:38 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Aurelien Jarno , Marcel Apfelbaum , =?utf-8?b?SGVydsOp?= Poussineau Subject: [PULL 56/83] hw/isa/piix3: Drop the "3" from PIIX base class name Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow TYPE_PIIX3_PCI_DEVICE was the former base class of the Xen and non-Xen variants of the PIIX3 ISA device models. It will become the base class for the PIIX3 and PIIX4 device models, so drop the "3" from the type names. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin Message-Id: <20231007123843.127151-15-shentey@gmail.com> Signed-off-by: Michael S. Tsirkin --- include/hw/southbridge/piix.h | 6 ++-- hw/isa/piix3.c | 56 +++++++++++++++++------------------ 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index c56ce49fd3..0b257e1582 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -71,11 +71,9 @@ struct PIIXState { bool has_usb; bool smm_enabled; }; -typedef struct PIIXState PIIX3State; -#define TYPE_PIIX3_PCI_DEVICE "pci-piix3" -DECLARE_INSTANCE_CHECKER(PIIX3State, PIIX3_PCI_DEVICE, - TYPE_PIIX3_PCI_DEVICE) +#define TYPE_PIIX_PCI_DEVICE "pci-piix" +OBJECT_DECLARE_SIMPLE_TYPE(PIIXState, PIIX_PCI_DEVICE) #define TYPE_PIIX3_DEVICE "PIIX3" #define TYPE_PIIX4_PCI_DEVICE "piix4-isa" diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index 5b867df299..c7e59249b6 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -35,7 +35,7 @@ #include "migration/vmstate.h" #include "hw/acpi/acpi_aml_interface.h" -static void piix3_set_irq_pic(PIIX3State *piix3, int pic_irq) +static void piix3_set_irq_pic(PIIXState *piix3, int pic_irq) { qemu_set_irq(piix3->isa_irqs_in[pic_irq], !!(piix3->pic_levels & @@ -43,7 +43,7 @@ static void piix3_set_irq_pic(PIIX3State *piix3, int pic_irq) (pic_irq * PIIX_NUM_PIRQS)))); } -static void piix3_set_irq_level_internal(PIIX3State *piix3, int pirq, int level) +static void piix3_set_irq_level_internal(PIIXState *piix3, int pirq, int level) { int pic_irq; uint64_t mask; @@ -58,7 +58,7 @@ static void piix3_set_irq_level_internal(PIIX3State *piix3, int pirq, int level) piix3->pic_levels |= mask * !!level; } -static void piix3_set_irq_level(PIIX3State *piix3, int pirq, int level) +static void piix3_set_irq_level(PIIXState *piix3, int pirq, int level) { int pic_irq; @@ -74,13 +74,13 @@ static void piix3_set_irq_level(PIIX3State *piix3, int pirq, int level) static void piix3_set_irq(void *opaque, int pirq, int level) { - PIIX3State *piix3 = opaque; + PIIXState *piix3 = opaque; piix3_set_irq_level(piix3, pirq, level); } static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opaque, int pin) { - PIIX3State *piix3 = opaque; + PIIXState *piix3 = opaque; int irq = piix3->dev.config[PIIX_PIRQCA + pin]; PCIINTxRoute route; @@ -95,7 +95,7 @@ static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opaque, int pin) } /* irq routing is changed. so rebuild bitmap */ -static void piix3_update_irq_levels(PIIX3State *piix3) +static void piix3_update_irq_levels(PIIXState *piix3) { PCIBus *bus = pci_get_bus(&piix3->dev); int pirq; @@ -111,7 +111,7 @@ static void piix3_write_config(PCIDevice *dev, { pci_default_write_config(dev, address, val, len); if (ranges_overlap(address, len, PIIX_PIRQCA, 4)) { - PIIX3State *piix3 = PIIX3_PCI_DEVICE(dev); + PIIXState *piix3 = PIIX_PCI_DEVICE(dev); int pic_irq; pci_bus_fire_intx_routing_notifier(pci_get_bus(&piix3->dev)); @@ -124,7 +124,7 @@ static void piix3_write_config(PCIDevice *dev, static void piix3_reset(DeviceState *dev) { - PIIX3State *d = PIIX3_PCI_DEVICE(dev); + PIIXState *d = PIIX_PCI_DEVICE(dev); uint8_t *pci_conf = d->dev.config; pci_conf[0x04] = 0x07; /* master, memory and I/O */ @@ -165,7 +165,7 @@ static void piix3_reset(DeviceState *dev) static int piix3_post_load(void *opaque, int version_id) { - PIIX3State *piix3 = opaque; + PIIXState *piix3 = opaque; int pirq; /* @@ -188,7 +188,7 @@ static int piix3_post_load(void *opaque, int version_id) static int piix3_pre_save(void *opaque) { int i; - PIIX3State *piix3 = opaque; + PIIXState *piix3 = opaque; for (i = 0; i < ARRAY_SIZE(piix3->pci_irq_levels_vmstate); i++) { piix3->pci_irq_levels_vmstate[i] = @@ -200,7 +200,7 @@ static int piix3_pre_save(void *opaque) static bool piix3_rcr_needed(void *opaque) { - PIIX3State *piix3 = opaque; + PIIXState *piix3 = opaque; return (piix3->rcr != 0); } @@ -211,7 +211,7 @@ static const VMStateDescription vmstate_piix3_rcr = { .minimum_version_id = 1, .needed = piix3_rcr_needed, .fields = (VMStateField[]) { - VMSTATE_UINT8(rcr, PIIX3State), + VMSTATE_UINT8(rcr, PIIXState), VMSTATE_END_OF_LIST() } }; @@ -223,8 +223,8 @@ static const VMStateDescription vmstate_piix3 = { .post_load = piix3_post_load, .pre_save = piix3_pre_save, .fields = (VMStateField[]) { - VMSTATE_PCI_DEVICE(dev, PIIX3State), - VMSTATE_INT32_ARRAY_V(pci_irq_levels_vmstate, PIIX3State, + VMSTATE_PCI_DEVICE(dev, PIIXState), + VMSTATE_INT32_ARRAY_V(pci_irq_levels_vmstate, PIIXState, PIIX_NUM_PIRQS, 3), VMSTATE_END_OF_LIST() }, @@ -237,7 +237,7 @@ static const VMStateDescription vmstate_piix3 = { static void rcr_write(void *opaque, hwaddr addr, uint64_t val, unsigned len) { - PIIX3State *d = opaque; + PIIXState *d = opaque; if (val & 4) { qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); @@ -248,7 +248,7 @@ static void rcr_write(void *opaque, hwaddr addr, uint64_t val, unsigned len) static uint64_t rcr_read(void *opaque, hwaddr addr, unsigned len) { - PIIX3State *d = opaque; + PIIXState *d = opaque; return d->rcr; } @@ -265,7 +265,7 @@ static const MemoryRegionOps rcr_ops = { static void pci_piix3_realize(PCIDevice *dev, Error **errp) { - PIIX3State *d = PIIX3_PCI_DEVICE(dev); + PIIXState *d = PIIX_PCI_DEVICE(dev); PCIBus *pci_bus = pci_get_bus(dev); ISABus *isa_bus; uint32_t irq; @@ -345,7 +345,7 @@ static void build_pci_isa_aml(AcpiDevAmlIf *adev, Aml *scope) static void pci_piix3_init(Object *obj) { - PIIX3State *d = PIIX3_PCI_DEVICE(obj); + PIIXState *d = PIIX_PCI_DEVICE(obj); qdev_init_gpio_out_named(DEVICE(obj), d->isa_irqs_in, "isa-irqs", ISA_NUM_IRQS); @@ -355,10 +355,10 @@ static void pci_piix3_init(Object *obj) } static Property pci_piix3_props[] = { - DEFINE_PROP_UINT32("smb_io_base", PIIX3State, smb_io_base, 0), - DEFINE_PROP_BOOL("has-acpi", PIIX3State, has_acpi, true), - DEFINE_PROP_BOOL("has-usb", PIIX3State, has_usb, true), - DEFINE_PROP_BOOL("smm-enabled", PIIX3State, smm_enabled, false), + DEFINE_PROP_UINT32("smb_io_base", PIIXState, smb_io_base, 0), + DEFINE_PROP_BOOL("has-acpi", PIIXState, has_acpi, true), + DEFINE_PROP_BOOL("has-usb", PIIXState, has_usb, true), + DEFINE_PROP_BOOL("smm-enabled", PIIXState, smm_enabled, false), DEFINE_PROP_END_OF_LIST(), }; @@ -386,10 +386,10 @@ static void pci_piix3_class_init(ObjectClass *klass, void *data) adevc->build_dev_aml = build_pci_isa_aml; } -static const TypeInfo piix3_pci_type_info = { - .name = TYPE_PIIX3_PCI_DEVICE, +static const TypeInfo piix_pci_type_info = { + .name = TYPE_PIIX_PCI_DEVICE, .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(PIIX3State), + .instance_size = sizeof(PIIXState), .instance_init = pci_piix3_init, .abstract = true, .class_init = pci_piix3_class_init, @@ -403,7 +403,7 @@ static const TypeInfo piix3_pci_type_info = { static void piix3_realize(PCIDevice *dev, Error **errp) { ERRP_GUARD(); - PIIX3State *piix3 = PIIX3_PCI_DEVICE(dev); + PIIXState *piix3 = PIIX_PCI_DEVICE(dev); PCIBus *pci_bus = pci_get_bus(dev); pci_piix3_realize(dev, errp); @@ -424,13 +424,13 @@ static void piix3_class_init(ObjectClass *klass, void *data) static const TypeInfo piix3_info = { .name = TYPE_PIIX3_DEVICE, - .parent = TYPE_PIIX3_PCI_DEVICE, + .parent = TYPE_PIIX_PCI_DEVICE, .class_init = piix3_class_init, }; static void piix3_register_types(void) { - type_register_static(&piix3_pci_type_info); + type_register_static(&piix_pci_type_info); type_register_static(&piix3_info); } From patchwork Wed Oct 18 15:57:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851036 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=DxOAmYkz; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bpt4Xq0z20cx for ; Thu, 19 Oct 2023 03:27:18 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8wZ-000121-EL; Wed, 18 Oct 2023 11:58:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vf-00081g-JY for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vd-0007M4-Tg for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644669; 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=07jjqgvNUgYjog87FAd6enRV4Ow+UHErs+Qz1yC1V50=; b=DxOAmYkzJri5Lfz/Ebyl74fxZgIgAEK7vEZUWrJQNreKtbHKmn39ZP+NY3cG90Dsx6kQ1B kDItxKGdFszrbQZ3of4DHf/fURFyIDbX9fgKqPXRRvW6fyrTbZNTYstFRgmfSd0c0yez+Y 3aJNsvLmClKfbMv6m9Ek6HsM5fn2voc= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-672-grV7di7IM-q8ae2EY005pg-1; Wed, 18 Oct 2023 11:57:48 -0400 X-MC-Unique: grV7di7IM-q8ae2EY005pg-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-32da87eac93so2477601f8f.2 for ; Wed, 18 Oct 2023 08:57:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644666; x=1698249466; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=07jjqgvNUgYjog87FAd6enRV4Ow+UHErs+Qz1yC1V50=; b=HwGMPCnrKnFvEQCn63W850g4UeZrnyeTbpoqy/4pRzdCNRJkSakKPun7QqmVhCmJDC RCQxmrsMeqaKNiWpgi1mDbBGxmYaYT1SO0Niw1Do7sxKD6wqqjkWl1tYuOhMLyKkGJcQ kda1U7sw26eQcfl9bYtExY55ZcwuwfplJnL/f8wsuUKRfcTW4zsqqq9g3XNdsjAIe2jh TZHZOH7pdIk1wajSKAskJnTFyu30NjD65eEJ5/DDoPRC0M4oJDaQpEKdwxpQWoz3Dowu l0zaPqCfxi71JB0zMuwrWP8qfHGX40fxEuY2BBH+Zn3CYPtKbQOr5xVDGVgy0bFYTKQC MpnA== X-Gm-Message-State: AOJu0Ywgs/bFz7gyJSh66G1oEeRayFz8SGdrSdBby7qMklXw0FQdwgjn WWEQzb/SYcVpJKzCKA00NLFcTnLZXOBSkHKuPfm+BfRLukbLc3iXO5X6OmMau7jQBBwPA/ekyo9 DJo2zvgGnvpaUwW766BgV9Gw/bTVJ48a+I9q+p1nLR6ZxMlc1coTkSyRQg7oRO+QVW7Tj2TE= X-Received: by 2002:a5d:5612:0:b0:32d:82d8:3442 with SMTP id l18-20020a5d5612000000b0032d82d83442mr4405783wrv.53.1697644666109; Wed, 18 Oct 2023 08:57:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE7RfmysDx3cXp2nj9RS59UMYvfdklpi0Ix7+RStApIQEVhKwRUdduNRCclJTyUDZD2kqlfpQ== X-Received: by 2002:a5d:5612:0:b0:32d:82d8:3442 with SMTP id l18-20020a5d5612000000b0032d82d83442mr4405768wrv.53.1697644665803; Wed, 18 Oct 2023 08:57:45 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id d17-20020a5d4f91000000b0032d72f48555sm2393430wru.36.2023.10.18.08.57.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:57:45 -0700 (PDT) Date: Wed, 18 Oct 2023 11:57:42 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 57/83] hw/isa/piix4: Remove unused inbound ISA interrupt lines Message-ID: <18b1a595bd0d763856c58a308aaa25bf6e1c2a80.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow The Malta board, which is the only user of PIIX4, doesn't connect to the exported interrupt lines. PIIX3 doesn't expose such interrupt lines either, so remove them for PIIX4 for simplicity and consistency. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin Message-Id: <20231007123843.127151-16-shentey@gmail.com> Signed-off-by: Michael S. Tsirkin --- hw/isa/piix4.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index e0b149f8eb..3c3c7a094c 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -148,12 +148,6 @@ static void piix4_request_i8259_irq(void *opaque, int irq, int level) qemu_set_irq(s->cpu_intr, level); } -static void piix4_set_i8259_irq(void *opaque, int irq, int level) -{ - PIIX4State *s = opaque; - qemu_set_irq(s->isa[irq], level); -} - static void piix4_rcr_write(void *opaque, hwaddr addr, uint64_t val, unsigned int len) { @@ -197,8 +191,6 @@ static void piix4_realize(PCIDevice *dev, Error **errp) return; } - qdev_init_gpio_in_named(DEVICE(dev), piix4_set_i8259_irq, - "isa", ISA_NUM_IRQS); qdev_init_gpio_out_named(DEVICE(dev), &s->cpu_intr, "intr", 1); From patchwork Wed Oct 18 15:57:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851108 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HoB9mQTx; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9d6C08W0z20Zj for ; Thu, 19 Oct 2023 04:25:39 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8x6-0001gC-49; Wed, 18 Oct 2023 11:59:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vk-00085g-EM for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vi-0007MJ-VL for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644673; 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=0Znu+ot2If10k79VuPHcVlyjtAkby0fPqJ4/KsGVlXE=; b=HoB9mQTxKNFUwLAICv/MHId/rkmlsXe71JWdI6lCznn75P3eqia/ZZMtFBgWJX3pTBMfIl mkWinUvxkeS66pWaxwnLizEKxUENPz6RyF3NJ6Ehk1n6DvhXXY7FkxQe12dvk9jyOAzHNb K8tyBVhKZclCs7YLqLt/WHZgceIQvBo= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-27-8uggM64XPz2atV_2ISPUwA-1; Wed, 18 Oct 2023 11:57:52 -0400 X-MC-Unique: 8uggM64XPz2atV_2ISPUwA-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4055ce1e8c4so36995575e9.0 for ; Wed, 18 Oct 2023 08:57:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644670; x=1698249470; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=0Znu+ot2If10k79VuPHcVlyjtAkby0fPqJ4/KsGVlXE=; b=mXnJXi5ubQL2BZJT3EOeqqUby9XDvimlEPG554/wLwn1hOG8TxZ/3iFiNGAptVUejF kDyDwiueBBkhd7Q2MvMroHgKGPJBUq4v5IKW0kqs2YyPGyfiGbdkEE68YHK2YXhsEBvj 2XZ2F37GbIb8981roqHNZrdiDYrGpbHfQziWVgteI8JT7GFGhy5swXh3XH6DhxDvSZ7Q G0ZGGPllSb3XJj+vNQ0rC6PRDUCsCgqyuNsgwt/2q0l7al4YNi+pV1kndT92naR4QbaV Pye883YtAoceSlPx1bkAtMJ+Gv9bqDII0btO0A0Udq2CnnthUV/LfyegdKLDDNx1eXfj VpOA== X-Gm-Message-State: AOJu0YyVB2LU3s4RHS8xZdydTmyzRJVSFxyofw4eAHDzQJZlrr/Gtv0Z KTdf0yYbyv5ztOD0ToR4otQHWvxVDEpXhf1JF26xJM5XZboCTNK2hZVxDmaySGMNLCCmQDOMD1w 5KCmDCs0R3CyIfSwiGnZF1h9Gn1uxSrJohSLdTKjt8rOvQwISRU+ND9glILFvlIMJFTllI2g= X-Received: by 2002:a05:6000:23a:b0:319:8c99:989a with SMTP id l26-20020a056000023a00b003198c99989amr5670408wrz.8.1697644670296; Wed, 18 Oct 2023 08:57:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFzNKBDiLuRbSIta0ccA8G7xXAt6Zd/v2wKe9deqhBteDyNSZORhKYKYVovZRuDg5qyK9hwzg== X-Received: by 2002:a05:6000:23a:b0:319:8c99:989a with SMTP id l26-20020a056000023a00b003198c99989amr5670386wrz.8.1697644670021; Wed, 18 Oct 2023 08:57:50 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id c12-20020adfe70c000000b0031c6e1ea4c7sm2368769wrm.90.2023.10.18.08.57.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:57:49 -0700 (PDT) Date: Wed, 18 Oct 2023 11:57:46 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 58/83] hw/isa/piix4: Rename "isa" attribute to "isa_irqs_in" Message-ID: <9f6357a5404fada0723c324f237293f9395e0020.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow Rename the "isa" attribute to align it with PIIX3 for consolidation. Signed-off-by: Bernhard Beschow Message-Id: <20231007123843.127151-17-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/isa/piix4.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 3c3c7a094c..9c8b6c98ab 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -45,7 +45,7 @@ struct PIIX4State { PCIDevice dev; qemu_irq cpu_intr; - qemu_irq *isa; + qemu_irq *isa_irqs_in; MC146818RtcState rtc; PCIIDEState ide; @@ -75,7 +75,7 @@ static void piix4_set_irq(void *opaque, int irq_num, int level) pic_level |= pci_bus_get_irq_level(bus, i); } } - qemu_set_irq(s->isa[pic_irq], pic_level); + qemu_set_irq(s->isa_irqs_in[pic_irq], pic_level); } } @@ -201,10 +201,10 @@ static void piix4_realize(PCIDevice *dev, Error **errp) /* initialize i8259 pic */ i8259_out_irq = qemu_allocate_irqs(piix4_request_i8259_irq, s, 1); - s->isa = i8259_init(isa_bus, *i8259_out_irq); + s->isa_irqs_in = i8259_init(isa_bus, *i8259_out_irq); /* initialize ISA irqs */ - isa_bus_register_input_irqs(isa_bus, s->isa); + isa_bus_register_input_irqs(isa_bus, s->isa_irqs_in); /* initialize pit */ i8254_pit_init(isa_bus, 0x40, 0, NULL); @@ -236,7 +236,7 @@ static void piix4_realize(PCIDevice *dev, Error **errp) if (!qdev_realize(DEVICE(&s->pm), BUS(pci_bus), errp)) { return; } - qdev_connect_gpio_out(DEVICE(&s->pm), 0, s->isa[9]); + qdev_connect_gpio_out(DEVICE(&s->pm), 0, s->isa_irqs_in[9]); pci_bus_irqs(pci_bus, piix4_set_irq, s, PIIX_NUM_PIRQS); } From patchwork Wed Oct 18 15:57:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851000 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=LgJJCmY0; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bCq0gRhz20Zj for ; Thu, 19 Oct 2023 03:00:23 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8we-0001Ad-O7; Wed, 18 Oct 2023 11:58:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vn-0008Bg-1N for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vl-0007MY-Dy for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:57:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644676; 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=4arzXmLJ3FrdbgfYxEVNZzbkjzhvA/33H3ygks9bhhI=; b=LgJJCmY08w6WZN2s9sCb3GoAOqLiE/yVDU98E9uJYDvuBrw7S4qr2W3xMScYkdVOUkCnMt lTMg7IaIxlmexEfcZ5G0YDPn8SWgQedtt7D5ym6RVQKSR0fKpmLQw18d1pB5riLSyPN7kI WGyda8f1DUNOGd9bRFURJWkUM4PebhA= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-653-OVyBKdhPPYa1CyJRzxh23Q-1; Wed, 18 Oct 2023 11:57:55 -0400 X-MC-Unique: OVyBKdhPPYa1CyJRzxh23Q-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-31fd48da316so4272532f8f.3 for ; Wed, 18 Oct 2023 08:57:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644673; x=1698249473; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4arzXmLJ3FrdbgfYxEVNZzbkjzhvA/33H3ygks9bhhI=; b=m4ukw6gZ2gq3dODsS1zuWUofpPJ/b311MsDIBroBVa7jplNQ4OacZ7BZGZvfZ06x0z VJuU0j+JrNY8+RN7YcKzn7LBcpdisaaa2Rp8JQYg5ROHFe8yss3SV7/zj9MOuyhu4YRa y6BQcmqqq6qhCQHtA71O7Cjh6bFaBzHkAEBFNd9Vz45mLbLmVPZT7TvOPsu3LCENTdTd fxLpbFk/HO3sXFPndQa0C05MBWBnCe5SQP/6R3WAJJNnDdWxIlIH3/3foMUaLILPfTUM abZ/NObxHqduMYqesGmLJllKXaAqa2a5yBaB1MwGg85VaHLXo9LmpobtUqRaI83lBUlk IsqA== X-Gm-Message-State: AOJu0YwkuOS1hL0Futl4pLfWnBYvIoeX7X0je4WYOnF0ZN3R1d2cGwFi 6hmEFWoL7ms+p4BTX40sRFCM8msFrbJAf8QfpOvDquVq3mbtVLUbBYmqvbd2WIKG6q/ckI+P5Qz xLecdj0S5ix+LPHYaoUdUry1iBGbmg2aEUWi7oByv00wCFMaz4UyFgwEsAwaJLNbGSz6gyDo= X-Received: by 2002:adf:e7cf:0:b0:32d:a40f:d920 with SMTP id e15-20020adfe7cf000000b0032da40fd920mr4162251wrn.20.1697644673770; Wed, 18 Oct 2023 08:57:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYYamnCP+azF53U+LLuofqXh1iLGt7Yxtrfn1yxXllFWNBCLTGg5O3EPiX3RRs5w+qQW1sSA== X-Received: by 2002:adf:e7cf:0:b0:32d:a40f:d920 with SMTP id e15-20020adfe7cf000000b0032da40fd920mr4162242wrn.20.1697644673441; Wed, 18 Oct 2023 08:57:53 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id j17-20020a5d5651000000b0032d8f075810sm2395935wrw.10.2023.10.18.08.57.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:57:53 -0700 (PDT) Date: Wed, 18 Oct 2023 11:57:50 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 59/83] hw/isa/piix4: Rename reset control operations to match PIIX3 Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow Both implementations are the same and will be shared upon merging. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Michael S. Tsirkin Message-Id: <20231007123843.127151-18-shentey@gmail.com> Signed-off-by: Michael S. Tsirkin --- hw/isa/piix4.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 9c8b6c98ab..eb456622c5 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -148,8 +148,8 @@ static void piix4_request_i8259_irq(void *opaque, int irq, int level) qemu_set_irq(s->cpu_intr, level); } -static void piix4_rcr_write(void *opaque, hwaddr addr, uint64_t val, - unsigned int len) +static void rcr_write(void *opaque, hwaddr addr, uint64_t val, + unsigned int len) { PIIX4State *s = opaque; @@ -161,16 +161,16 @@ static void piix4_rcr_write(void *opaque, hwaddr addr, uint64_t val, s->rcr = val & 2; /* keep System Reset type only */ } -static uint64_t piix4_rcr_read(void *opaque, hwaddr addr, unsigned int len) +static uint64_t rcr_read(void *opaque, hwaddr addr, unsigned int len) { PIIX4State *s = opaque; return s->rcr; } -static const MemoryRegionOps piix4_rcr_ops = { - .read = piix4_rcr_read, - .write = piix4_rcr_write, +static const MemoryRegionOps rcr_ops = { + .read = rcr_read, + .write = rcr_write, .endianness = DEVICE_LITTLE_ENDIAN, .impl = { .min_access_size = 1, @@ -194,7 +194,7 @@ static void piix4_realize(PCIDevice *dev, Error **errp) qdev_init_gpio_out_named(DEVICE(dev), &s->cpu_intr, "intr", 1); - memory_region_init_io(&s->rcr_mem, OBJECT(dev), &piix4_rcr_ops, s, + memory_region_init_io(&s->rcr_mem, OBJECT(dev), &rcr_ops, s, "reset-control", 1); memory_region_add_subregion_overlap(pci_address_space_io(dev), PIIX_RCR_IOPORT, &s->rcr_mem, 1); From patchwork Wed Oct 18 15:57:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851063 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Uz6RCi6X; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9c7v27HJz20cx for ; Thu, 19 Oct 2023 03:42:03 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8wz-0001Uk-Le; Wed, 18 Oct 2023 11:59:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8wF-0000mT-52 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8wC-0007Q6-84 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644703; 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=Sa7cxSufEU1YWW/+qYkYuIGxk5+3HVskWy82qBGzA2s=; b=Uz6RCi6XZL1R+QUkWJDMMoIDTZBiCC9FtcipdllU6ogZgo0A/kPyI94yfpQnPzLS77uwOV 8Zz7PJEBUCD9YNa/XCXlh00aXqVhNMs8owz8YQR7T/vlrSu+dWQ/n6uvPnnkzv53Nm8Ye4 54WXMS3zr+RPdTKeL+uuOgMJjZkLnVU= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-507-9FQ9p8sfOvSQ_E-A03IZKA-1; Wed, 18 Oct 2023 11:57:59 -0400 X-MC-Unique: 9FQ9p8sfOvSQ_E-A03IZKA-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-3231fceb811so4138778f8f.2 for ; Wed, 18 Oct 2023 08:57:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644678; x=1698249478; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Sa7cxSufEU1YWW/+qYkYuIGxk5+3HVskWy82qBGzA2s=; b=gSSpqJYgWVxEcDt7qCbmf9F92DyiS0IVFwXayeGndgInm3gahIZfxsy22cpybF62LI je9Klhu6FlSXI/nHKPvRuR4znMgMVjn9x4zzCt0MXyFWCQ+uFi1QbVCAp9YkvM21+1fI oueYFtVDBlWRMXOjkYxUfUQKlRYiWWqDthZMqnZQehIGLF/ChEGHJyh3fkRLd11S8EQm mh8xN2/0CmnHabznuWiTVOJcI9L0s7etM3GqHhpHAzQQxIkUSgBrrIM/aNOEnRyTGATH KGvcdX9hs8j2F5bSpWMQcKA8CU5vFrjraKQcb2ePyCI+m0I4EUzeMPhjC2eCUWrHb9uh HRTg== X-Gm-Message-State: AOJu0YwDEp/pkoxLCVXBefItlEnWzul7aEpy+p1Gs1rKsdAGOCkM8+wg cMnIUM6IiMwuQcAG9CX+XgJwlIwHuN28oIOx+miESE1AAO0q9/j/M0uhXEh8BJXDwCTPMmJVd+L bx3NLu0T928o/++1OTkGXh3nhw/aXEmkjUrGBy9c8Gmwn3eLdUsTWVVXeARMzS5U2fXydsBU= X-Received: by 2002:a5d:4e90:0:b0:32d:a4c4:f700 with SMTP id e16-20020a5d4e90000000b0032da4c4f700mr4654626wru.38.1697644678122; Wed, 18 Oct 2023 08:57:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFVmTRf8M1sYmePksRQUi8x2kkJ3sMHviIBlCpHeVXEM/iSE2GYSGiNENRYV+8LL3BpLVK+Cw== X-Received: by 2002:a5d:4e90:0:b0:32d:a4c4:f700 with SMTP id e16-20020a5d4e90000000b0032da4c4f700mr4654611wru.38.1697644677815; Wed, 18 Oct 2023 08:57:57 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id m11-20020a056000180b00b0032db8f7f378sm2400573wrh.71.2023.10.18.08.57.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:57:57 -0700 (PDT) Date: Wed, 18 Oct 2023 11:57:53 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Marcel Apfelbaum , =?utf-8?b?SGVydsOp?= Poussineau , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Aurelien Jarno Subject: [PULL 60/83] hw/isa/piix4: Reuse struct PIIXState from PIIX3 Message-ID: <14d6b2f62da4f8e586e80e6aff7c7c1dd0d38faf.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow PIIX4 has its own, private PIIX4State structure. PIIX3 has almost the same structure, provided in a public header. So reuse it and add a cpu_intr attribute to it which is only used by PIIX4. Signed-off-by: Bernhard Beschow Message-Id: <20231007123843.127151-19-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/southbridge/piix.h | 1 + hw/isa/piix4.c | 26 +++++++++++--------------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index 0b257e1582..dd5f7b31c0 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -49,6 +49,7 @@ struct PIIXState { #endif uint64_t pic_levels; + qemu_irq cpu_intr; qemu_irq isa_irqs_in[ISA_NUM_IRQS]; /* This member isn't used. Just for save/load compatibility */ diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index eb456622c5..71899aaa69 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -42,21 +42,9 @@ #include "sysemu/runstate.h" #include "qom/object.h" -struct PIIX4State { - PCIDevice dev; - qemu_irq cpu_intr; - qemu_irq *isa_irqs_in; +typedef struct PIIXState PIIX4State; - MC146818RtcState rtc; - PCIIDEState ide; - UHCIState uhci; - PIIX4PMState pm; - /* Reset Control Register */ - MemoryRegion rcr_mem; - uint8_t rcr; -}; - -OBJECT_DECLARE_SIMPLE_TYPE(PIIX4State, PIIX4_PCI_DEVICE) +DECLARE_INSTANCE_CHECKER(PIIX4State, PIIX4_PCI_DEVICE, TYPE_PIIX4_PCI_DEVICE) static void piix4_set_irq(void *opaque, int irq_num, int level) { @@ -184,6 +172,8 @@ static void piix4_realize(PCIDevice *dev, Error **errp) PCIBus *pci_bus = pci_get_bus(dev); ISABus *isa_bus; qemu_irq *i8259_out_irq; + qemu_irq *i8259; + size_t i; isa_bus = isa_bus_new(DEVICE(dev), pci_address_space(dev), pci_address_space_io(dev), errp); @@ -201,7 +191,13 @@ static void piix4_realize(PCIDevice *dev, Error **errp) /* initialize i8259 pic */ i8259_out_irq = qemu_allocate_irqs(piix4_request_i8259_irq, s, 1); - s->isa_irqs_in = i8259_init(isa_bus, *i8259_out_irq); + i8259 = i8259_init(isa_bus, *i8259_out_irq); + + for (i = 0; i < ISA_NUM_IRQS; i++) { + s->isa_irqs_in[i] = i8259[i]; + } + + g_free(i8259); /* initialize ISA irqs */ isa_bus_register_input_irqs(isa_bus, s->isa_irqs_in); From patchwork Wed Oct 18 15:57:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851089 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=iVDBJY3c; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9cnm4slyz20Zj for ; Thu, 19 Oct 2023 04:11:24 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8x8-0001kH-HX; Wed, 18 Oct 2023 11:59:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vz-0000Kz-QO for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8vw-0007NO-2i for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644687; 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=zp8ck988MeO0ieV9CiSN4OR7iyEaCu9xYo7GkmkUxAU=; b=iVDBJY3czFew31ekLoFmRD5zaMcM7yw1e7sWA7kfBbJL8sZbyCbbieBlvJJlM7FUMsKbZz yG/pwRRYS8iCKf01M+O9VTEfLIg1BofjH5FzDGpRWLfWepGT8UAulVY/X9p2SjJk9eWO7W DN0MvGF+cRZ3vQt178lka2Szpipkrds= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-10-OD1_kstmPh6mXz6WGXdyjg-1; Wed, 18 Oct 2023 11:58:05 -0400 X-MC-Unique: OD1_kstmPh6mXz6WGXdyjg-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-32da47641b5so2727314f8f.0 for ; Wed, 18 Oct 2023 08:58:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644684; x=1698249484; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zp8ck988MeO0ieV9CiSN4OR7iyEaCu9xYo7GkmkUxAU=; b=TadV+wOK5T/AtDoDqzH0InozHY97/l36c5h/fLpPBJXHsFu/DZJhP2lAFwDJ20FAUP ITv+eWXGFSjgWTEo6iv6h14skanTUuMdj+PQkQTqvm1bDuIbnxAFxaI4TDI45rx9jUUr v4acExs+W0jo4qXI2KIhTeMv7RCKtJMR5eDhFzhEQO2Yzs/fwsJJo4o1RQ43gKd8xLfB UgtQael2x4GxyBDp/oaYUjyYjedlIeq5qNI77B14gumOwHv2iHQK2Tcdg9BOZW8Lw9HC 5ezjVKXIHLG5l+WoNwO4cbM1hoWlmWkXXwe4fUDoP9e7Uc90R0EfLrQYrnEezPcLo8YV GFWg== X-Gm-Message-State: AOJu0Yzch53oEw0HlyiQj5egWisAKR5vLRBW2CGiN9Xut3lsZbI/ZuU7 pzrOAOrRauFIP3a0Zy+SFB5iqqX9oHImqlOxMegkCitvU5+ZP1uVLyDOVP719h7ktoA/bI/jPeO MoUdsCuWC86nrvY5kwJB54v0O6Tg6WcGKMX/l3xSRo39fLBy99bkEARZb9eSQ6t3ETL0F4O8= X-Received: by 2002:a5d:6503:0:b0:321:5969:d465 with SMTP id x3-20020a5d6503000000b003215969d465mr3591593wru.65.1697644683761; Wed, 18 Oct 2023 08:58:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHTbdKio84SGYK9SA88LCd893q01+uRgXRRiAxdftDay8omm7fkZsz1tDfv15BjWoa+RQ93vQ== X-Received: by 2002:a5d:6503:0:b0:321:5969:d465 with SMTP id x3-20020a5d6503000000b003215969d465mr3591566wru.65.1697644683260; Wed, 18 Oct 2023 08:58:03 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id y15-20020a5d614f000000b003142e438e8csm2393480wrt.26.2023.10.18.08.57.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:58:02 -0700 (PDT) Date: Wed, 18 Oct 2023 11:57:58 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Paolo Bonzini , Marcel Apfelbaum , Richard Henderson , Eduardo Habkost , =?utf-8?b?SGVydsOp?= Poussineau , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Aurelien Jarno Subject: [PULL 61/83] hw/isa/piix3: Merge hw/isa/piix4.c Message-ID: <65d635838d43007c6b4996dbf5c6d61715b60d73.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow Now that the PIIX3 and PIIX4 device models are sufficiently prepared, their implementations can be merged into one file for further consolidation. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin Message-Id: <20231007123843.127151-20-shentey@gmail.com> Signed-off-by: Michael S. Tsirkin --- hw/isa/{piix3.c => piix.c} | 190 +++++++++++++++++++++++- hw/isa/piix4.c | 290 ------------------------------------- MAINTAINERS | 6 +- hw/i386/Kconfig | 2 +- hw/isa/Kconfig | 11 +- hw/isa/meson.build | 3 +- hw/mips/Kconfig | 2 +- 7 files changed, 195 insertions(+), 309 deletions(-) rename hw/isa/{piix3.c => piix.c} (71%) delete mode 100644 hw/isa/piix4.c diff --git a/hw/isa/piix3.c b/hw/isa/piix.c similarity index 71% rename from hw/isa/piix3.c rename to hw/isa/piix.c index c7e59249b6..f6da334c6f 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix.c @@ -2,6 +2,7 @@ * QEMU PIIX PCI ISA Bridge Emulation * * Copyright (c) 2006 Fabrice Bellard + * Copyright (c) 2018 Hervé Poussineau * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -27,14 +28,20 @@ #include "qapi/error.h" #include "hw/dma/i8257.h" #include "hw/southbridge/piix.h" +#include "hw/timer/i8254.h" #include "hw/irq.h" #include "hw/qdev-properties.h" #include "hw/ide/piix.h" +#include "hw/intc/i8259.h" #include "hw/isa/isa.h" #include "sysemu/runstate.h" #include "migration/vmstate.h" #include "hw/acpi/acpi_aml_interface.h" +typedef struct PIIXState PIIX4State; + +DECLARE_INSTANCE_CHECKER(PIIX4State, PIIX4_PCI_DEVICE, TYPE_PIIX4_PCI_DEVICE) + static void piix3_set_irq_pic(PIIXState *piix3, int pic_irq) { qemu_set_irq(piix3->isa_irqs_in[pic_irq], @@ -78,6 +85,33 @@ static void piix3_set_irq(void *opaque, int pirq, int level) piix3_set_irq_level(piix3, pirq, level); } +static void piix4_set_irq(void *opaque, int irq_num, int level) +{ + int i, pic_irq, pic_level; + PIIX4State *s = opaque; + PCIBus *bus = pci_get_bus(&s->dev); + + /* now we change the pic irq level according to the piix irq mappings */ + /* XXX: optimize */ + pic_irq = s->dev.config[PIIX_PIRQCA + irq_num]; + if (pic_irq < ISA_NUM_IRQS) { + /* The pic level is the logical OR of all the PCI irqs mapped to it. */ + pic_level = 0; + for (i = 0; i < PIIX_NUM_PIRQS; i++) { + if (pic_irq == s->dev.config[PIIX_PIRQCA + i]) { + pic_level |= pci_bus_get_irq_level(bus, i); + } + } + qemu_set_irq(s->isa_irqs_in[pic_irq], pic_level); + } +} + +static void piix4_request_i8259_irq(void *opaque, int irq, int level) +{ + PIIX4State *s = opaque; + qemu_set_irq(s->cpu_intr, level); +} + static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opaque, int pin) { PIIXState *piix3 = opaque; @@ -122,9 +156,8 @@ static void piix3_write_config(PCIDevice *dev, } } -static void piix3_reset(DeviceState *dev) +static void piix_reset(PIIXState *d) { - PIIXState *d = PIIX_PCI_DEVICE(dev); uint8_t *pci_conf = d->dev.config; pci_conf[0x04] = 0x07; /* master, memory and I/O */ @@ -163,6 +196,13 @@ static void piix3_reset(DeviceState *dev) d->rcr = 0; } +static void piix3_reset(DeviceState *dev) +{ + PIIXState *d = PIIX_PCI_DEVICE(dev); + + piix_reset(d); +} + static int piix3_post_load(void *opaque, int version_id) { PIIXState *piix3 = opaque; @@ -185,6 +225,17 @@ static int piix3_post_load(void *opaque, int version_id) return 0; } +static int piix4_post_load(void *opaque, int version_id) +{ + PIIX4State *s = opaque; + + if (version_id == 2) { + s->rcr = 0; + } + + return 0; +} + static int piix3_pre_save(void *opaque) { int i; @@ -234,6 +285,17 @@ static const VMStateDescription vmstate_piix3 = { } }; +static const VMStateDescription vmstate_piix4 = { + .name = "PIIX4", + .version_id = 3, + .minimum_version_id = 2, + .post_load = piix4_post_load, + .fields = (VMStateField[]) { + VMSTATE_PCI_DEVICE(dev, PIIX4State), + VMSTATE_UINT8_V(rcr, PIIX4State, 3), + VMSTATE_END_OF_LIST() + } +}; static void rcr_write(void *opaque, hwaddr addr, uint64_t val, unsigned len) { @@ -428,10 +490,134 @@ static const TypeInfo piix3_info = { .class_init = piix3_class_init, }; +static void piix4_realize(PCIDevice *dev, Error **errp) +{ + PIIX4State *s = PIIX4_PCI_DEVICE(dev); + PCIBus *pci_bus = pci_get_bus(dev); + ISABus *isa_bus; + qemu_irq *i8259_out_irq; + qemu_irq *i8259; + size_t i; + + isa_bus = isa_bus_new(DEVICE(dev), pci_address_space(dev), + pci_address_space_io(dev), errp); + if (!isa_bus) { + return; + } + + qdev_init_gpio_out_named(DEVICE(dev), &s->cpu_intr, + "intr", 1); + + memory_region_init_io(&s->rcr_mem, OBJECT(dev), &rcr_ops, s, + "reset-control", 1); + memory_region_add_subregion_overlap(pci_address_space_io(dev), + PIIX_RCR_IOPORT, &s->rcr_mem, 1); + + /* initialize i8259 pic */ + i8259_out_irq = qemu_allocate_irqs(piix4_request_i8259_irq, s, 1); + i8259 = i8259_init(isa_bus, *i8259_out_irq); + + for (i = 0; i < ISA_NUM_IRQS; i++) { + s->isa_irqs_in[i] = i8259[i]; + } + + g_free(i8259); + + /* initialize ISA irqs */ + isa_bus_register_input_irqs(isa_bus, s->isa_irqs_in); + + /* initialize pit */ + i8254_pit_init(isa_bus, 0x40, 0, NULL); + + /* DMA */ + i8257_dma_init(isa_bus, 0); + + /* RTC */ + qdev_prop_set_int32(DEVICE(&s->rtc), "base_year", 2000); + if (!qdev_realize(DEVICE(&s->rtc), BUS(isa_bus), errp)) { + return; + } + s->rtc.irq = isa_get_irq(ISA_DEVICE(&s->rtc), s->rtc.isairq); + + /* IDE */ + qdev_prop_set_int32(DEVICE(&s->ide), "addr", dev->devfn + 1); + if (!qdev_realize(DEVICE(&s->ide), BUS(pci_bus), errp)) { + return; + } + + /* USB */ + qdev_prop_set_int32(DEVICE(&s->uhci), "addr", dev->devfn + 2); + if (!qdev_realize(DEVICE(&s->uhci), BUS(pci_bus), errp)) { + return; + } + + /* ACPI controller */ + qdev_prop_set_int32(DEVICE(&s->pm), "addr", dev->devfn + 3); + if (!qdev_realize(DEVICE(&s->pm), BUS(pci_bus), errp)) { + return; + } + qdev_connect_gpio_out(DEVICE(&s->pm), 0, s->isa_irqs_in[9]); + + pci_bus_irqs(pci_bus, piix4_set_irq, s, PIIX_NUM_PIRQS); +} + +static void piix4_isa_reset(DeviceState *dev) +{ + PIIX4State *s = PIIX4_PCI_DEVICE(dev); + + piix_reset(s); +} + +static void piix4_init(Object *obj) +{ + PIIX4State *s = PIIX4_PCI_DEVICE(obj); + + object_initialize_child(obj, "rtc", &s->rtc, TYPE_MC146818_RTC); + object_initialize_child(obj, "ide", &s->ide, TYPE_PIIX4_IDE); + object_initialize_child(obj, "uhci", &s->uhci, TYPE_PIIX4_USB_UHCI); + + object_initialize_child(obj, "pm", &s->pm, TYPE_PIIX4_PM); + qdev_prop_set_uint32(DEVICE(&s->pm), "smb_io_base", 0x1100); + qdev_prop_set_bit(DEVICE(&s->pm), "smm-enabled", 0); +} + +static void piix4_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); + + k->realize = piix4_realize; + k->vendor_id = PCI_VENDOR_ID_INTEL; + k->device_id = PCI_DEVICE_ID_INTEL_82371AB_0; + k->class_id = PCI_CLASS_BRIDGE_ISA; + dc->reset = piix4_isa_reset; + dc->desc = "ISA bridge"; + dc->vmsd = &vmstate_piix4; + /* + * Reason: part of PIIX4 southbridge, needs to be wired up, + * e.g. by mips_malta_init() + */ + dc->user_creatable = false; + dc->hotpluggable = false; +} + +static const TypeInfo piix4_info = { + .name = TYPE_PIIX4_PCI_DEVICE, + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(PIIX4State), + .instance_init = piix4_init, + .class_init = piix4_class_init, + .interfaces = (InterfaceInfo[]) { + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { }, + }, +}; + static void piix3_register_types(void) { type_register_static(&piix_pci_type_info); type_register_static(&piix3_info); + type_register_static(&piix4_info); } type_init(piix3_register_types) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c deleted file mode 100644 index 71899aaa69..0000000000 --- a/hw/isa/piix4.c +++ /dev/null @@ -1,290 +0,0 @@ -/* - * QEMU PIIX4 PCI Bridge Emulation - * - * Copyright (c) 2006 Fabrice Bellard - * Copyright (c) 2018 Hervé Poussineau - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "qemu/osdep.h" -#include "qapi/error.h" -#include "hw/irq.h" -#include "hw/southbridge/piix.h" -#include "hw/pci/pci.h" -#include "hw/ide/piix.h" -#include "hw/isa/isa.h" -#include "hw/intc/i8259.h" -#include "hw/dma/i8257.h" -#include "hw/timer/i8254.h" -#include "hw/rtc/mc146818rtc.h" -#include "hw/ide/pci.h" -#include "hw/acpi/piix4.h" -#include "hw/usb/hcd-uhci.h" -#include "migration/vmstate.h" -#include "sysemu/reset.h" -#include "sysemu/runstate.h" -#include "qom/object.h" - -typedef struct PIIXState PIIX4State; - -DECLARE_INSTANCE_CHECKER(PIIX4State, PIIX4_PCI_DEVICE, TYPE_PIIX4_PCI_DEVICE) - -static void piix4_set_irq(void *opaque, int irq_num, int level) -{ - int i, pic_irq, pic_level; - PIIX4State *s = opaque; - PCIBus *bus = pci_get_bus(&s->dev); - - /* now we change the pic irq level according to the piix irq mappings */ - /* XXX: optimize */ - pic_irq = s->dev.config[PIIX_PIRQCA + irq_num]; - if (pic_irq < ISA_NUM_IRQS) { - /* The pic level is the logical OR of all the PCI irqs mapped to it. */ - pic_level = 0; - for (i = 0; i < PIIX_NUM_PIRQS; i++) { - if (pic_irq == s->dev.config[PIIX_PIRQCA + i]) { - pic_level |= pci_bus_get_irq_level(bus, i); - } - } - qemu_set_irq(s->isa_irqs_in[pic_irq], pic_level); - } -} - -static void piix4_isa_reset(DeviceState *dev) -{ - PIIX4State *d = PIIX4_PCI_DEVICE(dev); - uint8_t *pci_conf = d->dev.config; - - pci_conf[0x04] = 0x07; // master, memory and I/O - pci_conf[0x05] = 0x00; - pci_conf[0x06] = 0x00; - pci_conf[0x07] = 0x02; // PCI_status_devsel_medium - pci_conf[0x4c] = 0x4d; - pci_conf[0x4e] = 0x03; - pci_conf[0x4f] = 0x00; - pci_conf[0x60] = 0x80; - pci_conf[0x61] = 0x80; - pci_conf[0x62] = 0x80; - pci_conf[0x63] = 0x80; - pci_conf[0x69] = 0x02; - pci_conf[0x70] = 0x80; - pci_conf[0x76] = 0x0c; - pci_conf[0x77] = 0x0c; - pci_conf[0x78] = 0x02; - pci_conf[0x79] = 0x00; - pci_conf[0x80] = 0x00; - pci_conf[0x82] = 0x00; - pci_conf[0xa0] = 0x08; - pci_conf[0xa2] = 0x00; - pci_conf[0xa3] = 0x00; - pci_conf[0xa4] = 0x00; - pci_conf[0xa5] = 0x00; - pci_conf[0xa6] = 0x00; - pci_conf[0xa7] = 0x00; - pci_conf[0xa8] = 0x0f; - pci_conf[0xaa] = 0x00; - pci_conf[0xab] = 0x00; - pci_conf[0xac] = 0x00; - pci_conf[0xae] = 0x00; - - d->rcr = 0; -} - -static int piix4_post_load(void *opaque, int version_id) -{ - PIIX4State *s = opaque; - - if (version_id == 2) { - s->rcr = 0; - } - - return 0; -} - -static const VMStateDescription vmstate_piix4 = { - .name = "PIIX4", - .version_id = 3, - .minimum_version_id = 2, - .post_load = piix4_post_load, - .fields = (VMStateField[]) { - VMSTATE_PCI_DEVICE(dev, PIIX4State), - VMSTATE_UINT8_V(rcr, PIIX4State, 3), - VMSTATE_END_OF_LIST() - } -}; - -static void piix4_request_i8259_irq(void *opaque, int irq, int level) -{ - PIIX4State *s = opaque; - qemu_set_irq(s->cpu_intr, level); -} - -static void rcr_write(void *opaque, hwaddr addr, uint64_t val, - unsigned int len) -{ - PIIX4State *s = opaque; - - if (val & 4) { - qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); - return; - } - - s->rcr = val & 2; /* keep System Reset type only */ -} - -static uint64_t rcr_read(void *opaque, hwaddr addr, unsigned int len) -{ - PIIX4State *s = opaque; - - return s->rcr; -} - -static const MemoryRegionOps rcr_ops = { - .read = rcr_read, - .write = rcr_write, - .endianness = DEVICE_LITTLE_ENDIAN, - .impl = { - .min_access_size = 1, - .max_access_size = 1, - }, -}; - -static void piix4_realize(PCIDevice *dev, Error **errp) -{ - PIIX4State *s = PIIX4_PCI_DEVICE(dev); - PCIBus *pci_bus = pci_get_bus(dev); - ISABus *isa_bus; - qemu_irq *i8259_out_irq; - qemu_irq *i8259; - size_t i; - - isa_bus = isa_bus_new(DEVICE(dev), pci_address_space(dev), - pci_address_space_io(dev), errp); - if (!isa_bus) { - return; - } - - qdev_init_gpio_out_named(DEVICE(dev), &s->cpu_intr, - "intr", 1); - - memory_region_init_io(&s->rcr_mem, OBJECT(dev), &rcr_ops, s, - "reset-control", 1); - memory_region_add_subregion_overlap(pci_address_space_io(dev), - PIIX_RCR_IOPORT, &s->rcr_mem, 1); - - /* initialize i8259 pic */ - i8259_out_irq = qemu_allocate_irqs(piix4_request_i8259_irq, s, 1); - i8259 = i8259_init(isa_bus, *i8259_out_irq); - - for (i = 0; i < ISA_NUM_IRQS; i++) { - s->isa_irqs_in[i] = i8259[i]; - } - - g_free(i8259); - - /* initialize ISA irqs */ - isa_bus_register_input_irqs(isa_bus, s->isa_irqs_in); - - /* initialize pit */ - i8254_pit_init(isa_bus, 0x40, 0, NULL); - - /* DMA */ - i8257_dma_init(isa_bus, 0); - - /* RTC */ - qdev_prop_set_int32(DEVICE(&s->rtc), "base_year", 2000); - if (!qdev_realize(DEVICE(&s->rtc), BUS(isa_bus), errp)) { - return; - } - s->rtc.irq = isa_get_irq(ISA_DEVICE(&s->rtc), s->rtc.isairq); - - /* IDE */ - qdev_prop_set_int32(DEVICE(&s->ide), "addr", dev->devfn + 1); - if (!qdev_realize(DEVICE(&s->ide), BUS(pci_bus), errp)) { - return; - } - - /* USB */ - qdev_prop_set_int32(DEVICE(&s->uhci), "addr", dev->devfn + 2); - if (!qdev_realize(DEVICE(&s->uhci), BUS(pci_bus), errp)) { - return; - } - - /* ACPI controller */ - qdev_prop_set_int32(DEVICE(&s->pm), "addr", dev->devfn + 3); - if (!qdev_realize(DEVICE(&s->pm), BUS(pci_bus), errp)) { - return; - } - qdev_connect_gpio_out(DEVICE(&s->pm), 0, s->isa_irqs_in[9]); - - pci_bus_irqs(pci_bus, piix4_set_irq, s, PIIX_NUM_PIRQS); -} - -static void piix4_init(Object *obj) -{ - PIIX4State *s = PIIX4_PCI_DEVICE(obj); - - object_initialize_child(obj, "rtc", &s->rtc, TYPE_MC146818_RTC); - object_initialize_child(obj, "ide", &s->ide, TYPE_PIIX4_IDE); - object_initialize_child(obj, "uhci", &s->uhci, TYPE_PIIX4_USB_UHCI); - - object_initialize_child(obj, "pm", &s->pm, TYPE_PIIX4_PM); - qdev_prop_set_uint32(DEVICE(&s->pm), "smb_io_base", 0x1100); - qdev_prop_set_bit(DEVICE(&s->pm), "smm-enabled", 0); -} - -static void piix4_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc = DEVICE_CLASS(klass); - PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - - k->realize = piix4_realize; - k->vendor_id = PCI_VENDOR_ID_INTEL; - k->device_id = PCI_DEVICE_ID_INTEL_82371AB_0; - k->class_id = PCI_CLASS_BRIDGE_ISA; - dc->reset = piix4_isa_reset; - dc->desc = "ISA bridge"; - dc->vmsd = &vmstate_piix4; - /* - * Reason: part of PIIX4 southbridge, needs to be wired up, - * e.g. by mips_malta_init() - */ - dc->user_creatable = false; - dc->hotpluggable = false; -} - -static const TypeInfo piix4_info = { - .name = TYPE_PIIX4_PCI_DEVICE, - .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(PIIX4State), - .instance_init = piix4_init, - .class_init = piix4_class_init, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, - }, -}; - -static void piix4_register_types(void) -{ - type_register_static(&piix4_info); -} - -type_init(piix4_register_types) diff --git a/MAINTAINERS b/MAINTAINERS index 9bd4fe378d..d9fe5aa367 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1302,7 +1302,7 @@ Malta M: Philippe Mathieu-Daudé R: Aurelien Jarno S: Odd Fixes -F: hw/isa/piix4.c +F: hw/isa/piix.c F: hw/acpi/piix4.c F: hw/mips/malta.c F: hw/pci-host/gt64120.c @@ -1724,7 +1724,7 @@ F: hw/pci-host/pam.c F: include/hw/pci-host/i440fx.h F: include/hw/pci-host/q35.h F: include/hw/pci-host/pam.h -F: hw/isa/piix3.c +F: hw/isa/piix.c F: hw/isa/lpc_ich9.c F: hw/i2c/smbus_ich9.c F: hw/acpi/piix4.c @@ -2478,7 +2478,7 @@ PIIX4 South Bridge (i82371AB) M: Hervé Poussineau M: Philippe Mathieu-Daudé S: Maintained -F: hw/isa/piix4.c +F: hw/isa/piix.c F: include/hw/southbridge/piix.h Firmware configuration (fw_cfg) diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig index ade817f1b6..94772c726b 100644 --- a/hw/i386/Kconfig +++ b/hw/i386/Kconfig @@ -72,7 +72,7 @@ config I440FX select PC_PCI select PC_ACPI select PCI_I440FX - select PIIX3 + select PIIX select DIMM select SMBIOS select FW_CFG_DMA diff --git a/hw/isa/Kconfig b/hw/isa/Kconfig index 17ddb25afc..040a18c070 100644 --- a/hw/isa/Kconfig +++ b/hw/isa/Kconfig @@ -31,16 +31,7 @@ config PC87312 select FDC_ISA select IDE_ISA -config PIIX3 - bool - select ACPI_PIIX4 - select I8257 - select IDE_PIIX - select ISA_BUS - select MC146818RTC - select USB_UHCI - -config PIIX4 +config PIIX bool # For historical reasons, SuperIO devices are created in the board # for PIIX4. diff --git a/hw/isa/meson.build b/hw/isa/meson.build index b855e81276..2ab99ce0c6 100644 --- a/hw/isa/meson.build +++ b/hw/isa/meson.build @@ -3,8 +3,7 @@ system_ss.add(when: 'CONFIG_I82378', if_true: files('i82378.c')) system_ss.add(when: 'CONFIG_ISA_BUS', if_true: files('isa-bus.c')) system_ss.add(when: 'CONFIG_ISA_SUPERIO', if_true: files('isa-superio.c')) system_ss.add(when: 'CONFIG_PC87312', if_true: files('pc87312.c')) -system_ss.add(when: 'CONFIG_PIIX3', if_true: files('piix3.c')) -system_ss.add(when: 'CONFIG_PIIX4', if_true: files('piix4.c')) +system_ss.add(when: 'CONFIG_PIIX', if_true: files('piix.c')) system_ss.add(when: 'CONFIG_SMC37C669', if_true: files('smc37c669-superio.c')) system_ss.add(when: 'CONFIG_VT82C686', if_true: files('vt82c686.c')) diff --git a/hw/mips/Kconfig b/hw/mips/Kconfig index da3a37e215..ac1eb06a51 100644 --- a/hw/mips/Kconfig +++ b/hw/mips/Kconfig @@ -2,7 +2,7 @@ config MALTA bool select GT64120 select ISA_SUPERIO - select PIIX4 + select PIIX config MIPSSIM bool From patchwork Wed Oct 18 15:58:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851096 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HD99zhg5; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9csm3lBXz20Zj for ; Thu, 19 Oct 2023 04:14:52 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8xA-0001pI-RU; Wed, 18 Oct 2023 11:59:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8w4-0000OH-1c for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8w2-0007O3-D7 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644692; 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=Qe9cw8bUuCtqGm/AJ5pwVjkO/Ec49p8b0ZTEQUoDbXo=; b=HD99zhg5Q6JrkLBOOtK8NAOtAe3iw1NGiDYmz5tDGykYjdehyhEcZRwAMDM5dfIvl0kPwq hmUIeWcPnSBkaRFONHMHxZF6Suj0egPmx7V09MWY1As1CNlB86UkOHa+1m07LfwauHc9HH YfD11QwO1CNuKDN6IrAe77hldJQV6Lc= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-629-i8rNFe3UOhiSYnyQikk6jw-1; Wed, 18 Oct 2023 11:58:11 -0400 X-MC-Unique: i8rNFe3UOhiSYnyQikk6jw-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4084001846eso3587245e9.1 for ; Wed, 18 Oct 2023 08:58:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644688; x=1698249488; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Qe9cw8bUuCtqGm/AJ5pwVjkO/Ec49p8b0ZTEQUoDbXo=; b=OC8cmnJStEgnX4iwWJF7zgVcxMHL4sDptAxFl/qhhsarLIvWpoeSIwzctmX3XbQBIg Jen8x4XxWl3QxTfKKgfKT7r+er6HM2kNa1+hl2aREEbvSoHvwDbxo6kyX0JrgZK2UV9M nfSF4vOFdTI3hZY3iyeG0Js3OHb/kL178EgMKFdQ7yhHJ6IBeWkpHuKhamV4d5bSx0CA lV9r0EBk38t2Uu2MrClnOY6NW63XxYs5JeICWj0zWxlEEO0ai1mM6WCBXmeMHLUEh7JL gC8P8hVVDDke/54WI44ezR3f3+IKKflOI24rcp72J8UYeqSKVBmOazUZD4Z2ExTolOzq CTKw== X-Gm-Message-State: AOJu0Yy0F1KEexfcREUY4OEuOzJ5vEQoUyX9txWc6wuiIWbKv89l4i5P IA7iiCC67K+2QR8C75Fyq+HzBJa7JShJQE6Zkd9dMmdEnEEaoC5L/h1gBZUDUYqcIos61D17ZI/ dhVHsbLKYKIPWmLkDg6ioDTyiKkh3HvRRk7+jSfKMxphOWlyuOvgLDkZeW5LmDvgV8byGy+w= X-Received: by 2002:a05:600c:1c26:b0:407:5b7c:2f6a with SMTP id j38-20020a05600c1c2600b004075b7c2f6amr4392058wms.0.1697644688686; Wed, 18 Oct 2023 08:58:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEyk0T0gV4WNQ8ThxlQwSBRJOOsPasWHsf8uwWOsgsy8gEdcYpXjzkNn3F7SssvdlpqnhphQw== X-Received: by 2002:a05:600c:1c26:b0:407:5b7c:2f6a with SMTP id j38-20020a05600c1c2600b004075b7c2f6amr4392040wms.0.1697644688433; Wed, 18 Oct 2023 08:58:08 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id v18-20020a05600c445200b004063c9f68f2sm2025466wmn.26.2023.10.18.08.58.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:58:07 -0700 (PDT) Date: Wed, 18 Oct 2023 11:58:03 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost , =?utf-8?b?SGVydsOp?= Poussineau , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Aurelien Jarno Subject: [PULL 62/83] hw/isa/piix: Allow for optional PIC creation in PIIX3 Message-ID: <051f087d67fb7cede89f091501187f773a99cd99.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow In the PC machine, the PIC is created in board code to allow it to be virtualized with various virtualization techniques. So explicitly disable its creation in the PC machine via a property which defaults to enabled. Once the PIIX implementations are consolidated this default will keep Malta working without further ado. Signed-off-by: Bernhard Beschow Message-Id: <20231007123843.127151-21-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/southbridge/piix.h | 1 + hw/i386/pc_piix.c | 2 ++ hw/isa/piix.c | 21 +++++++++++++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index dd5f7b31c0..08491693b4 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -69,6 +69,7 @@ struct PIIXState { MemoryRegion rcr_mem; bool has_acpi; + bool has_pic; bool has_usb; bool smm_enabled; }; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 70cffcfe4f..fa39afd891 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -268,6 +268,8 @@ static void pc_init1(MachineState *machine, object_property_set_bool(OBJECT(pci_dev), "has-acpi", x86_machine_is_acpi_enabled(x86ms), &error_abort); + object_property_set_bool(OBJECT(pci_dev), "has-pic", false, + &error_abort); qdev_prop_set_uint32(DEVICE(pci_dev), "smb_io_base", 0xb100); object_property_set_bool(OBJECT(pci_dev), "smm-enabled", x86_machine_is_smm_enabled(x86ms), diff --git a/hw/isa/piix.c b/hw/isa/piix.c index f6da334c6f..d6d9ac6473 100644 --- a/hw/isa/piix.c +++ b/hw/isa/piix.c @@ -106,7 +106,7 @@ static void piix4_set_irq(void *opaque, int irq_num, int level) } } -static void piix4_request_i8259_irq(void *opaque, int irq, int level) +static void piix_request_i8259_irq(void *opaque, int irq, int level) { PIIX4State *s = opaque; qemu_set_irq(s->cpu_intr, level); @@ -343,6 +343,22 @@ static void pci_piix3_realize(PCIDevice *dev, Error **errp) memory_region_add_subregion_overlap(pci_address_space_io(dev), PIIX_RCR_IOPORT, &d->rcr_mem, 1); + /* PIC */ + if (d->has_pic) { + qemu_irq *i8259_out_irq = qemu_allocate_irqs(piix_request_i8259_irq, d, + 1); + qemu_irq *i8259 = i8259_init(isa_bus, *i8259_out_irq); + size_t i; + + for (i = 0; i < ISA_NUM_IRQS; i++) { + d->isa_irqs_in[i] = i8259[i]; + } + + g_free(i8259); + + qdev_init_gpio_out_named(DEVICE(dev), &d->cpu_intr, "intr", 1); + } + isa_bus_register_input_irqs(isa_bus, d->isa_irqs_in); i8257_dma_init(isa_bus, 0); @@ -419,6 +435,7 @@ static void pci_piix3_init(Object *obj) static Property pci_piix3_props[] = { DEFINE_PROP_UINT32("smb_io_base", PIIXState, smb_io_base, 0), DEFINE_PROP_BOOL("has-acpi", PIIXState, has_acpi, true), + DEFINE_PROP_BOOL("has-pic", PIIXState, has_pic, true), DEFINE_PROP_BOOL("has-usb", PIIXState, has_usb, true), DEFINE_PROP_BOOL("smm-enabled", PIIXState, smm_enabled, false), DEFINE_PROP_END_OF_LIST(), @@ -514,7 +531,7 @@ static void piix4_realize(PCIDevice *dev, Error **errp) PIIX_RCR_IOPORT, &s->rcr_mem, 1); /* initialize i8259 pic */ - i8259_out_irq = qemu_allocate_irqs(piix4_request_i8259_irq, s, 1); + i8259_out_irq = qemu_allocate_irqs(piix_request_i8259_irq, s, 1); i8259 = i8259_init(isa_bus, *i8259_out_irq); for (i = 0; i < ISA_NUM_IRQS; i++) { From patchwork Wed Oct 18 15:58:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851092 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ixUKBSt5; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9cq63hHTz20Zj for ; Thu, 19 Oct 2023 04:12:34 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8wh-0001EH-9k; Wed, 18 Oct 2023 11:58:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8w8-0000Xw-MA for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8w6-0007ON-OV for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644697; 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=lH1AqdjPXgfR1Memi78dfyy1TzArPQZzj3BdRAkG12A=; b=ixUKBSt5YFpWUKQmUvuYw6ezee/8rURWCMzRxBPS7iat5F4oPconBXD0oEzYKn2fRYMxl6 64zr1gJVw0oI2i+ewxkU9nyvlqj3GPNt5rvaEQJ3W7dl0XJDqTUgKSu+z1xDDciqH5mk3z lNTrmQ65xnXna5VMgUYuW9Oo35eyk4g= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-263-AQ99QkY2OQCSBfE1sYf2gA-1; Wed, 18 Oct 2023 11:58:15 -0400 X-MC-Unique: AQ99QkY2OQCSBfE1sYf2gA-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4074cdf2566so35123125e9.1 for ; Wed, 18 Oct 2023 08:58:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644694; x=1698249494; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=lH1AqdjPXgfR1Memi78dfyy1TzArPQZzj3BdRAkG12A=; b=xJWt5NUy0zTIiOxzEdvhvcgLbo8qVJVgCuWOQRhUvekgL2fEp0N3OYhuESwy02l/IK +/tiI0r7BTy0vifE3rjfpJ+s75hxtfAGsiikTZA6yXZbxUT24cqMzlZ6HpYaCZHGArgt 7mVDvEMfd6dZIPXAABo/CrBmF03B0RV+7c+nnMXENjC9pSGu5rx/Jg6z6SYuBBpN50tO DW/AC6b7akiEPLzOHucu84foZ/UamHinvQLk/MVFB/xzt+e7nmA02Nu6ki/za1mSGjIt Vv3r2JUggjS7MZRe/2hmwtcSEoj75ICbsxGXEUNRmxRM8tX867h7SiU48Ap5pWcMofOD XqLw== X-Gm-Message-State: AOJu0YxuIoCP1o6w0kQv61MKXq/687IgFFZWa9maHH5FBHMfpCQA7HSo cgZZm7zycDmdZiSc3I0gy2T/rG05EH9Bctlm0gjWiXeRaFzYUa0ILABRO2dGM/jGZlwi2xC3kfb 9JeOxjOOhSc+YisS0hsOmlhPvBUhwZObUtAHvzyd1zeGk0fEEV/730y5zvChfsZngXpDF9ZE= X-Received: by 2002:a05:600c:1d26:b0:407:5de2:ea4d with SMTP id l38-20020a05600c1d2600b004075de2ea4dmr5105135wms.13.1697644694123; Wed, 18 Oct 2023 08:58:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHhqMvPWK74jLPKgfXn6rsH8oZZKxJYpNAvwLJIUaBm4yZfVBzGatHkKUDGiGqfOF3j/BqoiA== X-Received: by 2002:a05:600c:1d26:b0:407:5de2:ea4d with SMTP id l38-20020a05600c1d2600b004075de2ea4dmr5105103wms.13.1697644693639; Wed, 18 Oct 2023 08:58:13 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id o36-20020a05600c512400b00405959469afsm2034151wms.3.2023.10.18.08.58.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:58:13 -0700 (PDT) Date: Wed, 18 Oct 2023 11:58:08 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?b?SGVydsOp?= Poussineau , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Aurelien Jarno Subject: [PULL 63/83] hw/isa/piix: Allow for optional PIT creation in PIIX3 Message-ID: <9a43333153a589e122b185aee78971024d437ea0.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow In the PC machine, the PIT is created in board code to allow it to be virtualized with various virtualization techniques. So explicitly disable its creation in the PC machine via a property which defaults to enabled. Once the PIIX implementations are consolidated this default will keep Malta working without further ado. Signed-off-by: Bernhard Beschow Message-Id: <20231007123843.127151-22-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/southbridge/piix.h | 1 + hw/i386/pc_piix.c | 2 ++ hw/isa/piix.c | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index 08491693b4..86709ba2e4 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -70,6 +70,7 @@ struct PIIXState { bool has_acpi; bool has_pic; + bool has_pit; bool has_usb; bool smm_enabled; }; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index fa39afd891..e38942a3c3 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -270,6 +270,8 @@ static void pc_init1(MachineState *machine, &error_abort); object_property_set_bool(OBJECT(pci_dev), "has-pic", false, &error_abort); + object_property_set_bool(OBJECT(pci_dev), "has-pit", false, + &error_abort); qdev_prop_set_uint32(DEVICE(pci_dev), "smb_io_base", 0xb100); object_property_set_bool(OBJECT(pci_dev), "smm-enabled", x86_machine_is_smm_enabled(x86ms), diff --git a/hw/isa/piix.c b/hw/isa/piix.c index d6d9ac6473..270b8eb1f7 100644 --- a/hw/isa/piix.c +++ b/hw/isa/piix.c @@ -361,6 +361,11 @@ static void pci_piix3_realize(PCIDevice *dev, Error **errp) isa_bus_register_input_irqs(isa_bus, d->isa_irqs_in); + /* PIT */ + if (d->has_pit) { + i8254_pit_init(isa_bus, 0x40, 0, NULL); + } + i8257_dma_init(isa_bus, 0); /* RTC */ @@ -436,6 +441,7 @@ static Property pci_piix3_props[] = { DEFINE_PROP_UINT32("smb_io_base", PIIXState, smb_io_base, 0), DEFINE_PROP_BOOL("has-acpi", PIIXState, has_acpi, true), DEFINE_PROP_BOOL("has-pic", PIIXState, has_pic, true), + DEFINE_PROP_BOOL("has-pit", PIIXState, has_pit, true), DEFINE_PROP_BOOL("has-usb", PIIXState, has_usb, true), DEFINE_PROP_BOOL("smm-enabled", PIIXState, smm_enabled, false), DEFINE_PROP_END_OF_LIST(), From patchwork Wed Oct 18 15:58:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851090 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=DgnXKSq8; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9cpC3YFzz20Zj for ; Thu, 19 Oct 2023 04:11:47 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8wm-0001KS-NC; Wed, 18 Oct 2023 11:59:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8wI-0000nF-Qm for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8wG-0007QF-7p for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644707; 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=f/7Z3H+51oJIJWzVgGhiU5HVqcfMDnbILXmSBJdNG3g=; b=DgnXKSq8u6hL+4lUMdy1D3ghAKW96JU//gofuH0d1RlTw9WOdSuPczdavFSNzEIapJVi9h K/eltECVNkm5fpF9ZlLViJykWihnWt1kRrITXA2u7YHBbVB2n/Bfsnp5e4G2g4xAr+SSFX R7UsxTTO+Piw82i9Ulw9O63xKZPR/38= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-67-VLPQ2JWCOgi5NTkUghYXiw-1; Wed, 18 Oct 2023 11:58:20 -0400 X-MC-Unique: VLPQ2JWCOgi5NTkUghYXiw-1 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-507a3ae32beso4505380e87.2 for ; Wed, 18 Oct 2023 08:58:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644698; x=1698249498; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=f/7Z3H+51oJIJWzVgGhiU5HVqcfMDnbILXmSBJdNG3g=; b=HjGgEiapSm/8hlQC5NdeORiEyJynsy4eOie+o/TKEcOSy8fzknjV8beC+heJG3Y0fx KSiVFPXr/0PzUIdaDM8YuDsoFqQLwkZ7EDCj84fXgxtT1l4GP44VLUNgi9B5trPZV2qh O9OWvjXTxCplJmgShQ811evIoY5y1VOgmqx9xl97Oz6TzxrRKhEk24obJic7Knvdsvw5 kwr8pgF/TwRX4lQeUsbOww3JxXbA8b4MlbLjR4nEIOBHc+Gk/iJut9TP7/5+Kuq392PF VR4WKYlUJVFGxh+aHuJpklWbQB0KlomyYdeV4FaERLqVezYaQOXo4LmLtoi+crJnv0G0 v3YQ== X-Gm-Message-State: AOJu0YxGXF5rL6DON9/2tukW/Zg2/n1MFiH1fydNnJhDjDl1cP1mJHkZ ue08OzFd3XrK/x9hvAl/KNKKlLOgbe7bNbHX8Ad8/4N478Hs9n5HXfeDU0QBJnwQ3gGD92KAGxn h5QdSaWo5UqQwm579txfu//TkTNpRdepS10l0w9faauuCH8ZmKQc1bKSOa/zw5Odoc2F+jiU= X-Received: by 2002:a19:e041:0:b0:503:99d:5a97 with SMTP id g1-20020a19e041000000b00503099d5a97mr4494718lfj.20.1697644698695; Wed, 18 Oct 2023 08:58:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHm2UcGcTSLn4PwHqeyN+e0jMbyLHTT9BSNzW++LdJ+IfPRdrrpog7kAQF8I05DTP2Ly1WGdA== X-Received: by 2002:a19:e041:0:b0:503:99d:5a97 with SMTP id g1-20020a19e041000000b00503099d5a97mr4494701lfj.20.1697644698322; Wed, 18 Oct 2023 08:58:18 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id az15-20020a05600c600f00b00406447b798bsm2019928wmb.37.2023.10.18.08.58.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:58:17 -0700 (PDT) Date: Wed, 18 Oct 2023 11:58:13 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Aurelien Jarno , =?utf-8?b?SGVydsOp?= Poussineau , Marcel Apfelbaum Subject: [PULL 64/83] hw/isa/piix: Harmonize names of reset control memory regions Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow There is no need for having different names here. Having the same name further allows code to be shared between PIIX3 and PIIX4. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Michael S. Tsirkin Message-Id: <20231007123843.127151-23-shentey@gmail.com> Signed-off-by: Michael S. Tsirkin --- hw/isa/piix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/isa/piix.c b/hw/isa/piix.c index 270b8eb1f7..bd66fb7475 100644 --- a/hw/isa/piix.c +++ b/hw/isa/piix.c @@ -339,7 +339,7 @@ static void pci_piix3_realize(PCIDevice *dev, Error **errp) } memory_region_init_io(&d->rcr_mem, OBJECT(dev), &rcr_ops, d, - "piix3-reset-control", 1); + "piix-reset-control", 1); memory_region_add_subregion_overlap(pci_address_space_io(dev), PIIX_RCR_IOPORT, &d->rcr_mem, 1); @@ -532,7 +532,7 @@ static void piix4_realize(PCIDevice *dev, Error **errp) "intr", 1); memory_region_init_io(&s->rcr_mem, OBJECT(dev), &rcr_ops, s, - "reset-control", 1); + "piix-reset-control", 1); memory_region_add_subregion_overlap(pci_address_space_io(dev), PIIX_RCR_IOPORT, &s->rcr_mem, 1); From patchwork Wed Oct 18 15:58:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851088 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fbni68jq; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9cn14qYDz20Zj for ; Thu, 19 Oct 2023 04:10:45 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8x1-0001Yn-FS; Wed, 18 Oct 2023 11:59:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8wI-0000nG-SF for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8wG-0007QJ-Jz for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644707; 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=PPLQmXXxzBmAon2V0X2xj7Rza3f9PZpdzyLrBWWg/e4=; b=fbni68jq7Aa0xYuxBjQ+3ukqcZeaYpuLPHGWvsSP0O0deYtSjuFNWviVZmXrGlu9KA/kb9 trPp9E7Di2mX4qz3l+ySkVFfeCsXC+CM7o18P+71TlBrUW5SpvuhEZYcIkvrdCOal7kk4R vua0CrrU914E5mE8EXW3zeS0OHa9Igw= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-121-u0kUVv8WPsyTJxO9q_b7GQ-1; Wed, 18 Oct 2023 11:58:26 -0400 X-MC-Unique: u0kUVv8WPsyTJxO9q_b7GQ-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-406de77fb85so44717085e9.0 for ; Wed, 18 Oct 2023 08:58:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644704; x=1698249504; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=PPLQmXXxzBmAon2V0X2xj7Rza3f9PZpdzyLrBWWg/e4=; b=VLT4iaq/1WYFlZKWXUa8U533ZprEcf1Ul1fcE00ZkpN07WYq9W6zS5M1PSeg4RomHh ToQoXluHTvwLriOhOHQznAAgpfbiFX6VNQ6IT2oS7bXK8F343dyfBlvPo4HULu5c4Ivb xFmwi7XI6Z70PaSLJcziSC/xpOEjqIBqGdI3mSXGNVyMaZT7kSvnzS/+e6LwN/9+KEAn ytxKQXcmsla0GlSh74Y3etFlnCD503ShGIYwBMYuftwKyk/K8hNs8D0l84kG1c6Gm70V NcJZ3uguHyWqAwqnKgElz0Mf9gt7DVToUut841w29E9AeBO8hW+YMGWPGf6/aAdfhOfo LM7w== X-Gm-Message-State: AOJu0YxIgfGhtjvrtokwVFlZO8MUJ+9vCQOlQYl9M5kmMbN3Yih4Vl52 9AxK7+1G0WnbRsKpyxv2fQSkdc2Wliaw4bpEPXF1Bdsq4TJ3hFfYw1QMvGCraDJ8seHqXMQjgPW jOGwAc3C1ZYr2C2lTZdGzPPPcx0KklyoaG/oL8dUQdnfH3y8LfZYOZw2UlZ6bWBIMr0KMUpw= X-Received: by 2002:a05:600c:19cc:b0:408:41e7:96ea with SMTP id u12-20020a05600c19cc00b0040841e796eamr506370wmq.31.1697644704384; Wed, 18 Oct 2023 08:58:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFCTgU10MKtkgsXnc48adbiH+Yvo7soLEuoLU13e3EMkDSSS1Xi8aokSZCLVyPvKy6Uhvjfuw== X-Received: by 2002:a05:600c:19cc:b0:408:41e7:96ea with SMTP id u12-20020a05600c19cc00b0040841e796eamr506352wmq.31.1697644703992; Wed, 18 Oct 2023 08:58:23 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id d14-20020a056000114e00b003232380ffd5sm2367853wrx.106.2023.10.18.08.58.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:58:23 -0700 (PDT) Date: Wed, 18 Oct 2023 11:58:18 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Aurelien Jarno , =?utf-8?b?SGVydsOp?= Poussineau , Marcel Apfelbaum Subject: [PULL 65/83] hw/isa/piix: Share PIIX3's base class with PIIX4 Message-ID: <1c976935844adb2b940ec5973a5e2d5ee0465845.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow Having a common base class will allow for futher code sharing between PIIX3 and PIIX4. Moreover, it makes PIIX4 implement the acpi-dev-aml-interface. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin Message-Id: <20231007123843.127151-24-shentey@gmail.com> Signed-off-by: Michael S. Tsirkin --- hw/isa/piix.c | 85 ++++++++++++++++++--------------------------------- 1 file changed, 30 insertions(+), 55 deletions(-) diff --git a/hw/isa/piix.c b/hw/isa/piix.c index bd66fb7475..8f7d6c56a8 100644 --- a/hw/isa/piix.c +++ b/hw/isa/piix.c @@ -38,10 +38,6 @@ #include "migration/vmstate.h" #include "hw/acpi/acpi_aml_interface.h" -typedef struct PIIXState PIIX4State; - -DECLARE_INSTANCE_CHECKER(PIIX4State, PIIX4_PCI_DEVICE, TYPE_PIIX4_PCI_DEVICE) - static void piix3_set_irq_pic(PIIXState *piix3, int pic_irq) { qemu_set_irq(piix3->isa_irqs_in[pic_irq], @@ -88,7 +84,7 @@ static void piix3_set_irq(void *opaque, int pirq, int level) static void piix4_set_irq(void *opaque, int irq_num, int level) { int i, pic_irq, pic_level; - PIIX4State *s = opaque; + PIIXState *s = opaque; PCIBus *bus = pci_get_bus(&s->dev); /* now we change the pic irq level according to the piix irq mappings */ @@ -108,7 +104,7 @@ static void piix4_set_irq(void *opaque, int irq_num, int level) static void piix_request_i8259_irq(void *opaque, int irq, int level) { - PIIX4State *s = opaque; + PIIXState *s = opaque; qemu_set_irq(s->cpu_intr, level); } @@ -156,8 +152,9 @@ static void piix3_write_config(PCIDevice *dev, } } -static void piix_reset(PIIXState *d) +static void piix_reset(DeviceState *dev) { + PIIXState *d = PIIX_PCI_DEVICE(dev); uint8_t *pci_conf = d->dev.config; pci_conf[0x04] = 0x07; /* master, memory and I/O */ @@ -196,13 +193,6 @@ static void piix_reset(PIIXState *d) d->rcr = 0; } -static void piix3_reset(DeviceState *dev) -{ - PIIXState *d = PIIX_PCI_DEVICE(dev); - - piix_reset(d); -} - static int piix3_post_load(void *opaque, int version_id) { PIIXState *piix3 = opaque; @@ -227,7 +217,7 @@ static int piix3_post_load(void *opaque, int version_id) static int piix4_post_load(void *opaque, int version_id) { - PIIX4State *s = opaque; + PIIXState *s = opaque; if (version_id == 2) { s->rcr = 0; @@ -291,8 +281,8 @@ static const VMStateDescription vmstate_piix4 = { .minimum_version_id = 2, .post_load = piix4_post_load, .fields = (VMStateField[]) { - VMSTATE_PCI_DEVICE(dev, PIIX4State), - VMSTATE_UINT8_V(rcr, PIIX4State, 3), + VMSTATE_PCI_DEVICE(dev, PIIXState), + VMSTATE_UINT8_V(rcr, PIIXState, 3), VMSTATE_END_OF_LIST() } }; @@ -426,7 +416,7 @@ static void build_pci_isa_aml(AcpiDevAmlIf *adev, Aml *scope) qbus_build_aml(bus, scope); } -static void pci_piix3_init(Object *obj) +static void pci_piix_init(Object *obj) { PIIXState *d = PIIX_PCI_DEVICE(obj); @@ -434,7 +424,6 @@ static void pci_piix3_init(Object *obj) ISA_NUM_IRQS); object_initialize_child(obj, "rtc", &d->rtc, TYPE_MC146818_RTC); - object_initialize_child(obj, "ide", &d->ide, TYPE_PIIX3_IDE); } static Property pci_piix3_props[] = { @@ -447,27 +436,22 @@ static Property pci_piix3_props[] = { DEFINE_PROP_END_OF_LIST(), }; -static void pci_piix3_class_init(ObjectClass *klass, void *data) +static void pci_piix_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); AcpiDevAmlIfClass *adevc = ACPI_DEV_AML_IF_CLASS(klass); - k->config_write = piix3_write_config; - dc->reset = piix3_reset; + dc->reset = piix_reset; dc->desc = "ISA bridge"; - dc->vmsd = &vmstate_piix3; dc->hotpluggable = false; k->vendor_id = PCI_VENDOR_ID_INTEL; - /* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */ - k->device_id = PCI_DEVICE_ID_INTEL_82371SB_0; k->class_id = PCI_CLASS_BRIDGE_ISA; /* - * Reason: part of PIIX3 southbridge, needs to be wired up by + * Reason: part of PIIX southbridge, needs to be wired up by e.g. * pc_piix.c's pc_init1() */ dc->user_creatable = false; - device_class_set_props(dc, pci_piix3_props); adevc->build_dev_aml = build_pci_isa_aml; } @@ -475,9 +459,9 @@ static const TypeInfo piix_pci_type_info = { .name = TYPE_PIIX_PCI_DEVICE, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(PIIXState), - .instance_init = pci_piix3_init, + .instance_init = pci_piix_init, .abstract = true, - .class_init = pci_piix3_class_init, + .class_init = pci_piix_class_init, .interfaces = (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, { TYPE_ACPI_DEV_AML_IF }, @@ -500,22 +484,36 @@ static void piix3_realize(PCIDevice *dev, Error **errp) pci_bus_set_route_irq_fn(pci_bus, piix3_route_intx_pin_to_irq); } +static void piix3_init(Object *obj) +{ + PIIXState *d = PIIX_PCI_DEVICE(obj); + + object_initialize_child(obj, "ide", &d->ide, TYPE_PIIX3_IDE); +} + static void piix3_class_init(ObjectClass *klass, void *data) { + DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); + k->config_write = piix3_write_config; k->realize = piix3_realize; + /* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */ + k->device_id = PCI_DEVICE_ID_INTEL_82371SB_0; + dc->vmsd = &vmstate_piix3; + device_class_set_props(dc, pci_piix3_props); } static const TypeInfo piix3_info = { .name = TYPE_PIIX3_DEVICE, .parent = TYPE_PIIX_PCI_DEVICE, + .instance_init = piix3_init, .class_init = piix3_class_init, }; static void piix4_realize(PCIDevice *dev, Error **errp) { - PIIX4State *s = PIIX4_PCI_DEVICE(dev); + PIIXState *s = PIIX_PCI_DEVICE(dev); PCIBus *pci_bus = pci_get_bus(dev); ISABus *isa_bus; qemu_irq *i8259_out_irq; @@ -584,18 +582,10 @@ static void piix4_realize(PCIDevice *dev, Error **errp) pci_bus_irqs(pci_bus, piix4_set_irq, s, PIIX_NUM_PIRQS); } -static void piix4_isa_reset(DeviceState *dev) -{ - PIIX4State *s = PIIX4_PCI_DEVICE(dev); - - piix_reset(s); -} - static void piix4_init(Object *obj) { - PIIX4State *s = PIIX4_PCI_DEVICE(obj); + PIIXState *s = PIIX_PCI_DEVICE(obj); - object_initialize_child(obj, "rtc", &s->rtc, TYPE_MC146818_RTC); object_initialize_child(obj, "ide", &s->ide, TYPE_PIIX4_IDE); object_initialize_child(obj, "uhci", &s->uhci, TYPE_PIIX4_USB_UHCI); @@ -610,30 +600,15 @@ static void piix4_class_init(ObjectClass *klass, void *data) PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); k->realize = piix4_realize; - k->vendor_id = PCI_VENDOR_ID_INTEL; k->device_id = PCI_DEVICE_ID_INTEL_82371AB_0; - k->class_id = PCI_CLASS_BRIDGE_ISA; - dc->reset = piix4_isa_reset; - dc->desc = "ISA bridge"; dc->vmsd = &vmstate_piix4; - /* - * Reason: part of PIIX4 southbridge, needs to be wired up, - * e.g. by mips_malta_init() - */ - dc->user_creatable = false; - dc->hotpluggable = false; } static const TypeInfo piix4_info = { .name = TYPE_PIIX4_PCI_DEVICE, - .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(PIIX4State), + .parent = TYPE_PIIX_PCI_DEVICE, .instance_init = piix4_init, .class_init = piix4_class_init, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, - }, }; static void piix3_register_types(void) From patchwork Wed Oct 18 15:58:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851074 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ivt5t3Xs; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9cfW60Cdz20Pd for ; Thu, 19 Oct 2023 04:05:07 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8ww-0001Pt-Su; Wed, 18 Oct 2023 11:59:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8wM-0000o3-D8 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8wK-0007Qf-Gq for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644711; 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=foQRLMQjVYT5y42wZUNoNj1yclA5wnMQdFvFQOR/qu8=; b=ivt5t3XsBIVhFBKan/i4E98sGVjFz2IzeqH238Lwbta1URa1STSYmBv9K2JZGbH8QicZdK J6CpBp8trTwH7SSIgVdUmrgfJgiZMZ0jFK/r7a966zez/qm87n6rAL2LCTNsbrTCTMpMPA utzxw+Cd2A3DaoQ8Ps7yfpk+/jzRmCs= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-569-c6UZlwilOC23NB-r8291rQ-1; Wed, 18 Oct 2023 11:58:30 -0400 X-MC-Unique: c6UZlwilOC23NB-r8291rQ-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4065d52a83aso44825115e9.1 for ; Wed, 18 Oct 2023 08:58:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644708; x=1698249508; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=foQRLMQjVYT5y42wZUNoNj1yclA5wnMQdFvFQOR/qu8=; b=cbGHqulOaZOl+VVJ+sihPNpgllmhqP1tQGUdUvU5Wjv4B1On8gc+Nb6xNFErPu9Sai /5fC77YeNG87Ga6YIKq71Cd6WPhjwnL29kitbxMSH/lVwpJyZXWqxddqb2MCmDtcM8jB j46nuyK7EE6Xkdk7VWhyDNuxMUypQBHMSORCuRJAtwhZjdoVesheHj1ZnQQwMuXeujce 2m+SJwLL97B2PL1Q7DvTu6EKalEnbltpIWG/+T2jNwHHeROVK548FHPZ5WYkC0OZ+JIz nDM+3bfSIZB5uMiq6w3sWp6jzYdih5mQLRbQB4SvBuMg69pFV3Dj5aKScoysZDuQMeLb Fmcg== X-Gm-Message-State: AOJu0YzYvyU1ZNFEKYfzChPYGAWjL7TnVXg5q21wXICRr2CdWu7BeX7o ECG9v0JfdMzhYKImB674vQqm16cOlIRVf1M8pU1w0VdhsDXEcrdy8+JePllUkT9JSt7v1Syqke9 1lb3znj+KSiUX4QKSDqddmDbO1CNyeiH5jd3B64zWU7oXuo7POQduzh8lajzgNWj1TubPMdc= X-Received: by 2002:a05:600c:4754:b0:407:8f23:cf3 with SMTP id w20-20020a05600c475400b004078f230cf3mr4248593wmo.26.1697644708410; Wed, 18 Oct 2023 08:58:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEwGCj2rvgStBpwuXdOYWyauJqGrAkiOsM63EY27kPIpvU8jseJR/84lqVcDYtzRTb164E1PQ== X-Received: by 2002:a05:600c:4754:b0:407:8f23:cf3 with SMTP id w20-20020a05600c475400b004078f230cf3mr4248574wmo.26.1697644708078; Wed, 18 Oct 2023 08:58:28 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id n18-20020a05600c4f9200b004060f0a0fd5sm1996363wmq.13.2023.10.18.08.58.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:58:27 -0700 (PDT) Date: Wed, 18 Oct 2023 11:58:24 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Aurelien Jarno , =?utf-8?b?SGVydsOp?= Poussineau , Marcel Apfelbaum Subject: [PULL 66/83] hw/isa/piix: Reuse PIIX3 base class' realize method in PIIX4 Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow Resolves duplicate code. Also makes PIIX4 respect the PIIX3 properties which get added, too. This allows for using PIIX4 in the PC machine. Signed-off-by: Bernhard Beschow Message-Id: <20231007123843.127151-25-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/isa/piix.c | 80 ++++++------------------------------------------- hw/mips/malta.c | 5 ++-- 2 files changed, 12 insertions(+), 73 deletions(-) diff --git a/hw/isa/piix.c b/hw/isa/piix.c index 8f7d6c56a8..2ab799b95e 100644 --- a/hw/isa/piix.c +++ b/hw/isa/piix.c @@ -315,7 +315,8 @@ static const MemoryRegionOps rcr_ops = { }, }; -static void pci_piix3_realize(PCIDevice *dev, Error **errp) +static void pci_piix_realize(PCIDevice *dev, const char *uhci_type, + Error **errp) { PIIXState *d = PIIX_PCI_DEVICE(dev); PCIBus *pci_bus = pci_get_bus(dev); @@ -374,8 +375,7 @@ static void pci_piix3_realize(PCIDevice *dev, Error **errp) /* USB */ if (d->has_usb) { - object_initialize_child(OBJECT(dev), "uhci", &d->uhci, - TYPE_PIIX3_USB_UHCI); + object_initialize_child(OBJECT(dev), "uhci", &d->uhci, uhci_type); qdev_prop_set_int32(DEVICE(&d->uhci), "addr", dev->devfn + 2); if (!qdev_realize(DEVICE(&d->uhci), BUS(pci_bus), errp)) { return; @@ -426,7 +426,7 @@ static void pci_piix_init(Object *obj) object_initialize_child(obj, "rtc", &d->rtc, TYPE_MC146818_RTC); } -static Property pci_piix3_props[] = { +static Property pci_piix_props[] = { DEFINE_PROP_UINT32("smb_io_base", PIIXState, smb_io_base, 0), DEFINE_PROP_BOOL("has-acpi", PIIXState, has_acpi, true), DEFINE_PROP_BOOL("has-pic", PIIXState, has_pic, true), @@ -452,6 +452,7 @@ static void pci_piix_class_init(ObjectClass *klass, void *data) * pc_piix.c's pc_init1() */ dc->user_creatable = false; + device_class_set_props(dc, pci_piix_props); adevc->build_dev_aml = build_pci_isa_aml; } @@ -475,7 +476,7 @@ static void piix3_realize(PCIDevice *dev, Error **errp) PIIXState *piix3 = PIIX_PCI_DEVICE(dev); PCIBus *pci_bus = pci_get_bus(dev); - pci_piix3_realize(dev, errp); + pci_piix_realize(dev, TYPE_PIIX3_USB_UHCI, errp); if (*errp) { return; } @@ -501,7 +502,6 @@ static void piix3_class_init(ObjectClass *klass, void *data) /* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */ k->device_id = PCI_DEVICE_ID_INTEL_82371SB_0; dc->vmsd = &vmstate_piix3; - device_class_set_props(dc, pci_piix3_props); } static const TypeInfo piix3_info = { @@ -513,72 +513,15 @@ static const TypeInfo piix3_info = { static void piix4_realize(PCIDevice *dev, Error **errp) { + ERRP_GUARD(); PIIXState *s = PIIX_PCI_DEVICE(dev); PCIBus *pci_bus = pci_get_bus(dev); - ISABus *isa_bus; - qemu_irq *i8259_out_irq; - qemu_irq *i8259; - size_t i; - isa_bus = isa_bus_new(DEVICE(dev), pci_address_space(dev), - pci_address_space_io(dev), errp); - if (!isa_bus) { + pci_piix_realize(dev, TYPE_PIIX4_USB_UHCI, errp); + if (*errp) { return; } - qdev_init_gpio_out_named(DEVICE(dev), &s->cpu_intr, - "intr", 1); - - memory_region_init_io(&s->rcr_mem, OBJECT(dev), &rcr_ops, s, - "piix-reset-control", 1); - memory_region_add_subregion_overlap(pci_address_space_io(dev), - PIIX_RCR_IOPORT, &s->rcr_mem, 1); - - /* initialize i8259 pic */ - i8259_out_irq = qemu_allocate_irqs(piix_request_i8259_irq, s, 1); - i8259 = i8259_init(isa_bus, *i8259_out_irq); - - for (i = 0; i < ISA_NUM_IRQS; i++) { - s->isa_irqs_in[i] = i8259[i]; - } - - g_free(i8259); - - /* initialize ISA irqs */ - isa_bus_register_input_irqs(isa_bus, s->isa_irqs_in); - - /* initialize pit */ - i8254_pit_init(isa_bus, 0x40, 0, NULL); - - /* DMA */ - i8257_dma_init(isa_bus, 0); - - /* RTC */ - qdev_prop_set_int32(DEVICE(&s->rtc), "base_year", 2000); - if (!qdev_realize(DEVICE(&s->rtc), BUS(isa_bus), errp)) { - return; - } - s->rtc.irq = isa_get_irq(ISA_DEVICE(&s->rtc), s->rtc.isairq); - - /* IDE */ - qdev_prop_set_int32(DEVICE(&s->ide), "addr", dev->devfn + 1); - if (!qdev_realize(DEVICE(&s->ide), BUS(pci_bus), errp)) { - return; - } - - /* USB */ - qdev_prop_set_int32(DEVICE(&s->uhci), "addr", dev->devfn + 2); - if (!qdev_realize(DEVICE(&s->uhci), BUS(pci_bus), errp)) { - return; - } - - /* ACPI controller */ - qdev_prop_set_int32(DEVICE(&s->pm), "addr", dev->devfn + 3); - if (!qdev_realize(DEVICE(&s->pm), BUS(pci_bus), errp)) { - return; - } - qdev_connect_gpio_out(DEVICE(&s->pm), 0, s->isa_irqs_in[9]); - pci_bus_irqs(pci_bus, piix4_set_irq, s, PIIX_NUM_PIRQS); } @@ -587,11 +530,6 @@ static void piix4_init(Object *obj) PIIXState *s = PIIX_PCI_DEVICE(obj); object_initialize_child(obj, "ide", &s->ide, TYPE_PIIX4_IDE); - object_initialize_child(obj, "uhci", &s->uhci, TYPE_PIIX4_USB_UHCI); - - object_initialize_child(obj, "pm", &s->pm, TYPE_PIIX4_PM); - qdev_prop_set_uint32(DEVICE(&s->pm), "smb_io_base", 0x1100); - qdev_prop_set_bit(DEVICE(&s->pm), "smm-enabled", 0); } static void piix4_class_init(ObjectClass *klass, void *data) diff --git a/hw/mips/malta.c b/hw/mips/malta.c index dac27fad9d..155f3c1cc8 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -1238,8 +1238,9 @@ void mips_malta_init(MachineState *machine) pci_bus_map_irqs(pci_bus, malta_pci_slot_get_pirq); /* Southbridge */ - piix4 = pci_create_simple_multifunction(pci_bus, PIIX4_PCI_DEVFN, - TYPE_PIIX4_PCI_DEVICE); + piix4 = pci_new_multifunction(PIIX4_PCI_DEVFN, TYPE_PIIX4_PCI_DEVICE); + qdev_prop_set_uint32(DEVICE(piix4), "smb_io_base", 0x1100); + pci_realize_and_unref(piix4, pci_bus, &error_fatal); isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix4), "isa.0")); dev = DEVICE(object_resolve_path_component(OBJECT(piix4), "ide")); From patchwork Wed Oct 18 15:58:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851091 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=SQz0KrkP; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9cpF45qKz20Zj for ; Thu, 19 Oct 2023 04:11:49 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8wm-0001JZ-Lm; Wed, 18 Oct 2023 11:59:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8wS-0000v4-5X for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8wP-0007Qw-9a for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644716; 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=pkIPSukbn4TdWmXR29nNf5zPEIsdHpMleShz6bahFgE=; b=SQz0KrkPXySTFHJ6nCuDXkN5JQjHJgjnv07l1rZbBI1GU9h0qx0hQSKLfdiKmHwLH4M8Qe GGv/ruGhmklJDE5LQk50Ol2V9pcroz8v47CtndjUt0gcoOSEFcheB6PDPu5F5Eq9+XrXDa L5JP7QSH/gDiHUx3oNqsBbFoenX7FhM= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-118-UqEsPSGsM1iQNFd-3nD8eg-1; Wed, 18 Oct 2023 11:58:35 -0400 X-MC-Unique: UqEsPSGsM1iQNFd-3nD8eg-1 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2c520e0a9a7so34453721fa.3 for ; Wed, 18 Oct 2023 08:58:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644713; x=1698249513; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=pkIPSukbn4TdWmXR29nNf5zPEIsdHpMleShz6bahFgE=; b=pEkzS9TtrF631rDg7tYESApcKq6v/jFxS9l6sLFfsJTIMLJroILIvvs582dzZo9+C/ rhErR4NFMEnQJKaNR6oJH3TKwKRCP/BilzEO1ZMxLN+KqEf1ARr8Q5RTizww06VF1hDg Hv9KpUOVqHxUOqjeCn8TzXILBrRKp2U2UPtNQuW86FTA9fGe1Uro2Derb4VKRy6aNCjR qab7mDD6S/IZMKhq8iQM8c44yc2XAZ8nV/9zsUihAzFjo9ldwOG+NLF0xTKsphalCVwS +xei4kazfjr2+w9x7/UTbqoZAdRZhnNvR73SJ1pnZKiM9Ake5C0hDOtzhpbLIQNoDBqp mf+A== X-Gm-Message-State: AOJu0YxCBljEwrx3HFDc0tIEo2zsxEhPcvkYlhqFWSLMQGld/LYAzYtN vhCz6p3KUbPk4UO4IVmzE/0r7ZxDZC+2JywUxP0cvViI3CZ1Dn+y9jOQ4HE64ynBqapaXiAVtrG 1gCnRgh1NCW0fz23Nac1yb+KghK7WTS0jM24tKFicpabrlSxDomy0a8uCYqpFA8rK1nFfYK4= X-Received: by 2002:a2e:b947:0:b0:2c5:1d9a:4dc1 with SMTP id 7-20020a2eb947000000b002c51d9a4dc1mr3661412ljs.5.1697644712855; Wed, 18 Oct 2023 08:58:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFDk/cbvZR/KH4ofghBr4bnrN+oC9nqeHHs97qv5WsIlYUFeEDnau5RjnUwLc6WfIv4Ekp1aQ== X-Received: by 2002:a2e:b947:0:b0:2c5:1d9a:4dc1 with SMTP id 7-20020a2eb947000000b002c51d9a4dc1mr3661394ljs.5.1697644712509; Wed, 18 Oct 2023 08:58:32 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id p21-20020a05600c431500b004076f522058sm2001741wme.0.2023.10.18.08.58.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:58:32 -0700 (PDT) Date: Wed, 18 Oct 2023 11:58:28 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , =?utf-8?b?SGVydsOp?= Poussineau , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Aurelien Jarno , Marcel Apfelbaum Subject: [PULL 67/83] hw/isa/piix: Rename functions to be shared for PCI interrupt triggering Message-ID: <698f428a3c024c4e2352d0efb2e96e3129b817c7.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow PIIX4 will get the same optimizations which are already implemented for PIIX3. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin Message-Id: <20231007123843.127151-26-shentey@gmail.com> Signed-off-by: Michael S. Tsirkin --- hw/isa/piix.c | 72 +++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/hw/isa/piix.c b/hw/isa/piix.c index 2ab799b95e..449c1baaab 100644 --- a/hw/isa/piix.c +++ b/hw/isa/piix.c @@ -38,47 +38,47 @@ #include "migration/vmstate.h" #include "hw/acpi/acpi_aml_interface.h" -static void piix3_set_irq_pic(PIIXState *piix3, int pic_irq) +static void piix_set_irq_pic(PIIXState *s, int pic_irq) { - qemu_set_irq(piix3->isa_irqs_in[pic_irq], - !!(piix3->pic_levels & + qemu_set_irq(s->isa_irqs_in[pic_irq], + !!(s->pic_levels & (((1ULL << PIIX_NUM_PIRQS) - 1) << (pic_irq * PIIX_NUM_PIRQS)))); } -static void piix3_set_irq_level_internal(PIIXState *piix3, int pirq, int level) +static void piix_set_pci_irq_level_internal(PIIXState *s, int pirq, int level) { int pic_irq; uint64_t mask; - pic_irq = piix3->dev.config[PIIX_PIRQCA + pirq]; + pic_irq = s->dev.config[PIIX_PIRQCA + pirq]; if (pic_irq >= ISA_NUM_IRQS) { return; } mask = 1ULL << ((pic_irq * PIIX_NUM_PIRQS) + pirq); - piix3->pic_levels &= ~mask; - piix3->pic_levels |= mask * !!level; + s->pic_levels &= ~mask; + s->pic_levels |= mask * !!level; } -static void piix3_set_irq_level(PIIXState *piix3, int pirq, int level) +static void piix_set_pci_irq_level(PIIXState *s, int pirq, int level) { int pic_irq; - pic_irq = piix3->dev.config[PIIX_PIRQCA + pirq]; + pic_irq = s->dev.config[PIIX_PIRQCA + pirq]; if (pic_irq >= ISA_NUM_IRQS) { return; } - piix3_set_irq_level_internal(piix3, pirq, level); + piix_set_pci_irq_level_internal(s, pirq, level); - piix3_set_irq_pic(piix3, pic_irq); + piix_set_irq_pic(s, pic_irq); } -static void piix3_set_irq(void *opaque, int pirq, int level) +static void piix_set_pci_irq(void *opaque, int pirq, int level) { - PIIXState *piix3 = opaque; - piix3_set_irq_level(piix3, pirq, level); + PIIXState *s = opaque; + piix_set_pci_irq_level(s, pirq, level); } static void piix4_set_irq(void *opaque, int irq_num, int level) @@ -108,10 +108,10 @@ static void piix_request_i8259_irq(void *opaque, int irq, int level) qemu_set_irq(s->cpu_intr, level); } -static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opaque, int pin) +static PCIINTxRoute piix_route_intx_pin_to_irq(void *opaque, int pin) { - PIIXState *piix3 = opaque; - int irq = piix3->dev.config[PIIX_PIRQCA + pin]; + PCIDevice *pci_dev = opaque; + int irq = pci_dev->config[PIIX_PIRQCA + pin]; PCIINTxRoute route; if (irq < ISA_NUM_IRQS) { @@ -125,29 +125,29 @@ static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opaque, int pin) } /* irq routing is changed. so rebuild bitmap */ -static void piix3_update_irq_levels(PIIXState *piix3) +static void piix_update_pci_irq_levels(PIIXState *s) { - PCIBus *bus = pci_get_bus(&piix3->dev); + PCIBus *bus = pci_get_bus(&s->dev); int pirq; - piix3->pic_levels = 0; + s->pic_levels = 0; for (pirq = 0; pirq < PIIX_NUM_PIRQS; pirq++) { - piix3_set_irq_level(piix3, pirq, pci_bus_get_irq_level(bus, pirq)); + piix_set_pci_irq_level(s, pirq, pci_bus_get_irq_level(bus, pirq)); } } -static void piix3_write_config(PCIDevice *dev, - uint32_t address, uint32_t val, int len) +static void piix_write_config(PCIDevice *dev, uint32_t address, uint32_t val, + int len) { pci_default_write_config(dev, address, val, len); if (ranges_overlap(address, len, PIIX_PIRQCA, 4)) { - PIIXState *piix3 = PIIX_PCI_DEVICE(dev); + PIIXState *s = PIIX_PCI_DEVICE(dev); int pic_irq; - pci_bus_fire_intx_routing_notifier(pci_get_bus(&piix3->dev)); - piix3_update_irq_levels(piix3); + pci_bus_fire_intx_routing_notifier(pci_get_bus(&s->dev)); + piix_update_pci_irq_levels(s); for (pic_irq = 0; pic_irq < ISA_NUM_IRQS; pic_irq++) { - piix3_set_irq_pic(piix3, pic_irq); + piix_set_irq_pic(s, pic_irq); } } } @@ -193,9 +193,9 @@ static void piix_reset(DeviceState *dev) d->rcr = 0; } -static int piix3_post_load(void *opaque, int version_id) +static int piix_post_load(void *opaque, int version_id) { - PIIXState *piix3 = opaque; + PIIXState *s = opaque; int pirq; /* @@ -207,10 +207,10 @@ static int piix3_post_load(void *opaque, int version_id) * Here, we update irq levels without raising the interrupt. * Interrupt state will be deserialized separately through the i8259. */ - piix3->pic_levels = 0; + s->pic_levels = 0; for (pirq = 0; pirq < PIIX_NUM_PIRQS; pirq++) { - piix3_set_irq_level_internal(piix3, pirq, - pci_bus_get_irq_level(pci_get_bus(&piix3->dev), pirq)); + piix_set_pci_irq_level_internal(s, pirq, + pci_bus_get_irq_level(pci_get_bus(&s->dev), pirq)); } return 0; } @@ -261,7 +261,7 @@ static const VMStateDescription vmstate_piix3 = { .name = "PIIX3", .version_id = 3, .minimum_version_id = 2, - .post_load = piix3_post_load, + .post_load = piix_post_load, .pre_save = piix3_pre_save, .fields = (VMStateField[]) { VMSTATE_PCI_DEVICE(dev, PIIXState), @@ -481,8 +481,8 @@ static void piix3_realize(PCIDevice *dev, Error **errp) return; } - pci_bus_irqs(pci_bus, piix3_set_irq, piix3, PIIX_NUM_PIRQS); - pci_bus_set_route_irq_fn(pci_bus, piix3_route_intx_pin_to_irq); + pci_bus_irqs(pci_bus, piix_set_pci_irq, piix3, PIIX_NUM_PIRQS); + pci_bus_set_route_irq_fn(pci_bus, piix_route_intx_pin_to_irq); } static void piix3_init(Object *obj) @@ -497,7 +497,7 @@ static void piix3_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - k->config_write = piix3_write_config; + k->config_write = piix_write_config; k->realize = piix3_realize; /* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */ k->device_id = PCI_DEVICE_ID_INTEL_82371SB_0; From patchwork Wed Oct 18 15:58:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851031 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=TgOuSGog; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bl3402pz20Pd for ; Thu, 19 Oct 2023 03:23:59 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8x0-0001XO-NS; Wed, 18 Oct 2023 11:59:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8wV-00010X-8D for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8wT-0007RN-H2 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644720; 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=fiCWXY5zmRdQNGyxHv3gzp1e9XV+cYxYi5n0fzse+pU=; b=TgOuSGogRzxDovkP9q0xLvcpA8bbbiSQvHXOMtNhF3OzkdKltfkh207H/yYwShHdWUWuIV 30CDpDl/EnbP7JAD9vUmn3uVuAoEPF/MNrLd4ao+3YS3SBNp6OO9oKpAqhJ0NimI7yDslm 6UqfgFtOIhz5aOyACg8bE2SX6c1fXC8= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-516-ZDeoNrVdNXSC7N2W2ax3Lw-1; Wed, 18 Oct 2023 11:58:39 -0400 X-MC-Unique: ZDeoNrVdNXSC7N2W2ax3Lw-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-32d9b520d15so2819848f8f.3 for ; Wed, 18 Oct 2023 08:58:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644717; x=1698249517; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fiCWXY5zmRdQNGyxHv3gzp1e9XV+cYxYi5n0fzse+pU=; b=GQHM78TaffZgih9SyJpnczmVoyy1yhsXbTCBCWRMy269qE8YSrddr7TTBUIZIgopph crdqertDOlEFfj4ntdpmRLxSs1cULYs/+qfwqvPqbUyt04oQORKGOmLX4UFyAw1FIOFP AirELzN6NrjeaFvdjplzPZFGRoY7KzYdjnhkTc+ZvRXFpeduhkVdFu9UThxd8pcevmAP pqmeJqqdz2dDGwqD9owFfvPhHvBk1TJsrM7dgEQ8PHKKldmjP0VLLrXqrRQV6eLc/Bhc GVDzAIoWrjS5yxsgaNmLm1EoRmo48BbFiyf62haNHwgDE9uxt9G0faoqJywScc/Npodz thTA== X-Gm-Message-State: AOJu0YzZjsPV+1Zjsw/Oivn36g1l0fKFJ2qW2blNvRNOt5NDLW7yuIh0 QrjyAcp8pubi/lAnZa8J+sA9Q9zBRbgS9r4BrjU6EONn36czzkryKWrKyzCJzluGMwl87IV5VpU J/njZuV1/3HbuWLz9FkpRqN/s5E+AjxVaGQEz2C++4Y0BZcA1LaNLXkgkbqo5QGAhMh4Fles= X-Received: by 2002:adf:f847:0:b0:32d:aabf:1db3 with SMTP id d7-20020adff847000000b0032daabf1db3mr4613982wrq.24.1697644717763; Wed, 18 Oct 2023 08:58:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG4gNQGeSOzSovDtRcMuO2O6Z98JJO62/LarZvDeApv5IeG1JsVk28S2bL8RCqejDMzbKb8NA== X-Received: by 2002:adf:f847:0:b0:32d:aabf:1db3 with SMTP id d7-20020adff847000000b0032daabf1db3mr4613961wrq.24.1697644717511; Wed, 18 Oct 2023 08:58:37 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id b16-20020a056000055000b00326f5d0ce0asm2440158wrf.21.2023.10.18.08.58.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:58:37 -0700 (PDT) Date: Wed, 18 Oct 2023 11:58:32 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Marcel Apfelbaum , Philippe =?utf-8?q?Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Aurelien Jarno , =?utf-8?b?SGVydsOp?= Poussineau Subject: [PULL 68/83] hw/isa/piix: Reuse PIIX3's PCI interrupt triggering in PIIX4 Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow Speeds up PIIX4 which resolves an old TODO. Also makes PIIX4 compatible with Xen which relies on pci_bus_fire_intx_routing_notifier() to be fired. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin Message-Id: <20231007123843.127151-27-shentey@gmail.com> Signed-off-by: Michael S. Tsirkin --- hw/isa/piix.c | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/hw/isa/piix.c b/hw/isa/piix.c index 449c1baaab..17677c2126 100644 --- a/hw/isa/piix.c +++ b/hw/isa/piix.c @@ -81,27 +81,6 @@ static void piix_set_pci_irq(void *opaque, int pirq, int level) piix_set_pci_irq_level(s, pirq, level); } -static void piix4_set_irq(void *opaque, int irq_num, int level) -{ - int i, pic_irq, pic_level; - PIIXState *s = opaque; - PCIBus *bus = pci_get_bus(&s->dev); - - /* now we change the pic irq level according to the piix irq mappings */ - /* XXX: optimize */ - pic_irq = s->dev.config[PIIX_PIRQCA + irq_num]; - if (pic_irq < ISA_NUM_IRQS) { - /* The pic level is the logical OR of all the PCI irqs mapped to it. */ - pic_level = 0; - for (i = 0; i < PIIX_NUM_PIRQS; i++) { - if (pic_irq == s->dev.config[PIIX_PIRQCA + i]) { - pic_level |= pci_bus_get_irq_level(bus, i); - } - } - qemu_set_irq(s->isa_irqs_in[pic_irq], pic_level); - } -} - static void piix_request_i8259_irq(void *opaque, int irq, int level) { PIIXState *s = opaque; @@ -223,7 +202,7 @@ static int piix4_post_load(void *opaque, int version_id) s->rcr = 0; } - return 0; + return piix_post_load(opaque, version_id); } static int piix3_pre_save(void *opaque) @@ -442,6 +421,7 @@ static void pci_piix_class_init(ObjectClass *klass, void *data) PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); AcpiDevAmlIfClass *adevc = ACPI_DEV_AML_IF_CLASS(klass); + k->config_write = piix_write_config; dc->reset = piix_reset; dc->desc = "ISA bridge"; dc->hotpluggable = false; @@ -497,7 +477,6 @@ static void piix3_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - k->config_write = piix_write_config; k->realize = piix3_realize; /* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */ k->device_id = PCI_DEVICE_ID_INTEL_82371SB_0; @@ -522,7 +501,7 @@ static void piix4_realize(PCIDevice *dev, Error **errp) return; } - pci_bus_irqs(pci_bus, piix4_set_irq, s, PIIX_NUM_PIRQS); + pci_bus_irqs(pci_bus, piix_set_pci_irq, s, PIIX_NUM_PIRQS); } static void piix4_init(Object *obj) From patchwork Wed Oct 18 15:58:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851081 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MRX9gjnl; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9cjH5RMNz20Pd for ; Thu, 19 Oct 2023 04:07:31 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8ww-0001PX-Mh; Wed, 18 Oct 2023 11:59:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8wg-0001DK-DO for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8we-0007Tj-ON for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644731; 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=XEKbyD70yRR+QPK/g+c3Uv20C9zzfiDuTxSKNieues8=; b=MRX9gjnlxzSnrgraJtp5Aml82JCSR1gaxsMUAfoSl4rcW8u99qgRmAYdvzo10OqOKdKhYB MouEa6Uu2YUm6k16soifHji/H77sVoXtVyNkGKn/NYomhgaNAVMhCQW8P7YOcDmERjgDtP frZg/7dOOWq5A6Z/P1SSj5FPZDvXoRo= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-395-JNZLvar3OlqKoLLwF6D3ag-1; Wed, 18 Oct 2023 11:58:44 -0400 X-MC-Unique: JNZLvar3OlqKoLLwF6D3ag-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3f42bcef2acso46863395e9.2 for ; Wed, 18 Oct 2023 08:58:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644722; x=1698249522; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=XEKbyD70yRR+QPK/g+c3Uv20C9zzfiDuTxSKNieues8=; b=H2LXzHn877MWzLbrhu/vbeqFGFb0A/NwBAB0p5ATKJBq6k3GPEyZo7T6yUeo3RtCO4 xX/1rzfCth98CNF6pQF8AZOBmJWrUaDoKVQ0730/1telosP+cRM/R3VCz4Ya6u57dOB4 +3eUBnnxlONokNzFK4Nn8BKdeFnp8FJTieisIv8fZDNCZ+zYrc8fR/OXUZCQ4RWuJq7T sQ7AdK0MiTchDGVRCtQEzkT0O2hl/Ry6V9wzISi7O6np/99s4/QwyDZE0kuKCV1EK+K9 /qpX7boD9SsbGJc/1/dw/zVmbyn1aiIO21jQLzEcVkrh+ZmEbMHfPr1O8MkyYdB/h1X9 0lVA== X-Gm-Message-State: AOJu0YzQXlfu4blhKkT9zEgRYeRIEPyq/EmZ+1ZN2NgdxXsYY2tIajyo Az8+4AEye0FmWBTnWCKK6II4U6dl4f5lNedDDfNzWQFLJUGW3SWQ5HDTs7td/zA/sXJknkIm0X/ JKezABf8Zbx5IXR4qkAtLYHNEjLgvzXxNgr8YToNoJCzVvDOaCFhXw7W5NveKKtjCFYCFIGE= X-Received: by 2002:a5d:510e:0:b0:32d:a0d9:2124 with SMTP id s14-20020a5d510e000000b0032da0d92124mr4216332wrt.35.1697644722709; Wed, 18 Oct 2023 08:58:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEv73jpTfjeQbiY9r37C5PWRnj33CUVtf1dqOS5J/5BP9pCedeR97jfDBrAob9gmHDSZX0D4g== X-Received: by 2002:a5d:510e:0:b0:32d:a0d9:2124 with SMTP id s14-20020a5d510e000000b0032da0d92124mr4216318wrt.35.1697644722470; Wed, 18 Oct 2023 08:58:42 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id j4-20020adfe504000000b0032da7454ebesm2396161wrm.79.2023.10.18.08.58.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:58:41 -0700 (PDT) Date: Wed, 18 Oct 2023 11:58:37 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , =?utf-8?b?SGVydsOp?= Poussineau , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Aurelien Jarno Subject: [PULL 69/83] hw/isa/piix: Resolve duplicate code regarding PCI interrupt wiring Message-ID: <2731d8bd2b8b9ed842fe2c7928b702f97b5852a3.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow Now that both PIIX3 and PIIX4 use piix_set_irq() to trigger PCI IRQs the wiring in the respective realize methods can be shared, too. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin Message-Id: <20231007123843.127151-28-shentey@gmail.com> Signed-off-by: Michael S. Tsirkin --- hw/isa/piix.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/hw/isa/piix.c b/hw/isa/piix.c index 17677c2126..cba2098ca2 100644 --- a/hw/isa/piix.c +++ b/hw/isa/piix.c @@ -372,6 +372,8 @@ static void pci_piix_realize(PCIDevice *dev, const char *uhci_type, } qdev_connect_gpio_out(DEVICE(&d->pm), 0, d->isa_irqs_in[9]); } + + pci_bus_irqs(pci_bus, piix_set_pci_irq, d, PIIX_NUM_PIRQS); } static void build_pci_isa_aml(AcpiDevAmlIf *adev, Aml *scope) @@ -453,7 +455,6 @@ static const TypeInfo piix_pci_type_info = { static void piix3_realize(PCIDevice *dev, Error **errp) { ERRP_GUARD(); - PIIXState *piix3 = PIIX_PCI_DEVICE(dev); PCIBus *pci_bus = pci_get_bus(dev); pci_piix_realize(dev, TYPE_PIIX3_USB_UHCI, errp); @@ -461,7 +462,6 @@ static void piix3_realize(PCIDevice *dev, Error **errp) return; } - pci_bus_irqs(pci_bus, piix_set_pci_irq, piix3, PIIX_NUM_PIRQS); pci_bus_set_route_irq_fn(pci_bus, piix_route_intx_pin_to_irq); } @@ -492,16 +492,7 @@ static const TypeInfo piix3_info = { static void piix4_realize(PCIDevice *dev, Error **errp) { - ERRP_GUARD(); - PIIXState *s = PIIX_PCI_DEVICE(dev); - PCIBus *pci_bus = pci_get_bus(dev); - pci_piix_realize(dev, TYPE_PIIX4_USB_UHCI, errp); - if (*errp) { - return; - } - - pci_bus_irqs(pci_bus, piix_set_pci_irq, s, PIIX_NUM_PIRQS); } static void piix4_init(Object *obj) From patchwork Wed Oct 18 15:58:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851087 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=g5PUduQ0; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9cmC6N2Vz20Pd for ; Thu, 19 Oct 2023 04:10:03 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8xc-0002Yl-MG; Wed, 18 Oct 2023 11:59:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8xL-00028W-O9 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:59:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8xJ-0007ln-MA for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:59:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644772; 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=x3My//pc/qVW2ftl9aWSgQDTy/uh8IXpNIimgHcVE8A=; b=g5PUduQ0LLdXZqlSFeIzGcLD8F3yxNhz+td7VMK1HliQCVjG984KmksZZktFAvDTz2BsDc S7glbQ5HeycPFnxGmE5gCy0R/ocopFhBswkPPaY/kqVtxl8Z7GAEGBjJsMRao46G/aW2sI XeCn9lB+48qjys1Gyj6oWeH1UxaKcfI= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-532-99GWxeLOMSCYox7xwcGfbg-1; Wed, 18 Oct 2023 11:58:55 -0400 X-MC-Unique: 99GWxeLOMSCYox7xwcGfbg-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-32d9b520d15so2819933f8f.3 for ; Wed, 18 Oct 2023 08:58:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644727; x=1698249527; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=x3My//pc/qVW2ftl9aWSgQDTy/uh8IXpNIimgHcVE8A=; b=CddMqOyGh3BUT7rmMnyk3+MJjKRWcE3Lz2uh3NigqXnoqr4JVHS7E3GSBlwNmZIYfJ Nb6S7ApfWHVRgrpGnBYBWGp3FZShg2XvmMn0xKDl3fAXqvK6pAycDq4SVPL85qig5xzb 2mJ0RlSFdecHKUyhrUSvbtMoaYSRXT8vhRJkGcfJgIaktkgYiGwyDwR4kGDgqv0lgCJ+ w4HDTpCT6lTxB1sOneQE1kDq1nuRgiWSxaleQk+SYUfuNKK1cqhvthO5lm1Qui+V7hZ2 bplWmpABQP+mo4BGS8BUkn12Sz9/ZNFq61TEcSCHZY2V3vBNug54yZVobVjmF3G9OhgG nMnA== X-Gm-Message-State: AOJu0YxbFk/kwSR5d9Igv+3dTgUYRCS1Yva4Rwb0o912L+mIXDdPf7wq EJSXKscRqUXEBTHl/G3fw28cC0SPlg3w6o/1iUz9Yoe66mEFn4Q0mxAIbublmkGY/i5Dgey0QLC aUw9iTxG5gMKUPhaxKqmxpFEFUVSTr8rSLgdzZBT3WpZ+BaEk5EmJZqGj7NI6z1LsD0naPmo= X-Received: by 2002:a5d:4c81:0:b0:32d:9d66:5742 with SMTP id z1-20020a5d4c81000000b0032d9d665742mr5034875wrs.10.1697644727514; Wed, 18 Oct 2023 08:58:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFznfcmpkY3gNQYQQJq5HO9C2vamX3P0lTImSm2ErmrV3qktRKNya3dmsBsPHQaM5tTBjr23Q== X-Received: by 2002:a5d:4c81:0:b0:32d:9d66:5742 with SMTP id z1-20020a5d4c81000000b0032d9d665742mr5034858wrs.10.1697644727220; Wed, 18 Oct 2023 08:58:47 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id f12-20020adfb60c000000b00318147fd2d3sm2388456wre.41.2023.10.18.08.58.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:58:46 -0700 (PDT) Date: Wed, 18 Oct 2023 11:58:42 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Marcel Apfelbaum , Philippe =?utf-8?q?Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Aurelien Jarno , =?utf-8?b?SGVydsOp?= Poussineau Subject: [PULL 70/83] hw/isa/piix: Implement multi-process QEMU support also for PIIX4 Message-ID: <461585efb5d8ee352209cf5e37116046f1410b94.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow So far multi-process QEMU was only implemented for PIIX3. Move the support into the base class to achieve feature parity between both device models. Signed-off-by: Bernhard Beschow Message-Id: <20231007123843.127151-29-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/isa/piix.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/hw/isa/piix.c b/hw/isa/piix.c index cba2098ca2..04ebed5b52 100644 --- a/hw/isa/piix.c +++ b/hw/isa/piix.c @@ -374,6 +374,7 @@ static void pci_piix_realize(PCIDevice *dev, const char *uhci_type, } pci_bus_irqs(pci_bus, piix_set_pci_irq, d, PIIX_NUM_PIRQS); + pci_bus_set_route_irq_fn(pci_bus, piix_route_intx_pin_to_irq); } static void build_pci_isa_aml(AcpiDevAmlIf *adev, Aml *scope) @@ -454,15 +455,7 @@ static const TypeInfo piix_pci_type_info = { static void piix3_realize(PCIDevice *dev, Error **errp) { - ERRP_GUARD(); - PCIBus *pci_bus = pci_get_bus(dev); - pci_piix_realize(dev, TYPE_PIIX3_USB_UHCI, errp); - if (*errp) { - return; - } - - pci_bus_set_route_irq_fn(pci_bus, piix_route_intx_pin_to_irq); } static void piix3_init(Object *obj) From patchwork Wed Oct 18 15:58:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851039 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=NIYunSDC; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9c3t1kr4z20Pd for ; Thu, 19 Oct 2023 03:38:34 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8x2-0001al-L9; Wed, 18 Oct 2023 11:59:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8wk-0001Hf-FG for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8wi-0007VL-Mq for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:58:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644735; 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=bKxpfI1ewkLWXrLPRKRjX/JTEEf96RdRnERqJjhDehM=; b=NIYunSDCIjAzvhDROuiOmFN4nnFJommkTkeE+6+9TMYfmFlh77FA/pX4jBcwVeoFwL1KwV vrDG6NIsPt6wNj2KDaArqqDcaLgmZ9moPr4KJOnyS7LSSAgjjRx/e5UjTcXUWQBpxMjJiy pGfSZLce+aif1SD/zIslKg+NLdj3Lx4= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-502-7UwL4hsoPACfL6SVBiG_fQ-1; Wed, 18 Oct 2023 11:58:53 -0400 X-MC-Unique: 7UwL4hsoPACfL6SVBiG_fQ-1 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2c54b040cf2so5283941fa.2 for ; Wed, 18 Oct 2023 08:58:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644732; x=1698249532; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=bKxpfI1ewkLWXrLPRKRjX/JTEEf96RdRnERqJjhDehM=; b=YRWJn7qMV6azkFNqeU5byxDRay+LcTXDnrjEBCzVREX4F2aaVZmRyKSxhTZcoDSfmj h9ROLdEicwngF84/QTpAcOv2aDdslndWF33/d3WSUcvbDV/diiwHCtTmowM82M2Pkwyr /vhXdqSpxNWfsumt/5VaGWWzDaoBZ97SnREBuO6TLFuDTwth85YWZ13Y3HIeSziPssX0 RBbfTR9Qu1HFSO1PkthLc8aMdjXTUbI1ZDKWS+kuFWI7pjpoMyphRqW/XDj8MbIGZPzh 6hcPp/b02jm2GR4R1UP5wjJ0lT1oFrToYweaFx9v3JF77HVYxyUnT/r38Xo8SP0Rjh3j LagA== X-Gm-Message-State: AOJu0YyW1LbiCfY2CZVu+tPT4Nl/rpw97k4HjNwr8LyUyEqSBxsJEG0f at3B/KijSn8D5cUbzIbhJZZp2V+brEOIHELawvpSIBnAVu/8UDt3rO919niJZijKs8XfMP6CpYX O+UqRZHqGIr3/HyLFoMXiQ2Zq6qBhA4WyVy81ro9Iq1T4KgyU2CCKCFKazzbbPjxp49cu3Yc= X-Received: by 2002:a05:651c:a08:b0:2c5:55a:b6b5 with SMTP id k8-20020a05651c0a0800b002c5055ab6b5mr6317278ljq.28.1697644731813; Wed, 18 Oct 2023 08:58:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFKYwuh6OZ9J1uuNsChGnxMnNuSxNvRvne9eHjjDx/eWeGy+nUB+skO1PW/SNorJQYQ9a//mQ== X-Received: by 2002:a05:651c:a08:b0:2c5:55a:b6b5 with SMTP id k8-20020a05651c0a0800b002c5055ab6b5mr6317248ljq.28.1697644731464; Wed, 18 Oct 2023 08:58:51 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id i18-20020a05600c481200b00407b93d8085sm1983241wmo.27.2023.10.18.08.58.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:58:50 -0700 (PDT) Date: Wed, 18 Oct 2023 11:58:47 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 71/83] hw/i386/pc_piix: Make PIIX4 south bridge usable in PC machine Message-ID: <8b152920ea5955b1cba164a0f18c544a69ced13b.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bernhard Beschow QEMU's PIIX3 implementation actually models the real PIIX4, but with different PCI IDs. Usually, guests deal just fine with it. Still, in order to provide a more consistent illusion to guests, allow QEMU's PIIX4 implementation to be used in the PC machine. Signed-off-by: Bernhard Beschow Message-Id: <20231007123843.127151-30-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/pc.h | 2 + hw/i386/pc.c | 1 + hw/i386/pc_piix.c | 61 +++++++++++++++++++++++++++- docs/system/target-i386-desc.rst.inc | 8 ++++ 4 files changed, 71 insertions(+), 1 deletion(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index bec38cb92c..29a9724524 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -42,6 +42,7 @@ typedef struct PCMachineState { uint64_t max_ram_below_4g; OnOffAuto vmport; SmbiosEntryPointType smbios_entry_point_type; + const char *south_bridge; bool acpi_build_enabled; bool smbus_enabled; @@ -92,6 +93,7 @@ struct PCMachineClass { /* Device configuration: */ bool pci_enabled; bool kvmclock_enabled; + const char *default_south_bridge; /* Compat options: */ diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 355e1b7cf6..6293f57a0c 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1706,6 +1706,7 @@ static void pc_machine_initfn(Object *obj) #endif /* CONFIG_VMPORT */ pcms->max_ram_below_4g = 0; /* use default */ pcms->smbios_entry_point_type = pcmc->default_smbios_ep_type; + pcms->south_bridge = pcmc->default_south_bridge; /* acpi build is enabled by default if machine supports it */ pcms->acpi_build_enabled = pcmc->has_acpi_build; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index e38942a3c3..334d9a0299 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -262,7 +262,7 @@ static void pc_init1(MachineState *machine, DeviceState *dev; size_t i; - pci_dev = pci_new_multifunction(-1, TYPE_PIIX3_DEVICE); + pci_dev = pci_new_multifunction(-1, pcms->south_bridge); object_property_set_bool(OBJECT(pci_dev), "has-usb", machine_usb(machine), &error_abort); object_property_set_bool(OBJECT(pci_dev), "has-acpi", @@ -394,6 +394,56 @@ static void pc_init1(MachineState *machine, } } +typedef enum PCSouthBridgeOption { + PC_SOUTH_BRIDGE_OPTION_PIIX3, + PC_SOUTH_BRIDGE_OPTION_PIIX4, + PC_SOUTH_BRIDGE_OPTION_MAX, +} PCSouthBridgeOption; + +static const QEnumLookup PCSouthBridgeOption_lookup = { + .array = (const char *const[]) { + [PC_SOUTH_BRIDGE_OPTION_PIIX3] = TYPE_PIIX3_DEVICE, + [PC_SOUTH_BRIDGE_OPTION_PIIX4] = TYPE_PIIX4_PCI_DEVICE, + }, + .size = PC_SOUTH_BRIDGE_OPTION_MAX +}; + +#define NotifyVmexitOption_str(val) \ + qapi_enum_lookup(&NotifyVmexitOption_lookup, (val)) + +static int pc_get_south_bridge(Object *obj, Error **errp) +{ + PCMachineState *pcms = PC_MACHINE(obj); + int i; + + for (i = 0; i < PCSouthBridgeOption_lookup.size; i++) { + if (g_strcmp0(PCSouthBridgeOption_lookup.array[i], + pcms->south_bridge) == 0) { + return i; + } + } + + error_setg(errp, "Invalid south bridge value set"); + return 0; +} + +static void pc_set_south_bridge(Object *obj, int value, Error **errp) +{ + PCMachineState *pcms = PC_MACHINE(obj); + + if (value < 0) { + error_setg(errp, "Value can't be negative"); + return; + } + + if (value >= PCSouthBridgeOption_lookup.size) { + error_setg(errp, "Value too big"); + return; + } + + pcms->south_bridge = PCSouthBridgeOption_lookup.array[value]; +} + /* Looking for a pc_compat_2_4() function? It doesn't exist. * pc_compat_*() functions that run on machine-init time and * change global QEMU state are deprecated. Please don't create @@ -473,6 +523,8 @@ static void pc_xen_hvm_init(MachineState *machine) static void pc_i440fx_machine_options(MachineClass *m) { PCMachineClass *pcmc = PC_MACHINE_CLASS(m); + ObjectClass *oc = OBJECT_CLASS(m); + pcmc->default_south_bridge = TYPE_PIIX3_DEVICE; pcmc->pci_root_uid = 0; pcmc->default_cpu_version = 1; @@ -484,6 +536,13 @@ static void pc_i440fx_machine_options(MachineClass *m) m->no_parallel = !module_object_class_by_name(TYPE_ISA_PARALLEL); machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE); machine_class_allow_dynamic_sysbus_dev(m, TYPE_VMBUS_BRIDGE); + + object_class_property_add_enum(oc, "x-south-bridge", "PCSouthBridgeOption", + &PCSouthBridgeOption_lookup, + pc_get_south_bridge, + pc_set_south_bridge); + object_class_property_set_description(oc, "x-south-bridge", + "Use a different south bridge than PIIX3"); } static void pc_i440fx_8_2_machine_options(MachineClass *m) diff --git a/docs/system/target-i386-desc.rst.inc b/docs/system/target-i386-desc.rst.inc index 7d1fffacbe..5ebbcda9db 100644 --- a/docs/system/target-i386-desc.rst.inc +++ b/docs/system/target-i386-desc.rst.inc @@ -71,3 +71,11 @@ machine property, i.e. |qemu_system_x86| some.img \ -audiodev ,id= \ -machine pcspk-audiodev= + +Machine-specific options +~~~~~~~~~~~~~~~~~~~~~~~~ + +It supports the following machine-specific options: + +- ``x-south-bridge=PIIX3|piix4-isa`` (Experimental option to select a particular + south bridge. Default: ``PIIX3``) From patchwork Wed Oct 18 15:58:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851025 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=DKZ26dpP; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bh73CrGz20Pd for ; Thu, 19 Oct 2023 03:21:27 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8x3-0001cg-Nq; Wed, 18 Oct 2023 11:59:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8wq-0001Nt-AT for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:59:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8wn-0007cQ-2R for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:59:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644740; 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=dEyHp47zWZMmJ4LBbWEQwLbSqJ+uzpsgbL7RPabK7bU=; b=DKZ26dpPQOyc7nLYRxP/hK220V4/ft6iaGPorxZm/bVf+YfubO4YTeGoIZk2Run2QZbk0O jiFqIptPHrrvreZ8OVaNQpokfFEhi7ToF1PYW4BMfBA/F4ST0Ho9Xnk109hORzsift0bPl CqLL4OpV8M6aBJ/Y448Vwo0ql7J3ors= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-28-B2YKg24JPXOIFtr4yN5jJA-1; Wed, 18 Oct 2023 11:58:58 -0400 X-MC-Unique: B2YKg24JPXOIFtr4yN5jJA-1 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-507c8a8e5d1so917254e87.3 for ; Wed, 18 Oct 2023 08:58:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644736; x=1698249536; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=dEyHp47zWZMmJ4LBbWEQwLbSqJ+uzpsgbL7RPabK7bU=; b=c6Ca2AFHj/99vdUWT7anrqaiEu4apXGyhqNr7FC1cSCm9VBpJdWsrMw8KearU6YkT9 hemhSTeTyUjgkLns+PHEmiuMDYjNhFE/sbpTeodBfefUJTyUAcoyA9EPLC9RYL721x6v 8MK4ylv1jnGPQqLUTGjK13w/UAoFLw9tl2c1SkMOA/begVddYU89xVwM4j9XQcqfo6h2 N/rTPZmsfnR3pfJJpvILltKiPzAq5tzJ72ZhY3xeBzcfOqENKr+0uHeBmGb8rQCZhRpD 08aFhwTx0abIZMpLjiIm3WPKoznNb5EzsCmhWY74tYqBIUP0YA0eEqvGRx3idm14HiEY iwVg== X-Gm-Message-State: AOJu0YxiMjh39qd+lzjRPdZzwT+7QtDkythddsF1cr+1QNj2yOfIA4hR qG2iGA/FqqT0sDuoncXJZu8CrexjITFSFKFxOtYheCDpJ+ks84UVWJmygqtmkmBNL/B7qHHM5oV aeBk0FbC/lmO3BB38SS5C8OCHmnZRhlti5S9Glk6IrSX3ZLMcubrr2Yl1T5asz45bLiaCP5M= X-Received: by 2002:a05:6512:b9e:b0:500:92f1:c341 with SMTP id b30-20020a0565120b9e00b0050092f1c341mr5424890lfv.54.1697644736076; Wed, 18 Oct 2023 08:58:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF9BBpiZFk2AtITs+j1wRjrBHVJap4nDNjUb86Dfxu1ZIGEoqCxpdYf7QusEt9qkk58+wXBQg== X-Received: by 2002:a05:6512:b9e:b0:500:92f1:c341 with SMTP id b30-20020a0565120b9e00b0050092f1c341mr5424879lfv.54.1697644735786; Wed, 18 Oct 2023 08:58:55 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id n13-20020a05600c3b8d00b004053e9276easm2053317wms.32.2023.10.18.08.58.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:58:54 -0700 (PDT) Date: Wed, 18 Oct 2023 11:58:51 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Li Feng , Raphael Norwitz , Paolo Bonzini , Fam Zheng Subject: [PULL 72/83] vhost-user-common: send get_inflight_fd once Message-ID: <772346132e16f493c1cd354a0b9bd8561a1372b7.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Li Feng Currently the get_inflight_fd will be sent every time the device is started, and the backend will allocate shared memory to save the inflight state. If the backend finds that it receives the second get_inflight_fd, it will release the previous shared memory, which breaks inflight working logic. This patch is a preparation for the following patches. Signed-off-by: Li Feng Reviewed-by: Raphael Norwitz Message-Id: <20231009044735.941655-2-fengli@smartx.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/scsi/vhost-scsi-common.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/hw/scsi/vhost-scsi-common.c b/hw/scsi/vhost-scsi-common.c index a06f01af26..a61cd0e907 100644 --- a/hw/scsi/vhost-scsi-common.c +++ b/hw/scsi/vhost-scsi-common.c @@ -52,20 +52,28 @@ int vhost_scsi_common_start(VHostSCSICommon *vsc) vsc->dev.acked_features = vdev->guest_features; - assert(vsc->inflight == NULL); - vsc->inflight = g_new0(struct vhost_inflight, 1); - ret = vhost_dev_get_inflight(&vsc->dev, - vs->conf.virtqueue_size, - vsc->inflight); + ret = vhost_dev_prepare_inflight(&vsc->dev, vdev); if (ret < 0) { - error_report("Error get inflight: %d", -ret); + error_report("Error setting inflight format: %d", -ret); goto err_guest_notifiers; } - ret = vhost_dev_set_inflight(&vsc->dev, vsc->inflight); - if (ret < 0) { - error_report("Error set inflight: %d", -ret); - goto err_guest_notifiers; + if (vsc->inflight) { + if (!vsc->inflight->addr) { + ret = vhost_dev_get_inflight(&vsc->dev, + vs->conf.virtqueue_size, + vsc->inflight); + if (ret < 0) { + error_report("Error getting inflight: %d", -ret); + goto err_guest_notifiers; + } + } + + ret = vhost_dev_set_inflight(&vsc->dev, vsc->inflight); + if (ret < 0) { + error_report("Error setting inflight: %d", -ret); + goto err_guest_notifiers; + } } ret = vhost_dev_start(&vsc->dev, vdev, true); @@ -85,9 +93,6 @@ int vhost_scsi_common_start(VHostSCSICommon *vsc) return ret; err_guest_notifiers: - g_free(vsc->inflight); - vsc->inflight = NULL; - k->set_guest_notifiers(qbus->parent, vsc->dev.nvqs, false); err_host_notifiers: vhost_dev_disable_notifiers(&vsc->dev, vdev); @@ -111,12 +116,6 @@ void vhost_scsi_common_stop(VHostSCSICommon *vsc) } assert(ret >= 0); - if (vsc->inflight) { - vhost_dev_free_inflight(vsc->inflight); - g_free(vsc->inflight); - vsc->inflight = NULL; - } - vhost_dev_disable_notifiers(&vsc->dev, vdev); } From patchwork Wed Oct 18 15:58:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851095 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=coMLRi3u; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9csL6pFJz20Zj for ; Thu, 19 Oct 2023 04:14:30 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8xE-0001wW-M3; Wed, 18 Oct 2023 11:59:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8x2-0001aD-8a for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:59:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8x0-0007gi-If for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:59:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644754; 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=mAx5U6tzoPzE/iLbJKJIpH55yxbW14JSXW+iIiHFWOE=; b=coMLRi3ufn+jfC9KShYmdsv1Bl4EPvXODm5etadeYIalPed7WTzmaIOnF5EjTOd0YXTE4H iAJCvgQYalexSLwtmgHPSMKm10/n1Qgm6IJMuErNkkqzyk1/cBORKcVbOYQfwPrq5fbjz3 sS0FUvSSGSVsNiTZLSCiMZw7Hg1SJb0= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-588-W6zS1_ftM5OIE3WX2ZNcCg-1; Wed, 18 Oct 2023 11:59:02 -0400 X-MC-Unique: W6zS1_ftM5OIE3WX2ZNcCg-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-32d9cd6eb0bso3071504f8f.0 for ; Wed, 18 Oct 2023 08:59:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644741; x=1698249541; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=mAx5U6tzoPzE/iLbJKJIpH55yxbW14JSXW+iIiHFWOE=; b=hz3hhx2PvQGd6VL+CTQNy/AdsjJhIfWG4l9ss17rHVLn6LmN1xJqx4CXH0I8HlFB6t EQfOoDdSAzzgnKAglk4Noaa2NkFAtB72QmVp2o8mViGFVdIK2B2S3Hy/EhkQhdBOr6XA SFZGNKP7SoKWhZO7PAAKxpceciXcV+VDLyWMX/k5q8dc3u8JLWJHYBM0Jx2F9KcWDqiX 5t9zNz0mcpUcqB+7b9r4b4X9wjRDilfkma+Xp63Ca6OFk9sd7hcAns01aWCZBobFnHkE SokJZVJOnG1zwCirTxVzvoY2nU3sY+DpEWfwSlp6Pib0CIAfiAAfHo8DThPvDt8A7ZlX xStA== X-Gm-Message-State: AOJu0YxBAnQSTCviOlNlbTf3WNOhL2nSiDE2QzyzT7h34BgpAuKbbipn pF5Mxdsyz5goDqAcZ6mP/S8+qBi2pyxt+6QXKX2nQ+n9sfyVhO8DPK7pwnvRL/JBIDhVfP35NHn Rrog0CWHNTdBIbsTwmnVKHD02gUnCqIkaF1oa2o47Syrzap5gSXeP+vM0ES3nwPnkM76Wlcg= X-Received: by 2002:a05:6000:1375:b0:32d:a98c:aa1f with SMTP id q21-20020a056000137500b0032da98caa1fmr4103760wrz.1.1697644741214; Wed, 18 Oct 2023 08:59:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGPfkjXsO27BGHkyIYtitsoZPuhCAgYuYyX3zkXliBGfvf4dgbobK2sp4UKof5m3XZ+ck07ew== X-Received: by 2002:a05:6000:1375:b0:32d:a98c:aa1f with SMTP id q21-20020a056000137500b0032da98caa1fmr4103740wrz.1.1697644740902; Wed, 18 Oct 2023 08:59:00 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id i11-20020a5d630b000000b00327bf4f2f14sm2392996wru.88.2023.10.18.08.58.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:59:00 -0700 (PDT) Date: Wed, 18 Oct 2023 11:58:56 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Li Feng , Raphael Norwitz , Kevin Wolf , Hanna Reitz , Alex =?utf-8?q?Benn=C3=A9e?= , Viresh Kumar , qemu-block@nongnu.org Subject: [PULL 73/83] vhost: move and rename the conn retry times Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Li Feng Multiple devices need this macro, move it to a common header. Signed-off-by: Li Feng Reviewed-by: Raphael Norwitz Message-Id: <20231009044735.941655-3-fengli@smartx.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost.h | 2 ++ hw/block/vhost-user-blk.c | 4 +--- hw/virtio/vhost-user-gpio.c | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index 00e0a669b8..5e8183f64a 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -8,6 +8,8 @@ #define VHOST_F_DEVICE_IOTLB 63 #define VHOST_USER_F_PROTOCOL_FEATURES 30 +#define VU_REALIZE_CONN_RETRIES 3 + /* Generic structures common for any vhost based device. */ struct vhost_inflight { diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index eecf3f7a81..3c69fa47d5 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -32,8 +32,6 @@ #include "sysemu/sysemu.h" #include "sysemu/runstate.h" -#define REALIZE_CONNECTION_RETRIES 3 - static const int user_feature_bits[] = { VIRTIO_BLK_F_SIZE_MAX, VIRTIO_BLK_F_SEG_MAX, @@ -482,7 +480,7 @@ static void vhost_user_blk_device_realize(DeviceState *dev, Error **errp) s->inflight = g_new0(struct vhost_inflight, 1); s->vhost_vqs = g_new0(struct vhost_virtqueue, s->num_queues); - retries = REALIZE_CONNECTION_RETRIES; + retries = VU_REALIZE_CONN_RETRIES; assert(!*errp); do { if (*errp) { diff --git a/hw/virtio/vhost-user-gpio.c b/hw/virtio/vhost-user-gpio.c index 3d7fae3984..fc784e4213 100644 --- a/hw/virtio/vhost-user-gpio.c +++ b/hw/virtio/vhost-user-gpio.c @@ -15,7 +15,6 @@ #include "standard-headers/linux/virtio_ids.h" #include "trace.h" -#define REALIZE_CONNECTION_RETRIES 3 #define VHOST_NVQS 2 /* Features required from VirtIO */ @@ -365,7 +364,7 @@ static void vu_gpio_device_realize(DeviceState *dev, Error **errp) qemu_chr_fe_set_handlers(&gpio->chardev, NULL, NULL, vu_gpio_event, NULL, dev, NULL, true); - retries = REALIZE_CONNECTION_RETRIES; + retries = VU_REALIZE_CONN_RETRIES; g_assert(!*errp); do { if (*errp) { From patchwork Wed Oct 18 15:59:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851107 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=EjNcaQiv; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9d3Q5vsNz20Pd for ; Thu, 19 Oct 2023 04:23:14 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8x6-0001gO-5f; Wed, 18 Oct 2023 11:59:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8wz-0001Tk-0n for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:59:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8ww-0007gL-LF for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:59:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644749; 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=IfCJRn8r77VYMrjpWnu9brJ2+zJiZU2dGmOU5Pe2LJc=; b=EjNcaQivuRqs6r+YRdE/1LeiJSgq4vhdw/oSUn/6ufgvVy2RGtLuhujc5rBPN4lvIs1ur3 o3rZBlCHkD6AfyQPlVMniI2rkj7G6QjEQ1eNioITnF/SOpNhpJIlhQu8Dz+C3CC/1ZkKck Nn0po3fhoMiHCz8NTr0Zi1rSJ7VQk3k= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-17--hv9CnSwMXepCrYCJpRtZw-1; Wed, 18 Oct 2023 11:59:08 -0400 X-MC-Unique: -hv9CnSwMXepCrYCJpRtZw-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-40570ccc497so54289325e9.3 for ; Wed, 18 Oct 2023 08:59:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644746; x=1698249546; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=IfCJRn8r77VYMrjpWnu9brJ2+zJiZU2dGmOU5Pe2LJc=; b=MZ28/J8iE2L0Kx2NKn1IhtsMB1m9mzImtCVH4IE+u9ZTrYAhAiL4QpIYbG7vjZ+DmP K1Kf8a7B4ZPnab4vaYjMg5KBA25YStVhUxbWbCe5t0/JJzBKQOgPHOSVBJQm/NP1e0ex 4IOI9Ep4UYbCJM+Zo6ZAFYtC2atJ+XIGTuAnEbl5SBV6zOHLULvLEFacT6QsU9jQuJiM SZ1kPjiz4d0SqDITjtVIC0B6ELPd7zMfArbzD4oCCSvwOsLhQEtI22HtysoT68tQlV0G eLcM4rP+LRPKSj7A5unMWbE6JMYdLL27nxw193pxTXCBXz3gmgjZXuqZqZTB/yXBp4ph 6TeA== X-Gm-Message-State: AOJu0YyVrGXeyQ+MY5Rz31zSZ277WehF/MHezwIa5cAPmhc5h9RNUzaN BYw2zORCHVBHM2xwG3TX5Btnfw+OuEx7OzgQ+Zkqn0/ipkQd8gAohFXI17RJzYBWLzi5NBs7M+Q AtZ3Ir88jwiwKDnsjGjfQS4Voq1hhaek8fYnojIWH1Faw0aftv0+pYgL5ofkB/pGHyVdjRyI= X-Received: by 2002:a05:600c:3ca4:b0:406:592b:e5aa with SMTP id bg36-20020a05600c3ca400b00406592be5aamr4413976wmb.14.1697644746285; Wed, 18 Oct 2023 08:59:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF5lg2V/f6ENa9FGUyk7IZfHf/lNifQieHkJzJKBeFQgseMrr5PZ1Fuz5RTNKlsp1M2ErBWsQ== X-Received: by 2002:a05:600c:3ca4:b0:406:592b:e5aa with SMTP id bg36-20020a05600c3ca400b00406592be5aamr4413952wmb.14.1697644745836; Wed, 18 Oct 2023 08:59:05 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id x9-20020a05600c420900b004065e235417sm1981386wmh.21.2023.10.18.08.59.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:59:05 -0700 (PDT) Date: Wed, 18 Oct 2023 11:59:01 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Li Feng , Manos Pitsidianakis , Paolo Bonzini , Fam Zheng , Raphael Norwitz Subject: [PULL 74/83] vhost-user-scsi: support reconnect to backend Message-ID: <1e78b466dd62c08d8b027119eff37d7d09cd9aa0.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Li Feng If the backend crashes and restarts, the device is broken. This patch adds reconnect for vhost-user-scsi. This patch also improves the error messages, and reports some silent errors. Tested with spdk backend. Signed-off-by: Li Feng Message-Id: <20231009044735.941655-4-fengli@smartx.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Manos Pitsidianakis --- include/hw/virtio/vhost-scsi-common.h | 2 +- include/hw/virtio/vhost-user-scsi.h | 6 + hw/scsi/vhost-scsi-common.c | 16 +- hw/scsi/vhost-scsi.c | 6 +- hw/scsi/vhost-user-scsi.c | 201 +++++++++++++++++++++++--- 5 files changed, 201 insertions(+), 30 deletions(-) diff --git a/include/hw/virtio/vhost-scsi-common.h b/include/hw/virtio/vhost-scsi-common.h index 18f115527c..c5d2c09455 100644 --- a/include/hw/virtio/vhost-scsi-common.h +++ b/include/hw/virtio/vhost-scsi-common.h @@ -39,7 +39,7 @@ struct VHostSCSICommon { struct vhost_inflight *inflight; }; -int vhost_scsi_common_start(VHostSCSICommon *vsc); +int vhost_scsi_common_start(VHostSCSICommon *vsc, Error **errp); void vhost_scsi_common_stop(VHostSCSICommon *vsc); char *vhost_scsi_common_get_fw_dev_path(FWPathProvider *p, BusState *bus, DeviceState *dev); diff --git a/include/hw/virtio/vhost-user-scsi.h b/include/hw/virtio/vhost-user-scsi.h index 521b08e559..78fe616ccb 100644 --- a/include/hw/virtio/vhost-user-scsi.h +++ b/include/hw/virtio/vhost-user-scsi.h @@ -28,7 +28,13 @@ OBJECT_DECLARE_SIMPLE_TYPE(VHostUserSCSI, VHOST_USER_SCSI) struct VHostUserSCSI { VHostSCSICommon parent_obj; + + /* Properties */ + bool connected; + bool started_vu; + VhostUserState vhost_user; + struct vhost_virtqueue *vhost_vqs; }; #endif /* VHOST_USER_SCSI_H */ diff --git a/hw/scsi/vhost-scsi-common.c b/hw/scsi/vhost-scsi-common.c index a61cd0e907..4c8637045d 100644 --- a/hw/scsi/vhost-scsi-common.c +++ b/hw/scsi/vhost-scsi-common.c @@ -16,6 +16,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/module.h" #include "hw/virtio/vhost.h" @@ -25,7 +26,7 @@ #include "hw/virtio/virtio-access.h" #include "hw/fw-path-provider.h" -int vhost_scsi_common_start(VHostSCSICommon *vsc) +int vhost_scsi_common_start(VHostSCSICommon *vsc, Error **errp) { int ret, i; VirtIODevice *vdev = VIRTIO_DEVICE(vsc); @@ -35,18 +36,19 @@ int vhost_scsi_common_start(VHostSCSICommon *vsc) VirtIOSCSICommon *vs = (VirtIOSCSICommon *)vsc; if (!k->set_guest_notifiers) { - error_report("binding does not support guest notifiers"); + error_setg(errp, "binding does not support guest notifiers"); return -ENOSYS; } ret = vhost_dev_enable_notifiers(&vsc->dev, vdev); if (ret < 0) { + error_setg_errno(errp, -ret, "Error enabling host notifiers"); return ret; } ret = k->set_guest_notifiers(qbus->parent, vsc->dev.nvqs, true); if (ret < 0) { - error_report("Error binding guest notifier"); + error_setg_errno(errp, -ret, "Error binding guest notifier"); goto err_host_notifiers; } @@ -54,7 +56,7 @@ int vhost_scsi_common_start(VHostSCSICommon *vsc) ret = vhost_dev_prepare_inflight(&vsc->dev, vdev); if (ret < 0) { - error_report("Error setting inflight format: %d", -ret); + error_setg_errno(errp, -ret, "Error setting inflight format"); goto err_guest_notifiers; } @@ -64,21 +66,21 @@ int vhost_scsi_common_start(VHostSCSICommon *vsc) vs->conf.virtqueue_size, vsc->inflight); if (ret < 0) { - error_report("Error getting inflight: %d", -ret); + error_setg_errno(errp, -ret, "Error getting inflight"); goto err_guest_notifiers; } } ret = vhost_dev_set_inflight(&vsc->dev, vsc->inflight); if (ret < 0) { - error_report("Error setting inflight: %d", -ret); + error_setg_errno(errp, -ret, "Error setting inflight"); goto err_guest_notifiers; } } ret = vhost_dev_start(&vsc->dev, vdev, true); if (ret < 0) { - error_report("Error start vhost dev"); + error_setg_errno(errp, -ret, "Error starting vhost dev"); goto err_guest_notifiers; } diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index 443f67daa4..95cadb93e7 100644 --- a/hw/scsi/vhost-scsi.c +++ b/hw/scsi/vhost-scsi.c @@ -75,6 +75,7 @@ static int vhost_scsi_start(VHostSCSI *s) int ret, abi_version; VHostSCSICommon *vsc = VHOST_SCSI_COMMON(s); const VhostOps *vhost_ops = vsc->dev.vhost_ops; + Error *local_err = NULL; ret = vhost_ops->vhost_scsi_get_abi_version(&vsc->dev, &abi_version); if (ret < 0) { @@ -88,14 +89,15 @@ static int vhost_scsi_start(VHostSCSI *s) return -ENOSYS; } - ret = vhost_scsi_common_start(vsc); + ret = vhost_scsi_common_start(vsc, &local_err); if (ret < 0) { + error_reportf_err(local_err, "Error starting vhost-scsi"); return ret; } ret = vhost_scsi_set_endpoint(s); if (ret < 0) { - error_report("Error setting vhost-scsi endpoint"); + error_reportf_err(local_err, "Error setting vhost-scsi endpoint"); vhost_scsi_common_stop(vsc); } diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index b7c6100f3e..24c250d3f8 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -39,26 +39,56 @@ static const int user_feature_bits[] = { VHOST_INVALID_FEATURE_BIT }; +static int vhost_user_scsi_start(VHostUserSCSI *s, Error **errp) +{ + VHostSCSICommon *vsc = VHOST_SCSI_COMMON(s); + int ret; + + ret = vhost_scsi_common_start(vsc, errp); + s->started_vu = !(ret < 0); + + return ret; +} + +static void vhost_user_scsi_stop(VHostUserSCSI *s) +{ + VHostSCSICommon *vsc = VHOST_SCSI_COMMON(s); + + if (!s->started_vu) { + return; + } + s->started_vu = false; + + vhost_scsi_common_stop(vsc); +} + static void vhost_user_scsi_set_status(VirtIODevice *vdev, uint8_t status) { VHostUserSCSI *s = (VHostUserSCSI *)vdev; + DeviceState *dev = DEVICE(vdev); VHostSCSICommon *vsc = VHOST_SCSI_COMMON(s); - bool start = (status & VIRTIO_CONFIG_S_DRIVER_OK) && vdev->vm_running; + VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(dev); + bool should_start = virtio_device_should_start(vdev, status); + Error *local_err = NULL; + int ret; - if (vhost_dev_is_started(&vsc->dev) == start) { + if (!s->connected) { return; } - if (start) { - int ret; + if (vhost_dev_is_started(&vsc->dev) == should_start) { + return; + } - ret = vhost_scsi_common_start(vsc); + if (should_start) { + ret = vhost_user_scsi_start(s, &local_err); if (ret < 0) { - error_report("unable to start vhost-user-scsi: %s", strerror(-ret)); - exit(1); + error_reportf_err(local_err, "unable to start vhost-user-scsi: %s", + strerror(-ret)); + qemu_chr_fe_disconnect(&vs->conf.chardev); } } else { - vhost_scsi_common_stop(vsc); + vhost_user_scsi_stop(s); } } @@ -66,14 +96,124 @@ static void vhost_dummy_handle_output(VirtIODevice *vdev, VirtQueue *vq) { } +static int vhost_user_scsi_connect(DeviceState *dev, Error **errp) +{ + VirtIODevice *vdev = VIRTIO_DEVICE(dev); + VHostUserSCSI *s = VHOST_USER_SCSI(vdev); + VHostSCSICommon *vsc = VHOST_SCSI_COMMON(s); + VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(dev); + int ret = 0; + + if (s->connected) { + return 0; + } + s->connected = true; + + vsc->dev.num_queues = vs->conf.num_queues; + vsc->dev.nvqs = VIRTIO_SCSI_VQ_NUM_FIXED + vs->conf.num_queues; + vsc->dev.vqs = s->vhost_vqs; + vsc->dev.vq_index = 0; + vsc->dev.backend_features = 0; + + ret = vhost_dev_init(&vsc->dev, &s->vhost_user, VHOST_BACKEND_TYPE_USER, 0, + errp); + if (ret < 0) { + return ret; + } + + /* restore vhost state */ + if (virtio_device_started(vdev, vdev->status)) { + ret = vhost_user_scsi_start(s, errp); + } + + return ret; +} + +static void vhost_user_scsi_event(void *opaque, QEMUChrEvent event); + +static void vhost_user_scsi_disconnect(DeviceState *dev) +{ + VirtIODevice *vdev = VIRTIO_DEVICE(dev); + VHostUserSCSI *s = VHOST_USER_SCSI(vdev); + VHostSCSICommon *vsc = VHOST_SCSI_COMMON(s); + VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(dev); + + if (!s->connected) { + return; + } + s->connected = false; + + vhost_user_scsi_stop(s); + + vhost_dev_cleanup(&vsc->dev); + + /* Re-instate the event handler for new connections */ + qemu_chr_fe_set_handlers(&vs->conf.chardev, NULL, NULL, + vhost_user_scsi_event, NULL, dev, NULL, true); +} + +static void vhost_user_scsi_event(void *opaque, QEMUChrEvent event) +{ + DeviceState *dev = opaque; + VirtIODevice *vdev = VIRTIO_DEVICE(dev); + VHostUserSCSI *s = VHOST_USER_SCSI(vdev); + VHostSCSICommon *vsc = VHOST_SCSI_COMMON(s); + VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(dev); + Error *local_err = NULL; + + switch (event) { + case CHR_EVENT_OPENED: + if (vhost_user_scsi_connect(dev, &local_err) < 0) { + error_report_err(local_err); + qemu_chr_fe_disconnect(&vs->conf.chardev); + return; + } + break; + case CHR_EVENT_CLOSED: + /* defer close until later to avoid circular close */ + vhost_user_async_close(dev, &vs->conf.chardev, &vsc->dev, + vhost_user_scsi_disconnect); + break; + case CHR_EVENT_BREAK: + case CHR_EVENT_MUX_IN: + case CHR_EVENT_MUX_OUT: + /* Ignore */ + break; + } +} + +static int vhost_user_scsi_realize_connect(VHostUserSCSI *s, Error **errp) +{ + DeviceState *dev = DEVICE(s); + VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(dev); + int ret; + + s->connected = false; + + ret = qemu_chr_fe_wait_connected(&vs->conf.chardev, errp); + if (ret < 0) { + return ret; + } + + ret = vhost_user_scsi_connect(dev, errp); + if (ret < 0) { + qemu_chr_fe_disconnect(&vs->conf.chardev); + return ret; + } + assert(s->connected); + + return 0; +} + static void vhost_user_scsi_realize(DeviceState *dev, Error **errp) { + ERRP_GUARD(); VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(dev); VHostUserSCSI *s = VHOST_USER_SCSI(dev); VHostSCSICommon *vsc = VHOST_SCSI_COMMON(s); - struct vhost_virtqueue *vqs = NULL; Error *err = NULL; int ret; + int retries = VU_REALIZE_CONN_RETRIES; if (!vs->conf.chardev.chr) { error_setg(errp, "vhost-user-scsi: missing chardev"); @@ -92,18 +232,28 @@ static void vhost_user_scsi_realize(DeviceState *dev, Error **errp) goto free_virtio; } - vsc->dev.nvqs = VIRTIO_SCSI_VQ_NUM_FIXED + vs->conf.num_queues; - vsc->dev.vqs = g_new0(struct vhost_virtqueue, vsc->dev.nvqs); - vsc->dev.vq_index = 0; - vsc->dev.backend_features = 0; - vqs = vsc->dev.vqs; + vsc->inflight = g_new0(struct vhost_inflight, 1); + s->vhost_vqs = g_new0(struct vhost_virtqueue, + VIRTIO_SCSI_VQ_NUM_FIXED + vs->conf.num_queues); + + assert(!*errp); + do { + if (*errp) { + error_prepend(errp, "Reconnecting after error: "); + error_report_err(*errp); + *errp = NULL; + } + ret = vhost_user_scsi_realize_connect(s, errp); + } while (ret < 0 && retries--); - ret = vhost_dev_init(&vsc->dev, &s->vhost_user, - VHOST_BACKEND_TYPE_USER, 0, errp); if (ret < 0) { goto free_vhost; } + /* we're fully initialized, now we can operate, so add the handler */ + qemu_chr_fe_set_handlers(&vs->conf.chardev, NULL, NULL, + vhost_user_scsi_event, NULL, (void *)dev, + NULL, true); /* Channel and lun both are 0 for bootable vhost-user-scsi disk */ vsc->channel = 0; vsc->lun = 0; @@ -112,8 +262,12 @@ static void vhost_user_scsi_realize(DeviceState *dev, Error **errp) return; free_vhost: + g_free(s->vhost_vqs); + s->vhost_vqs = NULL; + g_free(vsc->inflight); + vsc->inflight = NULL; vhost_user_cleanup(&s->vhost_user); - g_free(vqs); + free_virtio: virtio_scsi_common_unrealize(dev); } @@ -123,16 +277,23 @@ static void vhost_user_scsi_unrealize(DeviceState *dev) VirtIODevice *vdev = VIRTIO_DEVICE(dev); VHostUserSCSI *s = VHOST_USER_SCSI(dev); VHostSCSICommon *vsc = VHOST_SCSI_COMMON(s); - struct vhost_virtqueue *vqs = vsc->dev.vqs; + VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(dev); /* This will stop the vhost backend. */ vhost_user_scsi_set_status(vdev, 0); + qemu_chr_fe_set_handlers(&vs->conf.chardev, NULL, NULL, NULL, NULL, NULL, + NULL, false); vhost_dev_cleanup(&vsc->dev); - g_free(vqs); + g_free(s->vhost_vqs); + s->vhost_vqs = NULL; + + vhost_dev_free_inflight(vsc->inflight); + g_free(vsc->inflight); + vsc->inflight = NULL; - virtio_scsi_common_unrealize(dev); vhost_user_cleanup(&s->vhost_user); + virtio_scsi_common_unrealize(dev); } static Property vhost_user_scsi_properties[] = { From patchwork Wed Oct 18 15:59:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851124 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hBZX9GUD; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9dVQ0BqCz20Zj for ; Thu, 19 Oct 2023 04:43:10 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8xC-0001r4-01; Wed, 18 Oct 2023 11:59:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8x8-0001mC-RV for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:59:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8x6-0007hh-VG for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:59:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644760; 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=YyodsRp2ZRofBm0jV3rXv9QfLn6gfTg2fAVnLonYmZE=; b=hBZX9GUDL+/OhCrP3nUZ8pnB2H69KuHn19ZyzOVkIDUiBSOfdI9AYRgKX9Q+OMBHJTguL6 5T08wFmrWapCV/Scu6P1VFixT6CnXNxar7rSBLU0CAFWb3FBj48YMT/MoWZwdaKY4Z7wup uFYCk5ShhnwBT5D/xExx42wS7E5UvVY= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-253-efzkeRniMFezNMF_KKwVIA-1; Wed, 18 Oct 2023 11:59:14 -0400 X-MC-Unique: efzkeRniMFezNMF_KKwVIA-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4083c9b426fso4671665e9.2 for ; Wed, 18 Oct 2023 08:59:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644752; x=1698249552; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=YyodsRp2ZRofBm0jV3rXv9QfLn6gfTg2fAVnLonYmZE=; b=ssioAEqd0ah7CjfYBNtR0kLHjwwYw/rqPQcy5UEwFLCdZes3gY/1OrVqc6LNdc8Flx lE4bxBPR+AngNSxhek7XlR7zgGZOVC8XF4iesySRoV+B7IjYQCaf4xngVNvBaLmJU+Lv er9IIRmxPr8DZgnYv90uJWo1Nzc6JRoWUyHec9y5jujSga+RmL1OabNN3ae1AkGK3ZKq /QfZOB364UshyTXyn9/gAV3PN0wEcGFUm5Ujue0y9QvFiAz3TEC53NlG87D++P1F4J/d eQ908ZP44I3uhRKTVozJVqwyX11YHzT3u3JPZqCf2jPDjGnOKz9mLZMuFSYEJK0QuSBz SpRg== X-Gm-Message-State: AOJu0Yzkk8HyU/Pms48X5CalYRtDz4icFaXQpJRoPwuEra0dEmGhTFrf YoJCFtY98myDATTQQDc5g9lr9YByPoWVCGjRuvNtxHN0f3nKJnJW5Pc8v0TMhC5wxOSR2w9iw5m ztqynxxQHOi5ZdN097oKAlt1+H54hD5c+XVkVIQRFnAG8C2XRmOFetnfWChyYE2o41swO+Jw= X-Received: by 2002:a05:600c:3c99:b0:405:5ffd:21d2 with SMTP id bg25-20020a05600c3c9900b004055ffd21d2mr4657879wmb.19.1697644752245; Wed, 18 Oct 2023 08:59:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6VqOL9QHNjqlYbTdBUG6i2+7Xp4w0XSnLg1FarPMAehZPhH4fsubSsVM1hoWyZP3f5sq0mQ== X-Received: by 2002:a05:600c:3c99:b0:405:5ffd:21d2 with SMTP id bg25-20020a05600c3c9900b004055ffd21d2mr4657852wmb.19.1697644751837; Wed, 18 Oct 2023 08:59:11 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id d3-20020adfef83000000b0032dc2110d01sm2402717wro.61.2023.10.18.08.59.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:59:11 -0700 (PDT) Date: Wed, 18 Oct 2023 11:59:06 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Li Feng , Raphael Norwitz , Paolo Bonzini , Fam Zheng Subject: [PULL 75/83] vhost-user-scsi: start vhost when guest kicks Message-ID: <02c4863bd64f206011faecf3c0c934d9e1052b25.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Li Feng Let's keep the same behavior as vhost-user-blk. Some old guests kick virtqueue before setting VIRTIO_CONFIG_S_DRIVER_OK. Signed-off-by: Li Feng Reviewed-by: Raphael Norwitz Message-Id: <20231009044735.941655-5-fengli@smartx.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/scsi/vhost-user-scsi.c | 48 +++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index 24c250d3f8..258fba5c69 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -92,8 +92,48 @@ static void vhost_user_scsi_set_status(VirtIODevice *vdev, uint8_t status) } } -static void vhost_dummy_handle_output(VirtIODevice *vdev, VirtQueue *vq) +static void vhost_user_scsi_handle_output(VirtIODevice *vdev, VirtQueue *vq) { + VHostUserSCSI *s = (VHostUserSCSI *)vdev; + DeviceState *dev = DEVICE(vdev); + VHostSCSICommon *vsc = VHOST_SCSI_COMMON(s); + VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(dev); + + Error *local_err = NULL; + int i, ret; + + if (!vdev->start_on_kick) { + return; + } + + if (!s->connected) { + return; + } + + if (vhost_dev_is_started(&vsc->dev)) { + return; + } + + /* + * Some guests kick before setting VIRTIO_CONFIG_S_DRIVER_OK so start + * vhost here instead of waiting for .set_status(). + */ + ret = vhost_user_scsi_start(s, &local_err); + if (ret < 0) { + error_reportf_err(local_err, "vhost-user-scsi: vhost start failed: "); + qemu_chr_fe_disconnect(&vs->conf.chardev); + return; + } + + /* Kick right away to begin processing requests already in vring */ + for (i = 0; i < vsc->dev.nvqs; i++) { + VirtQueue *kick_vq = virtio_get_queue(vdev, i); + + if (!virtio_queue_get_desc_addr(vdev, i)) { + continue; + } + event_notifier_set(virtio_queue_get_host_notifier(kick_vq)); + } } static int vhost_user_scsi_connect(DeviceState *dev, Error **errp) @@ -220,9 +260,9 @@ static void vhost_user_scsi_realize(DeviceState *dev, Error **errp) return; } - virtio_scsi_common_realize(dev, vhost_dummy_handle_output, - vhost_dummy_handle_output, - vhost_dummy_handle_output, &err); + virtio_scsi_common_realize(dev, vhost_user_scsi_handle_output, + vhost_user_scsi_handle_output, + vhost_user_scsi_handle_output, &err); if (err != NULL) { error_propagate(errp, err); return; From patchwork Wed Oct 18 15:59:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851010 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=WZk/yzEK; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bFz0HXSz20Zj for ; Thu, 19 Oct 2023 03:02:15 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8xG-0001zM-Dk; Wed, 18 Oct 2023 11:59:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8x9-0001nj-O9 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:59:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8x7-0007in-O5 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:59:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644761; 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=ZZl0LxwNYNj5QaupWvqvSXF37965ruXYyQiuuTdBRxU=; b=WZk/yzEK/+dVIWP5Abx5AqmlmC+4ax0zY2v37atZ91nE0C3HNciVGfKjaief6ehVehp2GU y3ACr2r0G3QiAlFUZ+BtnV502vclhd/wkgR2ISncNJdetijy76+rAMGfcBItCdvzwajyQW wkvi1nujf9wiyY2uypFKNduEOGsorSM= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-586-CuRZf2zENJCjat-boX3xgQ-1; Wed, 18 Oct 2023 11:59:20 -0400 X-MC-Unique: CuRZf2zENJCjat-boX3xgQ-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4083717431eso9052425e9.1 for ; Wed, 18 Oct 2023 08:59:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644758; x=1698249558; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ZZl0LxwNYNj5QaupWvqvSXF37965ruXYyQiuuTdBRxU=; b=dOdnZkKXqC5OmQUWgCBxtHUG+dQNc07Wldh5fFEjrsZ9N/EDFLQO/yat2lk1BEXX57 zyuoWDfXtnXFszmR1HNQ9u/zYgvYpsQZwjCnXPPMXeL8+Zxy2tM0k2fstCz9fch2oLnV +axvkK6eKFrNmyOWsjXdMum+X1BNmPF+d/A8XtGQ1Z/XdR3M94J1PneiPmS0J3McKVvh YT3hEcH8BlK8uodwfWcLLPeajBGmh12DZPZxchJlEuWGYonfz2Lr4fbP337sPhrRDPpH ZlPX2C8dNhYGyut9G7Qwbfl9ATpEyIx5rv6xjVTjmjnb7GvAKXU0N3bVdsds22xC5Ukl 7b+w== X-Gm-Message-State: AOJu0YzBAcIlvrNZIlB68H9DydaO+jGOLmwZ6ntZVmrjQ+HrRIsMgjir +8bpQO6PuUFklMFtJNkUqpm3gANB6gUYEAKiZQEY7ZLsFAp5jXVfWpjRBalXuBTHDrwGwHmEu+8 7IfBVRkgiAc5KQeIpi/SA7y6bn0pW4YrkLRMetIoNeTFkmVtT3PVugFsUOuhmzMRbKwcGIi4= X-Received: by 2002:a05:600c:4fc8:b0:406:53ab:a9af with SMTP id o8-20020a05600c4fc800b0040653aba9afmr4314891wmq.10.1697644758189; Wed, 18 Oct 2023 08:59:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG5n39XHQJZhjxqhdJMaWIkbpHVmekLLH0iPnHaKdEPhjqDEETOaXDPvyFCU12mimdmCDkvWQ== X-Received: by 2002:a05:600c:4fc8:b0:406:53ab:a9af with SMTP id o8-20020a05600c4fc800b0040653aba9afmr4314869wmq.10.1697644757827; Wed, 18 Oct 2023 08:59:17 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id je6-20020a05600c1f8600b004063ea92492sm2051575wmb.22.2023.10.18.08.59.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:59:17 -0700 (PDT) Date: Wed, 18 Oct 2023 11:59:12 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Li Feng , Raphael Norwitz , Kevin Wolf , Hanna Reitz , Paolo Bonzini , Fam Zheng , Alex =?utf-8?q?Benn=C3=A9e?= , Viresh Kumar , qemu-block@nongnu.org Subject: [PULL 76/83] vhost-user: fix lost reconnect Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Li Feng When the vhost-user is reconnecting to the backend, and if the vhost-user fails at the get_features in vhost_dev_init(), then the reconnect will fail and it will not be retriggered forever. The reason is: When the vhost-user fails at get_features, the vhost_dev_cleanup will be called immediately. vhost_dev_cleanup calls 'memset(hdev, 0, sizeof(struct vhost_dev))'. The reconnect path is: vhost_user_blk_event vhost_user_async_close(.. vhost_user_blk_disconnect ..) qemu_chr_fe_set_handlers <----- clear the notifier callback schedule vhost_user_async_close_bh The vhost->vdev is null, so the vhost_user_blk_disconnect will not be called, then the event fd callback will not be reinstalled. All vhost-user devices have this issue, including vhost-user-blk/scsi. With this patch, if the vdev->vdev is null, the fd callback will still be reinstalled. Fixes: 71e076a07d ("hw/virtio: generalise CHR_EVENT_CLOSED handling") Signed-off-by: Li Feng Reviewed-by: Raphael Norwitz Message-Id: <20231009044735.941655-6-fengli@smartx.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost-user.h | 3 ++- hw/block/vhost-user-blk.c | 2 +- hw/scsi/vhost-user-scsi.c | 3 ++- hw/virtio/vhost-user-gpio.c | 2 +- hw/virtio/vhost-user.c | 10 ++++++++-- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/hw/virtio/vhost-user.h b/include/hw/virtio/vhost-user.h index 9f9ddf878d..6b06ecb1bd 100644 --- a/include/hw/virtio/vhost-user.h +++ b/include/hw/virtio/vhost-user.h @@ -106,6 +106,7 @@ typedef void (*vu_async_close_fn)(DeviceState *cb); void vhost_user_async_close(DeviceState *d, CharBackend *chardev, struct vhost_dev *vhost, - vu_async_close_fn cb); + vu_async_close_fn cb, + IOEventHandler *event_cb); #endif diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index 3c69fa47d5..95c758200d 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -391,7 +391,7 @@ static void vhost_user_blk_event(void *opaque, QEMUChrEvent event) case CHR_EVENT_CLOSED: /* defer close until later to avoid circular close */ vhost_user_async_close(dev, &s->chardev, &s->dev, - vhost_user_blk_disconnect); + vhost_user_blk_disconnect, vhost_user_blk_event); break; case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index 258fba5c69..4486500cac 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -212,7 +212,8 @@ static void vhost_user_scsi_event(void *opaque, QEMUChrEvent event) case CHR_EVENT_CLOSED: /* defer close until later to avoid circular close */ vhost_user_async_close(dev, &vs->conf.chardev, &vsc->dev, - vhost_user_scsi_disconnect); + vhost_user_scsi_disconnect, + vhost_user_scsi_event); break; case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: diff --git a/hw/virtio/vhost-user-gpio.c b/hw/virtio/vhost-user-gpio.c index fc784e4213..aff2d7eff6 100644 --- a/hw/virtio/vhost-user-gpio.c +++ b/hw/virtio/vhost-user-gpio.c @@ -289,7 +289,7 @@ static void vu_gpio_event(void *opaque, QEMUChrEvent event) case CHR_EVENT_CLOSED: /* defer close until later to avoid circular close */ vhost_user_async_close(dev, &gpio->chardev, &gpio->vhost_dev, - vu_gpio_disconnect); + vu_gpio_disconnect, vu_gpio_event); break; case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index f9414f03de..b8a7b5542d 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -2756,6 +2756,7 @@ typedef struct { DeviceState *dev; CharBackend *cd; struct vhost_dev *vhost; + IOEventHandler *event_cb; } VhostAsyncCallback; static void vhost_user_async_close_bh(void *opaque) @@ -2770,7 +2771,10 @@ static void vhost_user_async_close_bh(void *opaque) */ if (vhost->vdev) { data->cb(data->dev); - } + } else if (data->event_cb) { + qemu_chr_fe_set_handlers(data->cd, NULL, NULL, data->event_cb, + NULL, data->dev, NULL, true); + } g_free(data); } @@ -2782,7 +2786,8 @@ static void vhost_user_async_close_bh(void *opaque) */ void vhost_user_async_close(DeviceState *d, CharBackend *chardev, struct vhost_dev *vhost, - vu_async_close_fn cb) + vu_async_close_fn cb, + IOEventHandler *event_cb) { if (!runstate_check(RUN_STATE_SHUTDOWN)) { /* @@ -2798,6 +2803,7 @@ void vhost_user_async_close(DeviceState *d, data->dev = d; data->cd = chardev; data->vhost = vhost; + data->event_cb = event_cb; /* Disable any further notifications on the chardev */ qemu_chr_fe_set_handlers(chardev, From patchwork Wed Oct 18 15:59:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851126 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Nm2gOCTn; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9dY04K0dz20Pd for ; Thu, 19 Oct 2023 04:45:24 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8xM-000299-GE; Wed, 18 Oct 2023 11:59:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8xK-00026q-Sb for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:59:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8xJ-0007lr-Ah for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:59:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644772; 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=VzMBUbudylul0FJkLWku7UAionEGDwih3IlnCHi1rwI=; b=Nm2gOCTnsPeO2PVsj6MyftMyay4Gm7cWOEdNAYCDf8Hur7OeNGDtFPgu2nt+oK4L1xrEIW e9G8izHdDmvXFyaxl1VAuDMWSMg6Xjh1UyouWrgLD6g37RBhZUrEIq50yIxJKMN1PW0me4 /KQg7lwy6qOwhaOBL5LOMd4PVohMXdo= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-6-ZEes34kBOMuv4pUri_msuw-1; Wed, 18 Oct 2023 11:59:26 -0400 X-MC-Unique: ZEes34kBOMuv4pUri_msuw-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-32db9cd71d7so1651161f8f.0 for ; Wed, 18 Oct 2023 08:59:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644765; x=1698249565; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=VzMBUbudylul0FJkLWku7UAionEGDwih3IlnCHi1rwI=; b=fhTLUzomrPCrQUKJmdN3/AdlQy4WvGsUSEs6+5+w7dh9Lc1uEpnfcBOFoMeQKxId51 1/HSvo9LPHKeUzADeTILHpsN3Lxe4bqaEFKjvVuF6nZi5oX9pu5RjXutM0IZM6cnk7e0 T+uRTvejpBR8wJeOIvGrllMCUAjWeKpU/XuDjjaGEhAXD6fOkq8TFht4SEmFJaGwXgE+ p5sNw3FgbtN3Pa/KB3ROUrOhleWo8ow/8zvfam6W6bV2nwBjEoxGy1s0uGxnLOMyv8hF 55KViEKUU2GK5kJqNokR42kHhO+QPcDCPjmupxi5+zCGaPHIZuh6Qo2wNQqRAdKFiHNZ zdUw== X-Gm-Message-State: AOJu0YwNmL866IYeqBwvh+lXmk/Cu/QF+pPDx7eTU8CrP4RzRQKeeBMx m0/daNMyJY7f00iFk3fa8rLEioelo1AOvGHQylqtklTzRkxOF7T/1HZnCBg+zSHWsxx3zSrepyq SvzbCNzNogWUkgZYicsNrgFUrmMKwLO9DltHkRIJQLlfd0WjZON1y3OeO+1O7DIiV9qTnWNU= X-Received: by 2002:adf:b1d1:0:b0:32d:a366:7073 with SMTP id r17-20020adfb1d1000000b0032da3667073mr5165683wra.14.1697644765066; Wed, 18 Oct 2023 08:59:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEydfYwc5YqRRwMcFbOjylKnkyezyIBzEC5juEGbVbGMo9X3+YUd2G49AbWr3FO3Edd3bnr7w== X-Received: by 2002:adf:b1d1:0:b0:32d:a366:7073 with SMTP id r17-20020adfb1d1000000b0032da3667073mr5165665wra.14.1697644764811; Wed, 18 Oct 2023 08:59:24 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id t22-20020a05600c41d600b004083996dad8sm1971001wmh.18.2023.10.18.08.59.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:59:24 -0700 (PDT) Date: Wed, 18 Oct 2023 11:59:18 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Ani Sinha , Jonathan Cameron , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 77/83] hw/i386/cxl: ensure maxram is greater than ram size for calculating cxl range Message-ID: <5c725185bd332203c070440b230450cbefa80c69.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Ani Sinha pc_get_device_memory_range() finds the device memory size by calculating the difference between maxram and ram sizes. This calculation makes sense only when maxram is greater than the ram size. Make sure we check for that before calling pc_get_device_memory_range(). Signed-off-by: Ani Sinha Message-Id: <20231011105335.42296-1-anisinha@redhat.com> Acked-by: Jonathan Cameron Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/pc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 6293f57a0c..dbaefa7617 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -781,10 +781,12 @@ static void pc_get_device_memory_range(PCMachineState *pcms, static uint64_t pc_get_cxl_range_start(PCMachineState *pcms) { PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms); + MachineState *ms = MACHINE(pcms); hwaddr cxl_base; ram_addr_t size; - if (pcmc->has_reserved_memory) { + if (pcmc->has_reserved_memory && + (ms->ram_size < ms->maxram_size)) { pc_get_device_memory_range(pcms, &cxl_base, &size); cxl_base += size; } else { From patchwork Wed Oct 18 15:59:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851075 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fFVaxE3N; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9cfp5yf6z20Pd for ; Thu, 19 Oct 2023 04:05:22 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8xi-00037y-FR; Wed, 18 Oct 2023 11:59:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8xR-0002QW-S5 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:59:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8xQ-0007ma-EN for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:59:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644779; 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=YGr1H8ijLV736mqcmWstFWaefAIRGO/VVLKqx2ky5/4=; b=fFVaxE3NORuikTp3pq+eUZQzoXme4hXSpnaEHeq9BADSi2VYYCDfoXj5GIMxmraN6V9kSz /MB1jSnGU6OHq9a0h70kwPevV6DcvPlnFHHXcSalhuq+HweCwOkBXbKdn3h5h8xa1aCtf/ g+sQwxWc8xNN4kgY5oi6qGH1N5rs1UM= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-556-EvZX0OmGPx-tPmVVReQncQ-1; Wed, 18 Oct 2023 11:59:36 -0400 X-MC-Unique: EvZX0OmGPx-tPmVVReQncQ-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3fe1521678fso49857435e9.1 for ; Wed, 18 Oct 2023 08:59:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644774; x=1698249574; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=YGr1H8ijLV736mqcmWstFWaefAIRGO/VVLKqx2ky5/4=; b=WqxixV0f3m1tj/FHWfD5vHv9cBIAHzyGcluTwaAsuTh2j4zFq5xgqTl4SVyaQYQlNW 0WJiJbTSjdFSAAm5Hk6wpwBfnbn5nNrdQBOCG5D5xD6I1fvqhhHIy2mHjMf2mQMu5KJg hl/ePg/mUIkZ0M1bOIdCP3atn2lP4FODvtuVv5OFO6sxovuGZPDllkOIE8vcugrd6rta PBu3nd7oG/5OdIiw8bpSrAZ9Xo1TypNXnRFtHwPyhubfhxBFtOp9/GQffo/4kacbIwQW 0Ejh+Ql3bFu06lLhqOPMWid388K889DGLhG5zQmmIxv3a6tfgBwvtPrYquyd1UweBZ5L 7ZsQ== X-Gm-Message-State: AOJu0Yx5bWM8M01xIYxpt0g2LPGZfgAHDDE57lBMsiBcFcTudNkPHA1Z JajL6zDR2OLXqzNYkVWex8LZ3tcVG37EdiwDqATFUeJtxx7jwyjaMcTlMr9FNv3r3eUT5QICUer AtS8I/x0WZ8lDhmLtVWscDMOESqvMd52Cr3gjq84ukXpPLyVXnvbAcYTkdu+IUYQ3vYODl3o= X-Received: by 2002:adf:ef05:0:b0:31f:8999:c409 with SMTP id e5-20020adfef05000000b0031f8999c409mr4565556wro.66.1697644774419; Wed, 18 Oct 2023 08:59:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGftO7mDq8bIiDJLKH2MjBnOg2PjUxh2ikE4qGIBXgTr+U4OyW6j0kxeVJ/68O9fWY9UaB1Ew== X-Received: by 2002:adf:ef05:0:b0:31f:8999:c409 with SMTP id e5-20020adfef05000000b0031f8999c409mr4565543wro.66.1697644774139; Wed, 18 Oct 2023 08:59:34 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id k1-20020a5d66c1000000b0032dbf99bf4fsm2384768wrw.89.2023.10.18.08.59.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:59:33 -0700 (PDT) Date: Wed, 18 Oct 2023 11:59:26 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Fan Ni , Dave Jiang , Igor Mammedov , Ani Sinha Subject: [PULL 78/83] tests/acpi: Allow update of DSDT.cxl Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jonathan Cameron Addition of QTG in following patch requires an update to the test data. Signed-off-by: Jonathan Cameron Reviewed-by: Fan Ni Reviewed-by: Dave Jiang Message-Id: <20231012125623.21101-2-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..9ce0f596cc 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,2 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/q35/DSDT.cxl", From patchwork Wed Oct 18 15:59:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851070 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Lr7/Owsy; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9cd51n3Nz20Zj for ; Thu, 19 Oct 2023 04:03:53 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8xk-0003Gz-Rp; Wed, 18 Oct 2023 12:00:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8xX-0002Xz-4J for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:59:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8xU-0007mt-Qh for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:59:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644783; 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=yRc5fadVObBzSTIUVVUCoFqEpnBFobcqZOmUrCHqKqM=; b=Lr7/OwsyEfvC+/ZxvMrnAzt3pOGdnYHP/FTfRftvQ+WPbsd4WKJUS4jJ37msvSrP3ri36k zHOg1+e8dQs9LyyIa67YVBdcHM77kH2r5lCoWANFoBnCm7fZwoQZhOPC3LPhl740dpA6RB lx1jXviMtILAwl+M4RwMFj0unGbhn44= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-523-P2-W9NOzPJ-t6T_-pZupeg-1; Wed, 18 Oct 2023 11:59:42 -0400 X-MC-Unique: P2-W9NOzPJ-t6T_-pZupeg-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-406de77fb85so44722525e9.0 for ; Wed, 18 Oct 2023 08:59:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644781; x=1698249581; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=yRc5fadVObBzSTIUVVUCoFqEpnBFobcqZOmUrCHqKqM=; b=qhLoSLt7UYpjlgKFlOprmN4/EXkFewGir71qOkUrHlqiVnaNwQumdF13E0Pqc3Jb5N YWRCnW5oApLIoOjd7igxnlRogfE1JI8mCyRyEVLcVTWr30lswILEO7a29louKGo/dbLr kL8XjOyMbJ5QKU5wSA5SOG8BoXxzYO/ZBPwrJL1HgnED5cxiAmOu9oDRdPrmg1d/mUEe zIAkGMfdeVauxQTYz1zoGEcp1LrwbhxDlF3Qzf+NsugSPfZpfKJsau+vEy6Vs69xvXEp 7V07KyXkq8vp5wZo+eIK/WpIMAkZzJ8f9aN3q2oKhmLU+E41o5jpoAiTtgIQ3D5dLW8g 2iLg== X-Gm-Message-State: AOJu0YycRcDf8q8hLifQ4VN/lndNe2ARGxMfnjFnOcyHY2spqpnC2+h3 fJDwvySGlUbkjqzi4i/fkEvA4OvbrqcXjhWt5suyf6fCpKi3dzXXf6AShCgd0mUNWNoFHyPUj4a KsMeYdvleEdpislVmsDbtzYMJzMp+Ob15wsN4vTe+8QyAGl7e2iPbWSX7Lk93qhxryJDNPjo= X-Received: by 2002:a05:6000:c4:b0:32d:9b3c:9c05 with SMTP id q4-20020a05600000c400b0032d9b3c9c05mr4240575wrx.55.1697644780849; Wed, 18 Oct 2023 08:59:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE8F+zv6MWjKKYcUkHZ4MIK0LBtKcbZJdUYEuNuKSnz4e7Y3EFiSR5HQSpAVC+X8ksmh3RZtQ== X-Received: by 2002:a05:6000:c4:b0:32d:9b3c:9c05 with SMTP id q4-20020a05600000c400b0032d9b3c9c05mr4240551wrx.55.1697644780373; Wed, 18 Oct 2023 08:59:40 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id bs30-20020a056000071e00b0032d9a1f2ec3sm2466007wrb.27.2023.10.18.08.59.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:59:39 -0700 (PDT) Date: Wed, 18 Oct 2023 11:59:34 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Dave Jiang , Jonathan Cameron , Igor Mammedov , Ani Sinha , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 79/83] hw/cxl: Add QTG _DSM support for ACPI0017 device Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Dave Jiang Add a simple _DSM call support for the ACPI0017 device to return fake QTG ID values of 0 and 1 in all cases. This for _DSM plumbing testing from the OS. Following edited for readability Device (CXLM) { Name (_HID, "ACPI0017") // _HID: Hardware ID ... Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method { If ((Arg0 == ToUUID ("f365f9a6-a7de-4071-a66a-b40c0b4f8e52"))) { If ((Arg2 == Zero)) { Return (Buffer (One) { 0x01 }) } If ((Arg2 == One)) { Return (Package (0x02) { One, Package (0x02) { Zero, One } }) } } } Signed-off-by: Dave Jiang Signed-off-by: Jonathan Cameron Message-Id: <20231012125623.21101-3-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/cxl.h | 1 + hw/acpi/cxl.c | 69 +++++++++++++++++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 1 + 3 files changed, 71 insertions(+) diff --git a/include/hw/acpi/cxl.h b/include/hw/acpi/cxl.h index acf4418886..8f22c71530 100644 --- a/include/hw/acpi/cxl.h +++ b/include/hw/acpi/cxl.h @@ -25,5 +25,6 @@ void cxl_build_cedt(GArray *table_offsets, GArray *table_data, BIOSLinker *linker, const char *oem_id, const char *oem_table_id, CXLState *cxl_state); void build_cxl_osc_method(Aml *dev); +void build_cxl_dsm_method(Aml *dev); #endif diff --git a/hw/acpi/cxl.c b/hw/acpi/cxl.c index 92b46bc932..9cd7905ea2 100644 --- a/hw/acpi/cxl.c +++ b/hw/acpi/cxl.c @@ -30,6 +30,75 @@ #include "qapi/error.h" #include "qemu/uuid.h" +void build_cxl_dsm_method(Aml *dev) +{ + Aml *method, *ifctx, *ifctx2; + + method = aml_method("_DSM", 4, AML_SERIALIZED); + { + Aml *function, *uuid; + + uuid = aml_arg(0); + function = aml_arg(2); + /* CXL spec v3.0 9.17.3.1 _DSM Function for Retrieving QTG ID */ + ifctx = aml_if(aml_equal( + uuid, aml_touuid("F365F9A6-A7DE-4071-A66A-B40C0B4F8E52"))); + + /* Function 0, standard DSM query function */ + ifctx2 = aml_if(aml_equal(function, aml_int(0))); + { + uint8_t byte_list[1] = { 0x01 }; /* function 1 only */ + + aml_append(ifctx2, + aml_return(aml_buffer(sizeof(byte_list), byte_list))); + } + aml_append(ifctx, ifctx2); + + /* + * Function 1 + * Creating a package with static values. The max supported QTG ID will + * be 1 and recommended QTG IDs are 0 and then 1. + * The values here are statically created to simplify emulation. Values + * from a real BIOS would be determined by the performance of all the + * present CXL memory and then assigned. + */ + ifctx2 = aml_if(aml_equal(function, aml_int(1))); + { + Aml *pak, *pak1; + + /* + * Return: A package containing two elements - a WORD that returns + * the maximum throttling group that the platform supports, and a + * package containing the QTG ID(s) that the platform recommends. + * Package { + * Max Supported QTG ID + * Package {QTG Recommendations} + * } + * + * While the SPEC specified WORD that hints at the value being + * 16bit, the ACPI dump of BIOS DSDT table showed that the values + * are integers with no specific size specification. aml_int() will + * be used for the values. + */ + pak1 = aml_package(2); + /* Set QTG ID of 0 */ + aml_append(pak1, aml_int(0)); + /* Set QTG ID of 1 */ + aml_append(pak1, aml_int(1)); + + pak = aml_package(2); + /* Set Max QTG 1 */ + aml_append(pak, aml_int(1)); + aml_append(pak, pak1); + + aml_append(ifctx2, aml_return(pak)); + } + aml_append(ifctx, ifctx2); + } + aml_append(method, ifctx); + aml_append(dev, method); +} + static void cedt_build_chbs(GArray *table_data, PXBCXLDev *cxl) { PXBDev *pxb = PXB_DEV(cxl); diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index b0e1f074f1..80db183b78 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1417,6 +1417,7 @@ static void build_acpi0017(Aml *table) method = aml_method("_STA", 0, AML_NOTSERIALIZED); aml_append(method, aml_return(aml_int(0x01))); aml_append(dev, method); + build_cxl_dsm_method(dev); aml_append(scope, dev); aml_append(table, scope); From patchwork Wed Oct 18 15:59:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851004 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=JtFZaT6X; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bDl2ZNjz20Zj for ; Thu, 19 Oct 2023 03:01:11 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8xp-0003QO-NT; Wed, 18 Oct 2023 12:00:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8xd-0002sk-5S for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:59:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8xb-0007nN-7p for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:59:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644790; 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=3gMlvdquObTcfo3FR9W9RmnS7UYRddpgF0RI5ANGAvI=; b=JtFZaT6XLxaRiq4e3YvasO5U05JIfxqmXSg1cQ7CY31WUxPgQNt+mx5uNw3lE1S0oidtI1 nwvkaoK7SL1588R/qd4yi1Mn9qqnGEJyM4ZAdpELvUBjbmbRvYKiR6XGZojuQD1Wq66YOr mzbU1axhI9lUGE/aqiN5AjPNc4o4pyE= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-176-x1kqF8YUPfmlzld_LSMjxQ-1; Wed, 18 Oct 2023 11:59:48 -0400 X-MC-Unique: x1kqF8YUPfmlzld_LSMjxQ-1 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2c50c873604so49686571fa.1 for ; Wed, 18 Oct 2023 08:59:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644786; x=1698249586; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3gMlvdquObTcfo3FR9W9RmnS7UYRddpgF0RI5ANGAvI=; b=Go1X9RtjPNSJNivEM98lFZb/nvDFg8xGmWH0F2cY5Vi9kvzuBDjv5s5GfqjjubA6tB WVu0918ywrJmXm8hKYOEsgitlv7aPslI8Vduu/cgDwyYU6ERfLHoU47kpj/4/pqM4dpH U6nJxu9DxOZZM1E6cEcZLt3OQK/GhJ3MowGmSaQV31wr8YpZiILddLGkmLc4v1k2zTC9 61FHBe8If2HtGDCdiyuvf9a4ibMQxayatDZPJH4nf0XrpWSm5hXXV5AE3kduijbsRptH g4BJ30rtNtj7fLhzMIWoPJumUx8e+qPKm38im3xhpaDGBl3geDb/Mrgf2el6CuKEqBib K2kw== X-Gm-Message-State: AOJu0YyrLmvLQwg43cSvvrqtoY5DDu3qOlAXAqO1gfafwG0OJf2jlOFJ aS962+h7UZ2UFdOPYrLX+9YW7hB4iXxg0eus7rmcAwtvCq4DW8tYeizjyXO0DA3JtdlV1jbqP4G L1TXRWdAkAHGnh9fp8PLuVyI/ThpLxhEVAnZh2x99M46dtMnCQQY7cbrJxhA8U7ynuAUNvtU= X-Received: by 2002:a2e:5411:0:b0:2c5:d3c:8f4d with SMTP id i17-20020a2e5411000000b002c50d3c8f4dmr4075303ljb.13.1697644786699; Wed, 18 Oct 2023 08:59:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGd3vesm4SqiLLk+CGYKGyRMOcIaYi16iAE0O++nITUqHeOTdkECIzJB2DQoCunRaHUA+uXPQ== X-Received: by 2002:a2e:5411:0:b0:2c5:d3c:8f4d with SMTP id i17-20020a2e5411000000b002c50d3c8f4dmr4075284ljb.13.1697644786377; Wed, 18 Oct 2023 08:59:46 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id w24-20020a05600c099800b0040652e8ca13sm1978163wmp.43.2023.10.18.08.59.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:59:45 -0700 (PDT) Date: Wed, 18 Oct 2023 11:59:40 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Fan Ni , Dave Jiang , Igor Mammedov , Ani Sinha Subject: [PULL 80/83] tests/acpi: Update DSDT.cxl with QTG DSM Message-ID: <7c6f17793f3f3338d8a4018588c3fc3a1527c064.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jonathan Cameron Description of change in previous patch. Signed-off-by: Jonathan Cameron Reviewed-by: Fan Ni Reviewed-by: Dave Jiang Message-Id: <20231012125623.21101-4-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 1 - tests/data/acpi/q35/DSDT.cxl | Bin 9655 -> 9713 bytes 2 files changed, 1 deletion(-) diff --git a/tests/data/acpi/q35/DSDT.cxl b/tests/data/acpi/q35/DSDT.cxl index ee16a861c2de7b7caaf11d91c50fcdf308815233..145301c52af9a17242bb306c210f8a7e0f01b827 100644 GIT binary patch delta 118 zcmV-+0Ez#%OYutzL{mgm@g)EN0r#;Aks)191z%G_Ut5Ak1w&X&O$c8|Nkk1nLr_UD zFflg(6bN5aR6ziw0Tef1L{m)+pfHnY5fcg!ruk*_-luUurfRed3r~(xpb3*|0HhHE Y0Rf;6lWGB^5(okT5(EMOv%Vqu1A45k9^g@gANoypGNRo(2Yn<_sbn Q@xdXE3`;iuQ2faZ03i7h)c^nh diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index 9ce0f596cc..dfb8523c8b 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1,2 +1 @@ /* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/q35/DSDT.cxl", From patchwork Wed Oct 18 15:59:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851030 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=V8d5lcil; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bkY4qGYz20Pd for ; Thu, 19 Oct 2023 03:23:33 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8y3-0003ub-1E; Wed, 18 Oct 2023 12:00:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8xt-0003aH-Hg for qemu-devel@nongnu.org; Wed, 18 Oct 2023 12:00:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8xr-0007pY-Gc for qemu-devel@nongnu.org; Wed, 18 Oct 2023 12:00:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644806; 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=JiiYhEn2+u0WRlW+XdV6xUMe7KHlpW6+J9WCJ40wsY8=; b=V8d5lcilz7WBpzpEBr+UFgG53xroF5xBht1u+yTSXEEfyuzho/DuBd0ui+QzmYEuKUWlzP WETW2MexJbIyoKrslP83Y5qd3tLbsuTVX+ToaX7JUK/NzvUMtQzKpEQ46MW9q4FV7ByQ/V uVj54Tq2+7VOlH/W/VOnb3PbDzU3WS0= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-516-1BJL-xzWN1Okq1HdZfQyRQ-1; Wed, 18 Oct 2023 11:59:54 -0400 X-MC-Unique: 1BJL-xzWN1Okq1HdZfQyRQ-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-407558fe418so47214185e9.0 for ; Wed, 18 Oct 2023 08:59:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644791; x=1698249591; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=JiiYhEn2+u0WRlW+XdV6xUMe7KHlpW6+J9WCJ40wsY8=; b=MdNbTw7h/C2B17hzPvnpaYUQRW8H9sDX6FO7YCx5dGBfKxgqFkTjvHfhRHI4gtR6q5 NCLLXt56i75mnVntui8WTiJZmwugl39Mb7J5ZHam++e20AEODaZlGwqWaucOXylN95Mc A2tJTv4aik3Wb+eUeDvlStOFX8vMjP8h/o3g1l/NzleWwEdUqcAUZGuT07FCKbTTHAaw sqxewCnOqJxRnXwAWAgHpZW91eV1SQCbxwCDgh9gAtEhjExZAcZkHkrWgwZQbMfoOFdt g88j2sYxY9Q4sFdbs9AaQcpH3C46R1SeskTKQNV+WsMuHZw8lO8HeURY3J3MKO55nXnu iNmw== X-Gm-Message-State: AOJu0YyaLWFW88SmUyt83mBJBawAJT4vNAqXRetp7K8/nkc1qopk75RX MTx3evn83nlDzGmLUfMYtjKd+4gK2kvXjyNaBHxjSj6g20D1HcSdiG6/K6l22KW1T0IAcfrQ7rr P1NxFFrNMBqlOS8WBiZ4rjgg8SLxD8uBiMafn1WnoH+rvadPQv+hBtJ6MQwKMwlhve9OwER4= X-Received: by 2002:a05:600c:46c3:b0:407:5adc:4497 with SMTP id q3-20020a05600c46c300b004075adc4497mr4403161wmo.9.1697644791313; Wed, 18 Oct 2023 08:59:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFCBNE6ahs0MfkCRU/T2kOXiCA/qfxDRNFscrUldC7EgTkk5rEjCk5DAZRC1FEGZixORG+2zA== X-Received: by 2002:a05:600c:46c3:b0:407:5adc:4497 with SMTP id q3-20020a05600c46c300b004075adc4497mr4403141wmo.9.1697644790926; Wed, 18 Oct 2023 08:59:50 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id w4-20020a5d4b44000000b003271be8440csm2385204wrs.101.2023.10.18.08.59.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:59:50 -0700 (PDT) Date: Wed, 18 Oct 2023 11:59:46 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Hanna Czenczek , Emmanouil Pitsidianakis , Stefano Garzarella , Viresh Kumar , Stefan Hajnoczi Subject: [PULL 81/83] vhost-user: Fix protocol feature bit conflict Message-ID: <7a71e4031156d9b0c3cdf34d4b48d5724da1eeec.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Hanna Czenczek The VHOST_USER_PROTOCOL_F_XEN_MMAP feature bit was defined in f21e95ee97d, which has been part of qemu's 8.1.0 release. However, it seems it was never added to qemu's code, but it is well possible that it is already used by different front-ends outside of qemu (i.e., Xen). VHOST_USER_PROTOCOL_F_SHARED_OBJECT in contrast was added to qemu's code in 16094766627, but never defined in the vhost-user specification. As a consequence, both bits were defined to be 17, which cannot work. Regardless of whether actual code or the specification should take precedence, F_XEN_MMAP is already part of a qemu release, while F_SHARED_OBJECT is not. Therefore, bump the latter to take number 18 instead of 17, and add this to the specification. Take the opportunity to add at least a little note on the VhostUserShared structure to the specification. This structure is referenced by the new commands introduced in 16094766627, but was not defined. Fixes: 160947666276c5b7f6bca4d746bcac2966635d79 ("vhost-user: add shared_object msg") Signed-off-by: Hanna Czenczek Message-Id: <20231016083201.23736-1-hreitz@redhat.com> Reviewed-by: Emmanouil Pitsidianakis Reviewed-by: Stefano Garzarella Reviewed-by: Viresh Kumar Reviewed-by: Stefan Hajnoczi Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost-user.h | 3 ++- subprojects/libvhost-user/libvhost-user.h | 3 ++- docs/interop/vhost-user.rst | 11 +++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/hw/virtio/vhost-user.h b/include/hw/virtio/vhost-user.h index 6b06ecb1bd..20b69d8e85 100644 --- a/include/hw/virtio/vhost-user.h +++ b/include/hw/virtio/vhost-user.h @@ -29,7 +29,8 @@ enum VhostUserProtocolFeature { VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS = 14, VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS = 15, VHOST_USER_PROTOCOL_F_STATUS = 16, - VHOST_USER_PROTOCOL_F_SHARED_OBJECT = 17, + /* Feature 17 reserved for VHOST_USER_PROTOCOL_F_XEN_MMAP. */ + VHOST_USER_PROTOCOL_F_SHARED_OBJECT = 18, VHOST_USER_PROTOCOL_F_MAX }; diff --git a/subprojects/libvhost-user/libvhost-user.h b/subprojects/libvhost-user/libvhost-user.h index b36a42a7ca..c2352904f0 100644 --- a/subprojects/libvhost-user/libvhost-user.h +++ b/subprojects/libvhost-user/libvhost-user.h @@ -65,7 +65,8 @@ enum VhostUserProtocolFeature { VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS = 14, VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS = 15, /* Feature 16 is reserved for VHOST_USER_PROTOCOL_F_STATUS. */ - VHOST_USER_PROTOCOL_F_SHARED_OBJECT = 17, + /* Feature 17 reserved for VHOST_USER_PROTOCOL_F_XEN_MMAP. */ + VHOST_USER_PROTOCOL_F_SHARED_OBJECT = 18, VHOST_USER_PROTOCOL_F_MAX }; diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst index 415bb47a19..768fb5c28c 100644 --- a/docs/interop/vhost-user.rst +++ b/docs/interop/vhost-user.rst @@ -275,6 +275,16 @@ Inflight description :queue size: a 16-bit size of virtqueues +VhostUserShared +^^^^^^^^^^^^^^^ + ++------+ +| UUID | ++------+ + +:UUID: 16 bytes UUID, whose first three components (a 32-bit value, then + two 16-bit values) are stored in big endian. + C structure ----------- @@ -885,6 +895,7 @@ Protocol features #define VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS 15 #define VHOST_USER_PROTOCOL_F_STATUS 16 #define VHOST_USER_PROTOCOL_F_XEN_MMAP 17 + #define VHOST_USER_PROTOCOL_F_SHARED_OBJECT 18 Front-end message types ----------------------- From patchwork Wed Oct 18 15:59:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851100 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=S7nyNNXP; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9d0D19lKz20Pd for ; Thu, 19 Oct 2023 04:20:27 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8xx-0003jX-6I; Wed, 18 Oct 2023 12:00:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8xs-0003ZG-S0 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 12:00:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8xr-0007pH-1n for qemu-devel@nongnu.org; Wed, 18 Oct 2023 12:00:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644805; 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=CD+q+G2pfg+G/fTA/dZ5jOXbDYpzOBEKZujAnzbIZdU=; b=S7nyNNXP09e5XWDEdTYWja0pWW4l22pcqSSiJWUGLTabwWwXHwZm6bLNYjajzRVmLFISdJ 5lUiuKoQ12x9DxDZUzHjAd7wTBSoYgaYStUK/ATF6iZKaauO/i/CayFSZRMBFWpHHi4V1N AGzAEK4kGpooK00w1Z2vNuSkFTg4AHc= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-658-ECewP4QyN62yavZFAmikzg-1; Wed, 18 Oct 2023 12:00:03 -0400 X-MC-Unique: ECewP4QyN62yavZFAmikzg-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-3fe182913c5so44466485e9.0 for ; Wed, 18 Oct 2023 09:00:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644799; x=1698249599; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=CD+q+G2pfg+G/fTA/dZ5jOXbDYpzOBEKZujAnzbIZdU=; b=MYlDiwvtJqCzUTVoBqPo1oA2uKxB4lpWMrbzzEkS9dIik9BVNDz59jQK2sz9qszPjR HoW9qHgEfTIi3nAph3GLxoRG+PO4nrXhVnP9fo+L430COs4iuGjbwmt7IGRswU/JkElP 29D0SbVshwPSFXnmgtXnfNJiXI9T17tJ0kWRj7Noy4Wy39QQYk3UycLm7IREkI670qLf g3fqtlUU3HMNvC6p5n6JcSdYb5Ctf/ImUrEfYZJflV4IghQFTOxJf/WRiKqxyXXQDwvv Taj+AkiTqsd6Haj9e2EsB8D+d7SylA25k12k4DmxdyLb6aHQwPVcpX75S9ljIyMprf4K oDAA== X-Gm-Message-State: AOJu0Yy8jpPx/ZpH6wjr1wBYJaJ4MO85NkNYj8v9rJaNfI2HVa20J1cM +AckilShGfv6MNTa847UIRiNg30JtcIaA99YhwQF3ks5FmYFT17XovSuEIVhYQrtQmB4+8AW4X5 BN5pNnH9R43V9ggyWOZcAE8nxJxea3m5Nw/hFpMApSxgNlOKJyTTEFvXEfjfAoB70UC5l0II= X-Received: by 2002:a05:600c:138d:b0:401:bf87:9898 with SMTP id u13-20020a05600c138d00b00401bf879898mr4706380wmf.25.1697644799168; Wed, 18 Oct 2023 08:59:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE3hSvZtMiWuA7JtLAjEYZPNi28mz1xZMvzEzFpXVA5+79HUenXbsgig4yqyvISydGVVouqEQ== X-Received: by 2002:a05:600c:138d:b0:401:bf87:9898 with SMTP id u13-20020a05600c138d00b00401bf879898mr4706365wmf.25.1697644798855; Wed, 18 Oct 2023 08:59:58 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id g19-20020a05600c4ed300b003fefaf299b6sm2062905wmq.38.2023.10.18.08.59.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:59:58 -0700 (PDT) Date: Wed, 18 Oct 2023 11:59:51 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Thomas Huth , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Richard Henderson , Alex =?utf-8?q?Benn=C3=A9?= =?utf-8?q?e?= Subject: [PULL 82/83] MAINTAINERS: Add include/hw/intc/i8259.h to the PC chip section Message-ID: <7e3fb8ca55db27393c83d4b683c84fca2621698d.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Thomas Huth i8259.c is already listed here, so the corresponding header should be mentioned in this section, too. Signed-off-by: Thomas Huth Message-Id: <20231017152625.229022-1-thuth@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index d9fe5aa367..2f435102ec 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1764,6 +1764,7 @@ F: include/hw/dma/i8257.h F: include/hw/i2c/pm_smbus.h F: include/hw/input/i8042.h F: include/hw/intc/ioapic* +F: include/hw/intc/i8259.h F: include/hw/isa/i8259_internal.h F: include/hw/isa/superio.h F: include/hw/timer/hpet.h From patchwork Wed Oct 18 15:59:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1851009 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=i7SAuFwi; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S9bFv49h5z20Zj for ; Thu, 19 Oct 2023 03:02:11 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8y4-0003xi-5u; Wed, 18 Oct 2023 12:00:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8xz-0003q1-NP for qemu-devel@nongnu.org; Wed, 18 Oct 2023 12:00:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8xx-00080v-9A for qemu-devel@nongnu.org; Wed, 18 Oct 2023 12:00:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644812; 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=q7yLJhsKzBOqiWUrJA7Var67GrcuSuwHsIVThsjTdeY=; b=i7SAuFwiiOvyv+QllL/iDQBNg+6K8FQAKbS18c6nGgd+2F/Y2B0fdI1X2co4vX+GqTQkGA P56Nogcutn+qsvslwVEWw9M/1wTyCdtphfgP8Crb9+NvnJCuVs1wXeHIlx4EztYLEm8rs5 rrYhi44McjOBiO5HHCrglB0gwScoFHA= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-223-7dRrFcUdMBOKYaf1FGMCSQ-1; Wed, 18 Oct 2023 12:00:09 -0400 X-MC-Unique: 7dRrFcUdMBOKYaf1FGMCSQ-1 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-5079a66711eso5460405e87.1 for ; Wed, 18 Oct 2023 09:00:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644808; x=1698249608; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=q7yLJhsKzBOqiWUrJA7Var67GrcuSuwHsIVThsjTdeY=; b=DkO6yJ3jDiEFmyo9QRgQHOoHkgfdeOV1byCyXEs54hoETlFYMnFL+Ipzq50zFzcWMI CmPSOOI9xZc5xRoipVXJ6neK9Ocj1sByzbHCMBZTKYc3mGc7wFcHtHzcrrt3qHvgSzoW mSaoNUeRivnat+ec/uLR/aeEXUV3ipQaic8un+hl8LGT7dFPCkwJBLYJy19QTADLS/zl ebpaNyxzZyA2v2izURejOQdd830mK/EpwS6sPafdg+jrffSVEaH0v+L54MY3pRopNn0k x+83JfrS7ygbJd6TfhxIL6YYyn57ZBch2DjTzl1e+5ta3W+IjJ58TKAC8MTeeiUxQ9VO rZZg== X-Gm-Message-State: AOJu0Yw0ec8Wr0OQtc14Rk4TB+JHOmCpuOJJDq5XgAFLADIOhJp8tdkD thNN3AX8zbycYmxM/lsxJgBvzogybAq/q/uozrfHrkVxAn4c63330qoulcXExnFnbYhM4UBcYjB wjy4eXlcM6+QghiC7OptrHhbKEXjTyoOvQc40hbiFuSHrxBxiLBYVi52D1DrQZkCQrI/ZuOE= X-Received: by 2002:a05:6512:3b85:b0:507:a04c:76eb with SMTP id g5-20020a0565123b8500b00507a04c76ebmr5105562lfv.35.1697644807725; Wed, 18 Oct 2023 09:00:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEzGlgSNuyIsyGGTc6yrhddf5JtmkCyMk5Lp3qrRbxEUxjW5nG2Crh4vIB1ZXVmv1Fau+U7lg== X-Received: by 2002:a05:6512:3b85:b0:507:a04c:76eb with SMTP id g5-20020a0565123b8500b00507a04c76ebmr5105528lfv.35.1697644807234; Wed, 18 Oct 2023 09:00:07 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id y15-20020a5d614f000000b003142e438e8csm2396965wrt.26.2023.10.18.09.00.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 09:00:06 -0700 (PDT) Date: Wed, 18 Oct 2023 11:59:59 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , David Woodhouse , Peter Xu , Jason Wang , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 83/83] intel-iommu: Report interrupt remapping faults, fix return value Message-ID: <49ca8f122f3e84d7d879f3b4d54a5294b39764d1.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: David Woodhouse A generic X86IOMMUClass->int_remap function should not return VT-d specific values; fix it to return 0 if the interrupt was successfully translated or -EINVAL if not. The VTD_FR_IR_xxx values are supposed to be used to actually raise faults through the fault reporting mechanism, so do that instead for the case where the IRQ is actually being injected. There is more work to be done here, as pretranslations for the KVM IRQ routing table can't fault; an untranslatable IRQ should be handled in userspace and the fault raised only when the IRQ actually happens (if indeed the IRTE is still not valid at that time). But we can work on that later; we can at least raise faults for the direct case. Signed-off-by: David Woodhouse Message-Id: <31bbfc9041690449d3ac891f4431ec82174ee1b4.camel@infradead.org> Acked-by: Peter Xu Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/intel_iommu_internal.h | 1 + hw/i386/intel_iommu.c | 150 ++++++++++++++++++++++----------- 2 files changed, 103 insertions(+), 48 deletions(-) diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index e1450c5cfe..f8cf99bddf 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -268,6 +268,7 @@ #define VTD_FRCD_FI(val) ((val) & ~0xfffULL) #define VTD_FRCD_PV(val) (((val) & 0xffffULL) << 40) #define VTD_FRCD_PP(val) (((val) & 0x1) << 31) +#define VTD_FRCD_IR_IDX(val) (((val) & 0xffffULL) << 48) /* DMA Remapping Fault Conditions */ typedef enum VTDFaultReason { diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 2c832ab68b..30a108a42b 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -469,21 +469,12 @@ static void vtd_set_frcd_and_update_ppf(IntelIOMMUState *s, uint16_t index) /* Must not update F field now, should be done later */ static void vtd_record_frcd(IntelIOMMUState *s, uint16_t index, - uint16_t source_id, hwaddr addr, - VTDFaultReason fault, bool is_write, - bool is_pasid, uint32_t pasid) + uint64_t hi, uint64_t lo) { - uint64_t hi = 0, lo; hwaddr frcd_reg_addr = DMAR_FRCD_REG_OFFSET + (((uint64_t)index) << 4); assert(index < DMAR_FRCD_REG_NR); - lo = VTD_FRCD_FI(addr); - hi = VTD_FRCD_SID(source_id) | VTD_FRCD_FR(fault) | - VTD_FRCD_PV(pasid) | VTD_FRCD_PP(is_pasid); - if (!is_write) { - hi |= VTD_FRCD_T; - } vtd_set_quad_raw(s, frcd_reg_addr, lo); vtd_set_quad_raw(s, frcd_reg_addr + 8, hi); @@ -509,17 +500,11 @@ static bool vtd_try_collapse_fault(IntelIOMMUState *s, uint16_t source_id) } /* Log and report an DMAR (address translation) fault to software */ -static void vtd_report_dmar_fault(IntelIOMMUState *s, uint16_t source_id, - hwaddr addr, VTDFaultReason fault, - bool is_write, bool is_pasid, - uint32_t pasid) +static void vtd_report_frcd_fault(IntelIOMMUState *s, uint64_t source_id, + uint64_t hi, uint64_t lo) { uint32_t fsts_reg = vtd_get_long_raw(s, DMAR_FSTS_REG); - assert(fault < VTD_FR_MAX); - - trace_vtd_dmar_fault(source_id, fault, addr, is_write); - if (fsts_reg & VTD_FSTS_PFO) { error_report_once("New fault is not recorded due to " "Primary Fault Overflow"); @@ -539,8 +524,7 @@ static void vtd_report_dmar_fault(IntelIOMMUState *s, uint16_t source_id, return; } - vtd_record_frcd(s, s->next_frcd_reg, source_id, addr, fault, - is_write, is_pasid, pasid); + vtd_record_frcd(s, s->next_frcd_reg, hi, lo); if (fsts_reg & VTD_FSTS_PPF) { error_report_once("There are pending faults already, " @@ -565,6 +549,40 @@ static void vtd_report_dmar_fault(IntelIOMMUState *s, uint16_t source_id, } } +/* Log and report an DMAR (address translation) fault to software */ +static void vtd_report_dmar_fault(IntelIOMMUState *s, uint16_t source_id, + hwaddr addr, VTDFaultReason fault, + bool is_write, bool is_pasid, + uint32_t pasid) +{ + uint64_t hi, lo; + + assert(fault < VTD_FR_MAX); + + trace_vtd_dmar_fault(source_id, fault, addr, is_write); + + lo = VTD_FRCD_FI(addr); + hi = VTD_FRCD_SID(source_id) | VTD_FRCD_FR(fault) | + VTD_FRCD_PV(pasid) | VTD_FRCD_PP(is_pasid); + if (!is_write) { + hi |= VTD_FRCD_T; + } + + vtd_report_frcd_fault(s, source_id, hi, lo); +} + + +static void vtd_report_ir_fault(IntelIOMMUState *s, uint64_t source_id, + VTDFaultReason fault, uint16_t index) +{ + uint64_t hi, lo; + + lo = VTD_FRCD_IR_IDX(index); + hi = VTD_FRCD_SID(source_id) | VTD_FRCD_FR(fault); + + vtd_report_frcd_fault(s, source_id, hi, lo); +} + /* Handle Invalidation Queue Errors of queued invalidation interface error * conditions. */ @@ -3305,8 +3323,9 @@ static Property vtd_properties[] = { }; /* Read IRTE entry with specific index */ -static int vtd_irte_get(IntelIOMMUState *iommu, uint16_t index, - VTD_IR_TableEntry *entry, uint16_t sid) +static bool vtd_irte_get(IntelIOMMUState *iommu, uint16_t index, + VTD_IR_TableEntry *entry, uint16_t sid, + bool do_fault) { static const uint16_t vtd_svt_mask[VTD_SQ_MAX] = \ {0xffff, 0xfffb, 0xfff9, 0xfff8}; @@ -3317,7 +3336,10 @@ static int vtd_irte_get(IntelIOMMUState *iommu, uint16_t index, if (index >= iommu->intr_size) { error_report_once("%s: index too large: ind=0x%x", __func__, index); - return -VTD_FR_IR_INDEX_OVER; + if (do_fault) { + vtd_report_ir_fault(iommu, sid, VTD_FR_IR_INDEX_OVER, index); + } + return false; } addr = iommu->intr_root + index * sizeof(*entry); @@ -3325,7 +3347,10 @@ static int vtd_irte_get(IntelIOMMUState *iommu, uint16_t index, entry, sizeof(*entry), MEMTXATTRS_UNSPECIFIED)) { error_report_once("%s: read failed: ind=0x%x addr=0x%" PRIx64, __func__, index, addr); - return -VTD_FR_IR_ROOT_INVAL; + if (do_fault) { + vtd_report_ir_fault(iommu, sid, VTD_FR_IR_ROOT_INVAL, index); + } + return false; } entry->data[0] = le64_to_cpu(entry->data[0]); @@ -3333,11 +3358,24 @@ static int vtd_irte_get(IntelIOMMUState *iommu, uint16_t index, trace_vtd_ir_irte_get(index, entry->data[1], entry->data[0]); + /* + * The remaining potential fault conditions are "qualified" by the + * Fault Processing Disable bit in the IRTE. Even "not present". + * So just clear the do_fault flag if PFD is set, which will + * prevent faults being raised. + */ + if (entry->irte.fault_disable) { + do_fault = false; + } + if (!entry->irte.present) { error_report_once("%s: detected non-present IRTE " "(index=%u, high=0x%" PRIx64 ", low=0x%" PRIx64 ")", __func__, index, entry->data[1], entry->data[0]); - return -VTD_FR_IR_ENTRY_P; + if (do_fault) { + vtd_report_ir_fault(iommu, sid, VTD_FR_IR_ENTRY_P, index); + } + return false; } if (entry->irte.__reserved_0 || entry->irte.__reserved_1 || @@ -3345,7 +3383,10 @@ static int vtd_irte_get(IntelIOMMUState *iommu, uint16_t index, error_report_once("%s: detected non-zero reserved IRTE " "(index=%u, high=0x%" PRIx64 ", low=0x%" PRIx64 ")", __func__, index, entry->data[1], entry->data[0]); - return -VTD_FR_IR_IRTE_RSVD; + if (do_fault) { + vtd_report_ir_fault(iommu, sid, VTD_FR_IR_IRTE_RSVD, index); + } + return false; } if (sid != X86_IOMMU_SID_INVALID) { @@ -3361,7 +3402,10 @@ static int vtd_irte_get(IntelIOMMUState *iommu, uint16_t index, error_report_once("%s: invalid IRTE SID " "(index=%u, sid=%u, source_id=%u)", __func__, index, sid, source_id); - return -VTD_FR_IR_SID_ERR; + if (do_fault) { + vtd_report_ir_fault(iommu, sid, VTD_FR_IR_SID_ERR, index); + } + return false; } break; @@ -3373,7 +3417,10 @@ static int vtd_irte_get(IntelIOMMUState *iommu, uint16_t index, error_report_once("%s: invalid SVT_BUS " "(index=%u, bus=%u, min=%u, max=%u)", __func__, index, bus, bus_min, bus_max); - return -VTD_FR_IR_SID_ERR; + if (do_fault) { + vtd_report_ir_fault(iommu, sid, VTD_FR_IR_SID_ERR, index); + } + return false; } break; @@ -3382,23 +3429,24 @@ static int vtd_irte_get(IntelIOMMUState *iommu, uint16_t index, "(index=%u, type=%d)", __func__, index, entry->irte.sid_vtype); /* Take this as verification failure. */ - return -VTD_FR_IR_SID_ERR; + if (do_fault) { + vtd_report_ir_fault(iommu, sid, VTD_FR_IR_SID_ERR, index); + } + return false; } } - return 0; + return true; } /* Fetch IRQ information of specific IR index */ -static int vtd_remap_irq_get(IntelIOMMUState *iommu, uint16_t index, - X86IOMMUIrq *irq, uint16_t sid) +static bool vtd_remap_irq_get(IntelIOMMUState *iommu, uint16_t index, + X86IOMMUIrq *irq, uint16_t sid, bool do_fault) { VTD_IR_TableEntry irte = {}; - int ret = 0; - ret = vtd_irte_get(iommu, index, &irte, sid); - if (ret) { - return ret; + if (!vtd_irte_get(iommu, index, &irte, sid, do_fault)) { + return false; } irq->trigger_mode = irte.irte.trigger_mode; @@ -3417,16 +3465,15 @@ static int vtd_remap_irq_get(IntelIOMMUState *iommu, uint16_t index, trace_vtd_ir_remap(index, irq->trigger_mode, irq->vector, irq->delivery_mode, irq->dest, irq->dest_mode); - return 0; + return true; } /* Interrupt remapping for MSI/MSI-X entry */ static int vtd_interrupt_remap_msi(IntelIOMMUState *iommu, MSIMessage *origin, MSIMessage *translated, - uint16_t sid) + uint16_t sid, bool do_fault) { - int ret = 0; VTD_IR_MSIAddress addr; uint16_t index; X86IOMMUIrq irq = {}; @@ -3443,14 +3490,20 @@ static int vtd_interrupt_remap_msi(IntelIOMMUState *iommu, if (origin->address & VTD_MSI_ADDR_HI_MASK) { error_report_once("%s: MSI address high 32 bits non-zero detected: " "address=0x%" PRIx64, __func__, origin->address); - return -VTD_FR_IR_REQ_RSVD; + if (do_fault) { + vtd_report_ir_fault(iommu, sid, VTD_FR_IR_REQ_RSVD, 0); + } + return -EINVAL; } addr.data = origin->address & VTD_MSI_ADDR_LO_MASK; if (addr.addr.__head != 0xfee) { error_report_once("%s: MSI address low 32 bit invalid: 0x%" PRIx32, __func__, addr.data); - return -VTD_FR_IR_REQ_RSVD; + if (do_fault) { + vtd_report_ir_fault(iommu, sid, VTD_FR_IR_REQ_RSVD, 0); + } + return -EINVAL; } /* This is compatible mode. */ @@ -3469,9 +3522,8 @@ static int vtd_interrupt_remap_msi(IntelIOMMUState *iommu, index += origin->data & VTD_IR_MSI_DATA_SUBHANDLE; } - ret = vtd_remap_irq_get(iommu, index, &irq, sid); - if (ret) { - return ret; + if (!vtd_remap_irq_get(iommu, index, &irq, sid, do_fault)) { + return -EINVAL; } if (addr.addr.sub_valid) { @@ -3481,7 +3533,10 @@ static int vtd_interrupt_remap_msi(IntelIOMMUState *iommu, "(sid=%u, address=0x%" PRIx64 ", data=0x%" PRIx32 ")", __func__, sid, origin->address, origin->data); - return -VTD_FR_IR_REQ_RSVD; + if (do_fault) { + vtd_report_ir_fault(iommu, sid, VTD_FR_IR_REQ_RSVD, 0); + } + return -EINVAL; } } else { uint8_t vector = origin->data & 0xff; @@ -3521,7 +3576,7 @@ static int vtd_int_remap(X86IOMMUState *iommu, MSIMessage *src, MSIMessage *dst, uint16_t sid) { return vtd_interrupt_remap_msi(INTEL_IOMMU_DEVICE(iommu), - src, dst, sid); + src, dst, sid, false); } static MemTxResult vtd_mem_ir_read(void *opaque, hwaddr addr, @@ -3547,9 +3602,8 @@ static MemTxResult vtd_mem_ir_write(void *opaque, hwaddr addr, sid = attrs.requester_id; } - ret = vtd_interrupt_remap_msi(opaque, &from, &to, sid); + ret = vtd_interrupt_remap_msi(opaque, &from, &to, sid, true); if (ret) { - /* TODO: report error */ /* Drop this interrupt */ return MEMTX_ERROR; }