From patchwork Tue Jul 2 14:06:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719748 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C55FAC3064D for ; Tue, 2 Jul 2024 14:13:16 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeA4-0001w7-2N; Tue, 02 Jul 2024 10:07:12 -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 1sOeA1-0001vq-Mg for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:10 -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 1sOe9z-0007p8-NP for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929225; 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=gfd+vfybB3O3+4pkXHRWr1BbxFsd2M2r8td4r0aSbjQ=; b=E5cSr6HfaQqRFbvyfJdD+o/Gqq7UtGP6gt0U+L3lkGz+PiV3FGHWj85ySPuK8lRPmS7BEp U5eX4IQk++Ftu6g6F7xCnrDAquYuStg//fk0+S1hizl+frfa7TcztXrvJyCmD99XojLgyO VvwES7M97gQ4lZKzHISS6P0fmPMI8HE= 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-671-QE5KVxKkOc6TPgaHRynCDQ-1; Tue, 02 Jul 2024 10:07:04 -0400 X-MC-Unique: QE5KVxKkOc6TPgaHRynCDQ-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4257a75193aso19211005e9.1 for ; Tue, 02 Jul 2024 07:07:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929223; x=1720534023; 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=gfd+vfybB3O3+4pkXHRWr1BbxFsd2M2r8td4r0aSbjQ=; b=SHXCW1wUfYpQalzikBhMjcTil/9SjEvXZPPkHgzBJB9DqLM8haNtc2LW9RY5PHEyw6 TgceJr6npCDTSbN4OrhZ918V9AAAcpnXj/M9iAsX0ZuLV8crzxbycH04Xlg8dy8TbbDb 0efBG4uwPT5oeCguJTwZb38RURaTQuiHaTFkUHlcPGDVU6nfaXp95dBiQeMKzHe+6q+z +ntPVtrD+JzzGfxmYhDPp+LGs7pPWEWEt+AqUf+Xbo4MoGD9zMrvJ+fGsmS5W25+8mtu Frtxyo1PX/y2SEUJak5pJqcbTrYdzbVLN8rQMlxMu2c6TuJcAA77Vunx8fRucUkmrvbG 65sA== X-Gm-Message-State: AOJu0YxsYxIEiQmIiUuUMvDa0+maNKCJhCugJaH25Vvzh6GL/kjC6iD1 unaL1J0iILZ6JqQjFrvjeskU8necPF1b5TM3BAzKR9jZTwwffbTy2OK3iQcOsHomAc4YID+KHMe Jze1Jq7rH6BZC34x9smdBwpJ8L3mFxUAg5c5j+uEwI8w//8w1U1dBoqRCM+vw5wtZa7zz+jSa2F WS0c9C4LtPbnG/ccwDfZf7zljN/Wultw== X-Received: by 2002:a05:600c:314b:b0:424:a5df:b998 with SMTP id 5b1f17b1804b1-4257a00cfd8mr57298355e9.9.1719929223024; Tue, 02 Jul 2024 07:07:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGJ5w1IuuEk6M/eeTfqXJQoWF9ZwfO12xl8UVvoA4QCHwidLbfqczToXLdMetbxNTO+9r9J9A== X-Received: by 2002:a05:600c:314b:b0:424:a5df:b998 with SMTP id 5b1f17b1804b1-4257a00cfd8mr57298085e9.9.1719929222459; Tue, 02 Jul 2024 07:07:02 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4257cdf4982sm120540635e9.47.2024.07.02.07.07.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:07:02 -0700 (PDT) Date: Tue, 2 Jul 2024 10:06:59 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Si-Wei Liu Subject: [PULL 01/91] vhost: dirty log should be per backend type Message-ID: <51d59a64eed6c2cd2d2f991f44ffbe21eb33c733.1719929191.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Si-Wei Liu There could be a mix of both vhost-user and vhost-kernel clients in the same QEMU process, where separate vhost loggers for the specific vhost type have to be used. Make the vhost logger per backend type, and have them properly reference counted. Suggested-by: Michael S. Tsirkin Signed-off-by: Si-Wei Liu Message-Id: <1710448055-11709-1-git-send-email-si-wei.liu@oracle.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost.c | 45 +++++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 4acd77e890..a1e8b79e1a 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -43,8 +43,8 @@ do { } while (0) #endif -static struct vhost_log *vhost_log; -static struct vhost_log *vhost_log_shm; +static struct vhost_log *vhost_log[VHOST_BACKEND_TYPE_MAX]; +static struct vhost_log *vhost_log_shm[VHOST_BACKEND_TYPE_MAX]; /* Memslots used by backends that support private memslots (without an fd). */ static unsigned int used_memslots; @@ -287,6 +287,10 @@ static int vhost_set_backend_type(struct vhost_dev *dev, r = -1; } + if (r == 0) { + assert(dev->vhost_ops->backend_type == backend_type); + } + return r; } @@ -319,16 +323,22 @@ static struct vhost_log *vhost_log_alloc(uint64_t size, bool share) return log; } -static struct vhost_log *vhost_log_get(uint64_t size, bool share) +static struct vhost_log *vhost_log_get(VhostBackendType backend_type, + uint64_t size, bool share) { - struct vhost_log *log = share ? vhost_log_shm : vhost_log; + struct vhost_log *log; + + assert(backend_type > VHOST_BACKEND_TYPE_NONE); + assert(backend_type < VHOST_BACKEND_TYPE_MAX); + + log = share ? vhost_log_shm[backend_type] : vhost_log[backend_type]; if (!log || log->size != size) { log = vhost_log_alloc(size, share); if (share) { - vhost_log_shm = log; + vhost_log_shm[backend_type] = log; } else { - vhost_log = log; + vhost_log[backend_type] = log; } } else { ++log->refcnt; @@ -340,11 +350,20 @@ static struct vhost_log *vhost_log_get(uint64_t size, bool share) static void vhost_log_put(struct vhost_dev *dev, bool sync) { struct vhost_log *log = dev->log; + VhostBackendType backend_type; if (!log) { return; } + assert(dev->vhost_ops); + backend_type = dev->vhost_ops->backend_type; + + if (backend_type == VHOST_BACKEND_TYPE_NONE || + backend_type >= VHOST_BACKEND_TYPE_MAX) { + return; + } + --log->refcnt; if (log->refcnt == 0) { /* Sync only the range covered by the old log */ @@ -352,13 +371,13 @@ static void vhost_log_put(struct vhost_dev *dev, bool sync) vhost_log_sync_range(dev, 0, dev->log_size * VHOST_LOG_CHUNK - 1); } - if (vhost_log == log) { + if (vhost_log[backend_type] == log) { g_free(log->log); - vhost_log = NULL; - } else if (vhost_log_shm == log) { + vhost_log[backend_type] = NULL; + } else if (vhost_log_shm[backend_type] == log) { qemu_memfd_free(log->log, log->size * sizeof(*(log->log)), log->fd); - vhost_log_shm = NULL; + vhost_log_shm[backend_type] = NULL; } g_free(log); @@ -376,7 +395,8 @@ static bool vhost_dev_log_is_shared(struct vhost_dev *dev) static inline void vhost_dev_log_resize(struct vhost_dev *dev, uint64_t size) { - struct vhost_log *log = vhost_log_get(size, vhost_dev_log_is_shared(dev)); + struct vhost_log *log = vhost_log_get(dev->vhost_ops->backend_type, + size, vhost_dev_log_is_shared(dev)); uint64_t log_base = (uintptr_t)log->log; int r; @@ -2044,7 +2064,8 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev, bool vrings) uint64_t log_base; hdev->log_size = vhost_get_log_size(hdev); - hdev->log = vhost_log_get(hdev->log_size, + hdev->log = vhost_log_get(hdev->vhost_ops->backend_type, + hdev->log_size, vhost_dev_log_is_shared(hdev)); log_base = (uintptr_t)hdev->log->log; r = hdev->vhost_ops->vhost_set_log_base(hdev, From patchwork Tue Jul 2 14:07:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719778 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A74FDC30658 for ; Tue, 2 Jul 2024 14:20:04 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeAA-0001xp-4p; Tue, 02 Jul 2024 10:07: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 1sOeA7-0001xN-Qy for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:15 -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 1sOeA2-0007qW-FG for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929229; 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=uKK/AiLdjMfeKEPpHLdhaqq0Kf5J8WlC0WD4BsUonqY=; b=YcCOqd34goAra87kDcpbmBl6VYvGqQ1/TS+4NVWbpV4DfUVvysbX5b7x4p4RQGStJr5XAU 3y3Gn8m0gKx+C9L6snsM03V92K1pGGQqrtugHfi4nJV8RIlMMEKnH24gU0FNNcAGN6tsm3 VkUJG54ZHx/7UXSpP/GzjKdvmbw8DRU= 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-156---SWPAMiPpaT3qvTYUmPOA-1; Tue, 02 Jul 2024 10:07:08 -0400 X-MC-Unique: --SWPAMiPpaT3qvTYUmPOA-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4246cf4c87dso27791755e9.2 for ; Tue, 02 Jul 2024 07:07:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929226; x=1720534026; 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=uKK/AiLdjMfeKEPpHLdhaqq0Kf5J8WlC0WD4BsUonqY=; b=Ch3J/heSigrkGIeshI67CCTfIi5GcedX9BrWMaksDdOoMINg4ZKvbJKm93OEI/LQkw dTk7woJuBOmWHh5wO+4EFXVz9NNUm6utansRA6Gfzk/PDu6j+tChExk9fKibVzMVUbGk pPOKDvorWbhFVQGQbBkoaQ03Dst3CH7LlX3bsc2JS2ZH3fKOqvvAJvn8FVo2P8M9Yb4F PlCqLP8vcMnobvUPzMw5v6aa3FoBYeYDJTeEb4TOf8XOXmtqO/J+vfwqISTYGdJtTeTj nbchFonH5JldXkxVKiKrlx5JTxyHmRqL8cffyrYRkIMSMN9RPxpB/Kpbu6FmgaqORV/q bXcQ== X-Gm-Message-State: AOJu0YxXma9bzcYSeaTMexSfdlH+tfk1efV1hPQvBmwznB0xZKNngbJT lqtMynDf2pZ/LLmw3xJk/af+otj8F7QL2ym/wboJ0Oa3EdQtS7Rsn6UPVQtos2YCANuoLBUGb7m 8VxrOLCytnvYECKBJzyakCdl46KdPtQGK2ZOK/0d+Ayw/C+bqDDrOcryFS9plyJpvkfNXYbqhSo 8TQ9lv7tvJtpZ41MNpjsXZBhYRtLSBoA== X-Received: by 2002:a05:600c:3089:b0:425:7835:4382 with SMTP id 5b1f17b1804b1-4257a06da46mr69319105e9.34.1719929226304; Tue, 02 Jul 2024 07:07:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFI16WUx5T88jq4do5CDDCy8opUrMOMxn6fIqHO1v2MsUOF7gXOPZNNsaddb+9agk+96DqYrA== X-Received: by 2002:a05:600c:3089:b0:425:7835:4382 with SMTP id 5b1f17b1804b1-4257a06da46mr69318815e9.34.1719929225633; Tue, 02 Jul 2024 07:07:05 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4257cad6beasm120554955e9.47.2024.07.02.07.07.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:07:05 -0700 (PDT) Date: Tue, 2 Jul 2024 10:07:02 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Si-Wei Liu , Joao Martins , Jason Wang Subject: [PULL 02/91] vhost: Perform memory section dirty scans once per iteration 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Si-Wei Liu On setups with one or more virtio-net devices with vhost on, dirty tracking iteration increases cost the bigger the number amount of queues are set up e.g. on idle guests migration the following is observed with virtio-net with vhost=on: 48 queues -> 78.11% [.] vhost_dev_sync_region.isra.13 8 queues -> 40.50% [.] vhost_dev_sync_region.isra.13 1 queue -> 6.89% [.] vhost_dev_sync_region.isra.13 2 devices, 1 queue -> 18.60% [.] vhost_dev_sync_region.isra.14 With high memory rates the symptom is lack of convergence as soon as it has a vhost device with a sufficiently high number of queues, the sufficient number of vhost devices. On every migration iteration (every 100msecs) it will redundantly query the *shared log* the number of queues configured with vhost that exist in the guest. For the virtqueue data, this is necessary, but not for the memory sections which are the same. So essentially we end up scanning the dirty log too often. To fix that, select a vhost device responsible for scanning the log with regards to memory sections dirty tracking. It is selected when we enable the logger (during migration) and cleared when we disable the logger. If the vhost logger device goes away for some reason, the logger will be re-selected from the rest of vhost devices. After making mem-section logger a singleton instance, constant cost of 7%-9% (like the 1 queue report) will be seen, no matter how many queues or how many vhost devices are configured: 48 queues -> 8.71% [.] vhost_dev_sync_region.isra.13 2 devices, 8 queues -> 7.97% [.] vhost_dev_sync_region.isra.14 Co-developed-by: Joao Martins Signed-off-by: Joao Martins Signed-off-by: Si-Wei Liu Message-Id: <1710448055-11709-2-git-send-email-si-wei.liu@oracle.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang --- include/hw/virtio/vhost.h | 1 + hw/virtio/vhost.c | 67 +++++++++++++++++++++++++++++++++++---- 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index 02477788df..d75faf46e9 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -129,6 +129,7 @@ struct vhost_dev { void *opaque; struct vhost_log *log; QLIST_ENTRY(vhost_dev) entry; + QLIST_ENTRY(vhost_dev) logdev_entry; QLIST_HEAD(, vhost_iommu) iommu_list; IOMMUNotifier n; const VhostDevConfigOps *config_ops; diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index a1e8b79e1a..06fc71746e 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -45,6 +45,7 @@ static struct vhost_log *vhost_log[VHOST_BACKEND_TYPE_MAX]; static struct vhost_log *vhost_log_shm[VHOST_BACKEND_TYPE_MAX]; +static QLIST_HEAD(, vhost_dev) vhost_log_devs[VHOST_BACKEND_TYPE_MAX]; /* Memslots used by backends that support private memslots (without an fd). */ static unsigned int used_memslots; @@ -149,6 +150,47 @@ bool vhost_dev_has_iommu(struct vhost_dev *dev) } } +static inline bool vhost_dev_should_log(struct vhost_dev *dev) +{ + assert(dev->vhost_ops); + assert(dev->vhost_ops->backend_type > VHOST_BACKEND_TYPE_NONE); + assert(dev->vhost_ops->backend_type < VHOST_BACKEND_TYPE_MAX); + + return dev == QLIST_FIRST(&vhost_log_devs[dev->vhost_ops->backend_type]); +} + +static inline void vhost_dev_elect_mem_logger(struct vhost_dev *hdev, bool add) +{ + VhostBackendType backend_type; + + assert(hdev->vhost_ops); + + backend_type = hdev->vhost_ops->backend_type; + assert(backend_type > VHOST_BACKEND_TYPE_NONE); + assert(backend_type < VHOST_BACKEND_TYPE_MAX); + + if (add && !QLIST_IS_INSERTED(hdev, logdev_entry)) { + if (QLIST_EMPTY(&vhost_log_devs[backend_type])) { + QLIST_INSERT_HEAD(&vhost_log_devs[backend_type], + hdev, logdev_entry); + } else { + /* + * The first vhost_device in the list is selected as the shared + * logger to scan memory sections. Put new entry next to the head + * to avoid inadvertent change to the underlying logger device. + * This is done in order to get better cache locality and to avoid + * performance churn on the hot path for log scanning. Even when + * new devices come and go quickly, it wouldn't end up changing + * the active leading logger device at all. + */ + QLIST_INSERT_AFTER(QLIST_FIRST(&vhost_log_devs[backend_type]), + hdev, logdev_entry); + } + } else if (!add && QLIST_IS_INSERTED(hdev, logdev_entry)) { + QLIST_REMOVE(hdev, logdev_entry); + } +} + static int vhost_sync_dirty_bitmap(struct vhost_dev *dev, MemoryRegionSection *section, hwaddr first, @@ -166,12 +208,14 @@ static int vhost_sync_dirty_bitmap(struct vhost_dev *dev, start_addr = MAX(first, start_addr); end_addr = MIN(last, end_addr); - for (i = 0; i < dev->mem->nregions; ++i) { - struct vhost_memory_region *reg = dev->mem->regions + i; - vhost_dev_sync_region(dev, section, start_addr, end_addr, - reg->guest_phys_addr, - range_get_last(reg->guest_phys_addr, - reg->memory_size)); + if (vhost_dev_should_log(dev)) { + for (i = 0; i < dev->mem->nregions; ++i) { + struct vhost_memory_region *reg = dev->mem->regions + i; + vhost_dev_sync_region(dev, section, start_addr, end_addr, + reg->guest_phys_addr, + range_get_last(reg->guest_phys_addr, + reg->memory_size)); + } } for (i = 0; i < dev->nvqs; ++i) { struct vhost_virtqueue *vq = dev->vqs + i; @@ -383,6 +427,7 @@ static void vhost_log_put(struct vhost_dev *dev, bool sync) g_free(log); } + vhost_dev_elect_mem_logger(dev, false); dev->log = NULL; dev->log_size = 0; } @@ -998,6 +1043,15 @@ static int vhost_dev_set_log(struct vhost_dev *dev, bool enable_log) goto err_vq; } } + + /* + * At log start we select our vhost_device logger that will scan the + * memory sections and skip for the others. This is possible because + * the log is shared amongst all vhost devices for a given type of + * backend. + */ + vhost_dev_elect_mem_logger(dev, enable_log); + return 0; err_vq: for (; i >= 0; --i) { @@ -2075,6 +2129,7 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev, bool vrings) VHOST_OPS_DEBUG(r, "vhost_set_log_base failed"); goto fail_log; } + vhost_dev_elect_mem_logger(hdev, true); } if (vrings) { r = vhost_dev_set_vring_enable(hdev, true); From patchwork Tue Jul 2 14:07:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719705 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9D78DC3064D for ; Tue, 2 Jul 2024 14:08:01 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeAB-0001y6-Bz; Tue, 02 Jul 2024 10:07: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 1sOeA9-0001xY-3H for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07: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 1sOeA6-0007qo-H4 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929232; 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=ZMYpex8C2s46cF0GfMcoGvUcCxmqXFvGY/Nt+8TTLHo=; b=b9LIPW/w6URdeJeZQ9ohIhX74ZnQYajski6rE/nXXjgMy9u/728TbUO3GghOifhtgMep5o ERRX9KnBiq6cXqa/UwdxYpasNdAjM7Ji07bm41fv/z/396ZEy7EmUURBfoSf8PFJx7fX2/ ySHq9ujhumufwp/CBN52BSlX1uxvvPw= 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-408-9FCh_UpcODCHwOT5TWuc0g-1; Tue, 02 Jul 2024 10:07:11 -0400 X-MC-Unique: 9FCh_UpcODCHwOT5TWuc0g-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2ec4efbbb7aso37510961fa.2 for ; Tue, 02 Jul 2024 07:07:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929229; x=1720534029; 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=ZMYpex8C2s46cF0GfMcoGvUcCxmqXFvGY/Nt+8TTLHo=; b=JORNwU1jWuFwyu/4znV1eIagnBVGiaDVTX/OCR+bXf+k0+UHKz/fa+AhEtx1Px8ADi k0wSNP842rXVYt74m3L96ycKndFwpk6Mq0pcEr4U0hNrSjqJ5rUgufUOXQwwArxDu+9w bIrVmcvRp7SmDEmF+iKTC7rWui0Cx0HcdhNB31YJjIMiY+qc9hxv8f1y+Sb8Hv5qHv65 +pdw/16iBhUZ03kWBNfu4xqqBcxPKkdin1g4rolPBofdYHGEYWgpZW9mSRENjFkVt6SO gurbN7FKrvQBlm9qyefLTsol/5i9TF3qdA9jRNghzzUWN2qH1e0tRYITaJG4C+cBn7Gk hxtQ== X-Gm-Message-State: AOJu0Yx0m1j+YXxQC5MLAtvyZMhxMvrX/VFlfJQcCmvMFtEoJD7bShZn DpD2o74kZNqLSkjAEZoMzX6u8l2quyoEOSOEkGBbz9LbkCKEyrVnV/EoB5oCqw6UMAfEbW4hzGS Jgiq/5+UVYydE0Czp108n99Q0tjit+RO48cSwi2z/QSqYCl6V9SdsaM96GdFXbSzpTiH4NSBLqa HEf5isLmqzTSPM73hP37ZBdUHcM1jaNw== X-Received: by 2002:a2e:9985:0:b0:2ee:5b32:9d5d with SMTP id 38308e7fff4ca-2ee5e707c04mr64091901fa.47.1719929229095; Tue, 02 Jul 2024 07:07:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH8ZXILvUxSkM5nA0R2F2YALp+IaGYAw73lLeo0L5l/6UfvGQXdI+H2Utq1FezF1veoQbqTHw== X-Received: by 2002:a2e:9985:0:b0:2ee:5b32:9d5d with SMTP id 38308e7fff4ca-2ee5e707c04mr64091471fa.47.1719929228317; Tue, 02 Jul 2024 07:07:08 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af3f14csm201524745e9.6.2024.07.02.07.07.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:07:07 -0700 (PDT) Date: Tue, 2 Jul 2024 10:07:05 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefano Garzarella , Eugenio =?utf-8?b?UMOpcmV6?= , Jason Wang , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= Subject: [PULL 03/91] vhost-vdpa: check vhost_vdpa_set_vring_ready() return value Message-ID: <9d5a807c4cb56837f11be9a9250f854fab951290.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Stefano Garzarella vhost_vdpa_set_vring_ready() could already fail, but if Linux's patch [1] will be merged, it may fail with more chance if userspace does not activate virtqueues before DRIVER_OK when VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK is not negotiated. So better check its return value anyway. [1] https://lore.kernel.org/virtualization/20240206145154.118044-1-sgarzare@redhat.com/T/#u Acked-by: Eugenio Pérez Acked-by: Jason Wang Signed-off-by: Stefano Garzarella Message-Id: <20240322092315.31885-1-sgarzare@redhat.com> Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 85e73dd6a7..eda714d1a4 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -399,7 +399,10 @@ static int vhost_vdpa_net_data_load(NetClientState *nc) } for (int i = 0; i < v->dev->nvqs; ++i) { - vhost_vdpa_set_vring_ready(v, i + v->dev->vq_index); + int ret = vhost_vdpa_set_vring_ready(v, i + v->dev->vq_index); + if (ret < 0) { + return ret; + } } return 0; } @@ -1238,7 +1241,10 @@ static int vhost_vdpa_net_cvq_load(NetClientState *nc) assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_VDPA); - vhost_vdpa_set_vring_ready(v, v->dev->vq_index); + r = vhost_vdpa_set_vring_ready(v, v->dev->vq_index); + if (unlikely(r < 0)) { + return r; + } if (v->shadow_vqs_enabled) { n = VIRTIO_NET(v->dev->vdev); @@ -1277,7 +1283,10 @@ static int vhost_vdpa_net_cvq_load(NetClientState *nc) } for (int i = 0; i < v->dev->vq_index; ++i) { - vhost_vdpa_set_vring_ready(v, i); + r = vhost_vdpa_set_vring_ready(v, i); + if (unlikely(r < 0)) { + return r; + } } return 0; From patchwork Tue Jul 2 14:07:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719716 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 86DA9C30658 for ; Tue, 2 Jul 2024 14:09:42 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeAE-0001yl-F7; Tue, 02 Jul 2024 10:07: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 1sOeAA-0001y5-Np for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07: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 1sOeA8-0007rm-RV for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929236; 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=rU41nJqg3mDUGH1bcBpKF5g1VLC3bOtqyqIezIWqM9s=; b=CS6zgzEQsfKgQfJB1mqFiWDIKJC5azum9SkuwxLOfmY8bMlmtgzf0MA9KcxC909kQ91feg X5/dHyBLYGJxJtRkaj+5hdThDVJSzkEkUHNzznQdCliII3f7RzHFr4ktEhvKoZweU8mm/B pHFmpVoAQ2Hysg6lsMFI03LDDB0WbEk= 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-400-p0EHxYLUP7eQhYGOwWEWJA-1; Tue, 02 Jul 2024 10:07:14 -0400 X-MC-Unique: p0EHxYLUP7eQhYGOwWEWJA-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-3678fd1edf8so39431f8f.0 for ; Tue, 02 Jul 2024 07:07:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929232; x=1720534032; 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=rU41nJqg3mDUGH1bcBpKF5g1VLC3bOtqyqIezIWqM9s=; b=nHilNEe5f5h3udc4efZQhS0A5CQnSuhM8InwdU4IdsGWM+lU9iLRXSzr3DJ9XJxj/o QFWpMhpPgDNyjZPifRb/rLgsvLNqPoMWxZMS2XYY1ZSqXHKThNO6DaPXoHSY1bJ7pv0M Kpn9/SmwBWzqJS+Cg1vojY5784kQF7DT5nxHIqTMzJwq9l5HtWA+HmS6Sgyv/NYEziPu xMQEd6JbRNle0YBmYdK353sFpU3andIXFzXTFHEs0dxGB2umARYGMCK2W7M1d0RQRjED Jw7rhYPE2qm/lQSdEv/eZbZNNTCp9cwjMa9or46NdjG7gWKbYovzGdk3koH+CfKqBTry uKhA== X-Gm-Message-State: AOJu0Yz+knt6djuKsLdTjc11vIqP3npQ4ct9eL+QU6fPtxRFCdzNeqjf +KxuH/GulSzQWs3/PFXtNGsp7qchyQCSbK8kQwdxJ7Ac0WUGc7Jp+L6IQUtgUKBOriYK15Zjys4 aCilRayCXCTNK6ke8bHqIppynqd1jSCjLHRQdPVIn9SYunkX1n5fP928RI5TjlXAAUgBWgVrOyc gHucWJQkG7rNReKrL7KUFBjvxeYr766w== X-Received: by 2002:a5d:64c5:0:b0:360:70e3:ef2b with SMTP id ffacd0b85a97d-36774f89a41mr8439742f8f.26.1719929231914; Tue, 02 Jul 2024 07:07:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEKYqN4kUEY91+413iOThkoANb5xdm5ahQDHk4KC16IP4U6fwb0tJorIxYagv6TncIHOFDFaA== X-Received: by 2002:a5d:64c5:0:b0:360:70e3:ef2b with SMTP id ffacd0b85a97d-36774f89a41mr8439701f8f.26.1719929231276; Tue, 02 Jul 2024 07:07:11 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0cd712sm13347433f8f.20.2024.07.02.07.07.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:07:10 -0700 (PDT) Date: Tue, 2 Jul 2024 10:07:08 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonah Palmer , Eugenio =?utf-8?b?UMOpcmV6?= Subject: [PULL 04/91] virtio/virtio-pci: Handle extra notification data 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Jonah Palmer Add support to virtio-pci devices for handling the extra data sent from the driver to the device when the VIRTIO_F_NOTIFICATION_DATA transport feature has been negotiated. The extra data that's passed to the virtio-pci device when this feature is enabled varies depending on the device's virtqueue layout. In a split virtqueue layout, this data includes: - upper 16 bits: shadow_avail_idx - lower 16 bits: virtqueue index In a packed virtqueue layout, this data includes: - upper 16 bits: 1-bit wrap counter & 15-bit shadow_avail_idx - lower 16 bits: virtqueue index Signed-off-by: Jonah Palmer Message-Id: <20240315165557.26942-2-jonah.palmer@oracle.com> Reviewed-by: Eugenio Pérez Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/virtio.h | 2 ++ hw/virtio/virtio-pci.c | 12 +++++++++--- hw/virtio/virtio.c | 18 ++++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index 7d5ffdc145..1451926a13 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -307,6 +307,8 @@ int virtio_queue_ready(VirtQueue *vq); int virtio_queue_empty(VirtQueue *vq); +void virtio_queue_set_shadow_avail_idx(VirtQueue *vq, uint16_t idx); + /* Host binding interface. */ uint32_t virtio_config_readb(VirtIODevice *vdev, uint32_t addr); diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index b1d02f4b3d..cffc7efcae 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -384,7 +384,7 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val) { VirtIOPCIProxy *proxy = opaque; VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - uint16_t vector; + uint16_t vector, vq_idx; hwaddr pa; switch (addr) { @@ -408,8 +408,14 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val) vdev->queue_sel = val; break; case VIRTIO_PCI_QUEUE_NOTIFY: - if (val < VIRTIO_QUEUE_MAX) { - virtio_queue_notify(vdev, val); + vq_idx = val; + if (vq_idx < VIRTIO_QUEUE_MAX && virtio_queue_get_num(vdev, vq_idx)) { + if (virtio_vdev_has_feature(vdev, VIRTIO_F_NOTIFICATION_DATA)) { + VirtQueue *vq = virtio_get_queue(vdev, vq_idx); + + virtio_queue_set_shadow_avail_idx(vq, val >> 16); + } + virtio_queue_notify(vdev, vq_idx); } break; case VIRTIO_PCI_STATUS: diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 893a072c9d..f7c99e3a96 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2264,6 +2264,24 @@ void virtio_queue_set_align(VirtIODevice *vdev, int n, int align) } } +void virtio_queue_set_shadow_avail_idx(VirtQueue *vq, uint16_t shadow_avail_idx) +{ + if (!vq->vring.desc) { + return; + } + + /* + * 16-bit data for packed VQs include 1-bit wrap counter and + * 15-bit shadow_avail_idx. + */ + if (virtio_vdev_has_feature(vq->vdev, VIRTIO_F_RING_PACKED)) { + vq->shadow_avail_wrap_counter = (shadow_avail_idx >> 15) & 0x1; + vq->shadow_avail_idx = shadow_avail_idx & 0x7FFF; + } else { + vq->shadow_avail_idx = shadow_avail_idx; + } +} + static void virtio_queue_notify_vq(VirtQueue *vq) { if (vq->vring.desc && vq->handle_output) { From patchwork Tue Jul 2 14:07:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719708 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9555C30658 for ; Tue, 2 Jul 2024 14:08:26 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeAG-0001zR-9w; Tue, 02 Jul 2024 10:07: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 1sOeAD-0001yX-HM for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:21 -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 1sOeAB-0007s7-6L for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929238; 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=czI6QAqPz2gxBOi54M6w2CiDVJgkcwfGVW3OGis4Be4=; b=FY+5dSWwVwcQiRAW6pbH2Pse05TxzsEBJQ22572uAuOzTY69hcbqHUp1a8eKfjAnX8E/dX g6sdmm5Suzltwg2WYqu3n0ziQdMS5xTgBloUrtNDW+2ktpeU5xd1i0WEEUewdC8IfNSZ1r xPh1+RyqaxdRHRXDVuCJsUmU27IuHX0= 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-57-6Xs-EZmUNT2nXnWLPvb3UA-1; Tue, 02 Jul 2024 10:07:17 -0400 X-MC-Unique: 6Xs-EZmUNT2nXnWLPvb3UA-1 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-52cdd05fec8so4374138e87.0 for ; Tue, 02 Jul 2024 07:07:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929235; x=1720534035; 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=czI6QAqPz2gxBOi54M6w2CiDVJgkcwfGVW3OGis4Be4=; b=MD0jSQ9QP81mNvcJeJ3z12wGHQv+reVxMAr+M9dWJNdWhFAeY7wsNwgd94N2m4yiOc EcLfSAj6DJpdJwACW2uaLEr9csg+ZE/qPM7Gtpq+hslfjc2L0mMX7+EG/syiKtlwvnTX ydey+g1b+xQRTr0cn72op2XyCBxRGnREcbC7o32WajImt5MV0ecNMDGsVvsvcYlTXey0 5IQvB86xFEiXlYlDv1UVMB2Z+eI4oGmB3yI33aKR+3GX1X+va+CRXYMbFMsQuTd+jjL2 UL6IczOUyJw1eZ/F2snYAzBpqr47/yahf+CDXECNQUytizHPh7Hy/m5dB3GnqLCrB/kl kDXw== X-Gm-Message-State: AOJu0YzhrLUb2lfN/Xae+JgxH852iVKVhMMPZMNLh2/NP35Yrq+hgbSN meNtd+wMnJT/rDSmj/gN7gBoYpVeLHGDb52IQQohliB19TWWR/qxupAHLmukIsV0e2yK8IYZY5K XXA/nfXiSnQLCkC3rETMGw1nwMFRhQqCqh/lD8YdA6Ki7jor0X6IJpP+nxAZKbeK3mbztZ4X8y9 qLjlO+JB12E3Dphym+mQMNLkQNoktdLA== X-Received: by 2002:a05:6512:3da3:b0:52e:713e:697c with SMTP id 2adb3069b0e04-52e8267b8d0mr7346553e87.25.1719929234741; Tue, 02 Jul 2024 07:07:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHIbEIOMOFei5IYQ1lsrlJQKcfWJJgZdgqCYLdwihBAYmZzxlPo+Vqxul3hYAoPQQzezBquJw== X-Received: by 2002:a05:6512:3da3:b0:52e:713e:697c with SMTP id 2adb3069b0e04-52e8267b8d0mr7346516e87.25.1719929234065; Tue, 02 Jul 2024 07:07:14 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a1030dfsm13279767f8f.100.2024.07.02.07.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:07:13 -0700 (PDT) Date: Tue, 2 Jul 2024 10:07:11 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonah Palmer Subject: [PULL 05/91] virtio: Prevent creation of device using notification-data with ioeventfd Message-ID: <78378f450a723eed34156259ca2861a0c5ca77cf.1719929191.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Jonah Palmer Prevent the realization of a virtio device that attempts to use the VIRTIO_F_NOTIFICATION_DATA transport feature without disabling ioeventfd. Due to ioeventfd not being able to carry the extra data associated with this feature, having both enabled is a functional mismatch and therefore Qemu should not continue the device's realization process. Although the device does not yet know if the feature will be successfully negotiated, many devices using this feature wont actually work without this extra data and would fail FEATURES_OK anyway. If ioeventfd is able to work with the extra notification data in the future, this compatibility check can be removed. Signed-off-by: Jonah Palmer Message-Id: <20240315165557.26942-3-jonah.palmer@oracle.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index f7c99e3a96..28cd406e16 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2980,6 +2980,20 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val) return ret; } +static void virtio_device_check_notification_compatibility(VirtIODevice *vdev, + Error **errp) +{ + VirtioBusState *bus = VIRTIO_BUS(qdev_get_parent_bus(DEVICE(vdev))); + VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(bus); + DeviceState *proxy = DEVICE(BUS(bus)->parent); + + if (virtio_host_has_feature(vdev, VIRTIO_F_NOTIFICATION_DATA) && + k->ioeventfd_enabled(proxy)) { + error_setg(errp, + "notification_data=on without ioeventfd=off is not supported"); + } +} + size_t virtio_get_config_size(const VirtIOConfigSizeParams *params, uint64_t host_features) { @@ -3740,6 +3754,14 @@ static void virtio_device_realize(DeviceState *dev, Error **errp) } } + /* Devices should not use both ioeventfd and notification data feature */ + virtio_device_check_notification_compatibility(vdev, &err); + if (err != NULL) { + error_propagate(errp, err); + vdc->unrealize(dev); + return; + } + virtio_bus_device_plugged(vdev, &err); if (err != NULL) { error_propagate(errp, err); From patchwork Tue Jul 2 14:07:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719738 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A2D76C3064D for ; Tue, 2 Jul 2024 14:12:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeAH-0001zf-8C; Tue, 02 Jul 2024 10:07: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 1sOeAE-0001z3-Px for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07: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 1sOeAC-0007sb-HC for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929239; 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=uByx4Oz+CQ80E+9HMb1HUHKkD83RXYCyv+000WUVwgE=; b=DKshcX0Yzgz6C0quoqIU44/3+HHF5vKi4lQ53CYZi/Rk0pESEHV8bhnJLlhqejveB5+wU5 icGX97j+b6lzl7JssrnjFVQZDErtyKxUEVL+z7/522l91oF0wl6LwVazG2afa24wmnA8yG vE1hAQ4wbthT5BF23vGXqbrVmiMlAP0= 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-616-_NW-p9t8MlG8rcnI5MHJew-1; Tue, 02 Jul 2024 10:07:18 -0400 X-MC-Unique: _NW-p9t8MlG8rcnI5MHJew-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-3648793ae51so2850602f8f.2 for ; Tue, 02 Jul 2024 07:07:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929237; x=1720534037; 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=uByx4Oz+CQ80E+9HMb1HUHKkD83RXYCyv+000WUVwgE=; b=TYBnPCAF6ZSPeCBzxPUqyYnzfiKiSKZG/5S2n2zVMpK/efwo7sBK7HFwWhHUKrziLh m13KhT31rdFou8yNKAFiWQHkiyvua7oYCIPshaufEWYVmgZmjl22vGWzIL1nsEBKHGU9 UZw3sJqwdQSwsLn2WrbEtIg1GH7HTnxC5FgK23WJ1JCRRapElQ6AVUEnyYfzlFF96zqB UjsD3fEwuBysPmYKaHBmmD8BwZh5MA3S4MAI3Fu8rVtaqkUgpz6qOxWJYyV/jhVMWjEg oHlyz/y3vkiFWkx2NZ2TOUaMhEQmaVb80biMToi9Kdnh56xBokCHuRk4Vv9a66iFGx5M 5uHQ== X-Gm-Message-State: AOJu0YzyJT1fCN15eJjiMZiQW6/BjT9zhtVA1urBpuQuU/lcCXaT5lgf QJNvCc16hfCET9K1gnGa3iLZ4tf7A7JVxh0YWf1FqXZqLqoTzh+cRGTHdWpc0IOwAg5/YfUTh9d qWLBI8W6j1H5cdbBJ4/PGHVtJ2o18AgUf437tVCTDR2Ffhnviqsk4o4bpnEpg+01JMxSPPCrqSN 7gDrUH8lGuMGoK4taE9y0mchMOtfJedw== X-Received: by 2002:a05:6000:128d:b0:366:f494:e08f with SMTP id ffacd0b85a97d-367756c7308mr6314051f8f.29.1719929237087; Tue, 02 Jul 2024 07:07:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGcja3LehWAAp/LVctWqkT2AbVoR5Y/krwuHBVGBa9tEGooBI73RUo8iyopAQbuuCzy8vIFow== X-Received: by 2002:a05:6000:128d:b0:366:f494:e08f with SMTP id ffacd0b85a97d-367756c7308mr6314019f8f.29.1719929236454; Tue, 02 Jul 2024 07:07:16 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0fb9absm13366031f8f.80.2024.07.02.07.07.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:07:16 -0700 (PDT) Date: Tue, 2 Jul 2024 10:07:14 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonah Palmer Subject: [PULL 06/91] virtio-mmio: Handle extra notification data Message-ID: <54869366be60af2eb52cffaedad73ba1f4247e15.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Jonah Palmer Add support to virtio-mmio devices for handling the extra data sent from the driver to the device when the VIRTIO_F_NOTIFICATION_DATA transport feature has been negotiated. The extra data that's passed to the virtio-mmio device when this feature is enabled varies depending on the device's virtqueue layout. The data passed to the virtio-mmio device is in the same format as the data passed to virtio-pci devices. Signed-off-by: Jonah Palmer Message-Id: <20240315165557.26942-4-jonah.palmer@oracle.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-mmio.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c index 22f9fbcf5a..320428ac0d 100644 --- a/hw/virtio/virtio-mmio.c +++ b/hw/virtio/virtio-mmio.c @@ -248,6 +248,7 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value, { VirtIOMMIOProxy *proxy = (VirtIOMMIOProxy *)opaque; VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); + uint16_t vq_idx; trace_virtio_mmio_write_offset(offset, value); @@ -407,8 +408,14 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value, } break; case VIRTIO_MMIO_QUEUE_NOTIFY: - if (value < VIRTIO_QUEUE_MAX) { - virtio_queue_notify(vdev, value); + vq_idx = value; + if (vq_idx < VIRTIO_QUEUE_MAX && virtio_queue_get_num(vdev, vq_idx)) { + if (virtio_vdev_has_feature(vdev, VIRTIO_F_NOTIFICATION_DATA)) { + VirtQueue *vq = virtio_get_queue(vdev, vq_idx); + + virtio_queue_set_shadow_avail_idx(vq, (value >> 16) & 0xFFFF); + } + virtio_queue_notify(vdev, vq_idx); } break; case VIRTIO_MMIO_INTERRUPT_ACK: From patchwork Tue Jul 2 14:07:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719722 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 40314C30658 for ; Tue, 2 Jul 2024 14:11:33 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeAY-00022z-Dk; Tue, 02 Jul 2024 10:07:42 -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 1sOeAR-000216-In for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07: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 1sOeAI-0007tO-Cp for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929245; 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=N8epoI+2XR2IZhKNbWvFqqmIBG6jX2/y5dIWNKzyj2M=; b=P9vxdxOTDLfIDMGMo8s+8sHsVZahQFmrIHVtu+9VzRZx2hvqpmAasVN6F5uw32WNBqqFs0 Z8XwVhYSgar4/ACUd2wg5sVKvKGo9zeCz/ZgU6fzRK8msQ78CrEGEy/JQug+thpZUYfkab tc1iVIwTv6GsVuIzhSlHK4hCc7tM5JU= 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-596-Sr0d3wFWMmCSeMBdW-fY3w-1; Tue, 02 Jul 2024 10:07:21 -0400 X-MC-Unique: Sr0d3wFWMmCSeMBdW-fY3w-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4256569a4faso27251975e9.1 for ; Tue, 02 Jul 2024 07:07:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929240; x=1720534040; 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=N8epoI+2XR2IZhKNbWvFqqmIBG6jX2/y5dIWNKzyj2M=; b=YBdLDIzyFG4U7e4bseedfF4pVbC/le7l2RrZaLN9xcbdjZ4EvsI8qqeZ9rP/+RwnFH tnBJmK9Ww+ldPuxbSLQ7/sYDJ6ykSvTLrU+E2RqOooyfpw3uHSqdS2e0MgNxTjBYmhYZ FIGK/Ik6M21Ig7P/sZ1KjC35DVbO7hGnxewG15B2Zk/8gqSwvjpTJ1KCY2SzrSwjCXl8 KzKjv4SLC+WX1jg5zjfqL5aRgoc6bxaM2kRabF+sCqqIJEPigaTjnev6JFnJIHQ68BMo lvbK168Uj7wDpApuzP1qCLZRsCjBGOJ1H5NA+v0mUPD7R4ZNUx1TaJ24FI4iYgSeWMuq CwCg== X-Gm-Message-State: AOJu0Ywyw7phOy3R23mx+DGdTwF6ATTlC8A0aubIh7WC5iMqyIRnDXbd KlagU7ILd3kiJw0y4PfBf7LagG2uxjFpdXbf8yHtlsLYkq/QqVQmwH1i+G5jRiyJW5gOz+f6q5N 1uVkEkn8vhwFkxvr+9T8hHF/T6/V6CqDiDHmP64JSEl/u66COgFzCMGeTTmTxj2APmfpPLEKr2U YAmaVHDLuR5PuncfGOLGJ8d8FCTeCEig== X-Received: by 2002:a05:600c:4f16:b0:421:b65d:2235 with SMTP id 5b1f17b1804b1-42579714d61mr85248445e9.0.1719929240566; Tue, 02 Jul 2024 07:07:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEcfD/TG50V6u71ZCSG17LMuFoXXHV16QOjAwnFcMBi0KqtEmouEowf5haA8WxfPyl+05xIsA== X-Received: by 2002:a05:600c:4f16:b0:421:b65d:2235 with SMTP id 5b1f17b1804b1-42579714d61mr85248085e9.0.1719929240079; Tue, 02 Jul 2024 07:07:20 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256f55c4b5sm185964545e9.43.2024.07.02.07.07.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:07:19 -0700 (PDT) Date: Tue, 2 Jul 2024 10:07:16 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonah Palmer , Thomas Huth , Halil Pasic , Christian Borntraeger , Eric Farman , Richard Henderson , David Hildenbrand , Ilya Leoshkevich , qemu-s390x@nongnu.org Subject: [PULL 07/91] virtio-ccw: Handle extra notification data Message-ID: <594b543a4a75d08f47e5ea92c96a89502a3eab72.1719929191.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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Jonah Palmer Add support to virtio-ccw devices for handling the extra data sent from the driver to the device when the VIRTIO_F_NOTIFICATION_DATA transport feature has been negotiated. The extra data that's passed to the virtio-ccw device when this feature is enabled varies depending on the device's virtqueue layout. That data passed to the virtio-ccw device is in the same format as the data passed to virtio-pci devices. Signed-off-by: Jonah Palmer Message-Id: <20240315165557.26942-5-jonah.palmer@oracle.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/s390x/s390-virtio-ccw.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index cd063f8b64..8cd912f20e 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -126,9 +126,11 @@ static void subsystem_reset(void) static int virtio_ccw_hcall_notify(const uint64_t *args) { uint64_t subch_id = args[0]; - uint64_t queue = args[1]; + uint64_t data = args[1]; SubchDev *sch; + VirtIODevice *vdev; int cssid, ssid, schid, m; + uint16_t vq_idx = data; if (ioinst_disassemble_sch_ident(subch_id, &m, &cssid, &ssid, &schid)) { return -EINVAL; @@ -137,12 +139,19 @@ static int virtio_ccw_hcall_notify(const uint64_t *args) if (!sch || !css_subch_visible(sch)) { return -EINVAL; } - if (queue >= VIRTIO_QUEUE_MAX) { + + vdev = virtio_ccw_get_vdev(sch); + if (vq_idx >= VIRTIO_QUEUE_MAX || !virtio_queue_get_num(vdev, vq_idx)) { return -EINVAL; } - virtio_queue_notify(virtio_ccw_get_vdev(sch), queue); - return 0; + if (virtio_vdev_has_feature(vdev, VIRTIO_F_NOTIFICATION_DATA)) { + virtio_queue_set_shadow_avail_idx(virtio_get_queue(vdev, vq_idx), + (data >> 16) & 0xFFFF); + } + + virtio_queue_notify(vdev, vq_idx); + return 0; } static int virtio_ccw_hcall_early_printk(const uint64_t *args) From patchwork Tue Jul 2 14:07:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719717 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A8E2EC3064D for ; Tue, 2 Jul 2024 14:09:45 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeAc-00023m-3I; Tue, 02 Jul 2024 10:07: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 1sOeAa-00023D-A0 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:44 -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 1sOeAK-0007tg-P0 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929247; 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=OCCVtvSfvqBAUBpNFi/zb/m65iBLwl7XEHTViiftxcE=; b=TzRWAnLUcdJ5mVcKDwRl/YXyAXiR1lj/5U7J/j3AZW5a/y6RAeTig4z3i04+U9EnDeShMk AYd9wEAIglTaG+rq3LlH3tJi/+CDmKXKlxTFE36WLC6XPpkIXZSrJ8uhhiaLSMIQ3/3uaH +45BMU+UndPNlEAKOqFHnT3R1e3KXTM= 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-56-OXqlBY9RNHCM1RCR8YqT-g-1; Tue, 02 Jul 2024 10:07:25 -0400 X-MC-Unique: OXqlBY9RNHCM1RCR8YqT-g-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-3678e523e32so273425f8f.1 for ; Tue, 02 Jul 2024 07:07:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929244; x=1720534044; 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=OCCVtvSfvqBAUBpNFi/zb/m65iBLwl7XEHTViiftxcE=; b=OcqKnpfL1btLGcJCzlm66TZtMgYUKgaZv8jIR4aekzyLSjmObt+EqBzURuvwPYt7HC yWB5w2AQofgVkGEPV9Ulb0cnq5wmC6THpY4c2EZO99ZVsTQmIu9k4GpqWeRBFEBZ1HkT fXb6XehfGVl7rC076/DFv5NuGdXkMnIgz5kmMaRZnFaB/AnB60rV05F423Oi6nNizuzJ csFfyS747vRF/mIuOqAV9oRAKdfe1fQzZmDoN5KjQ/wBrwGszYJUpcWjsnOTIdmPT8be iuKXJK6AoVEZPpL8QPAQVB/VKCkZvKZzBLVcgBrMQHgX768AMy8sad+rN8G4B0up0GQ3 byeQ== X-Gm-Message-State: AOJu0Yy+bj10xl8dc81XDMuy6VW+iRhLmW0LTyKV2QgemlvzSbhPrS75 LgPwYmsJo37Oo0L93WHj8dWWlO7Sth1dtIs7KdGsvm+rL7hHHJqKHQiTSHYcHuTjb8km5MnZfJ5 Qn6AL+i9f8PnOTNTD2+eyBACrLfIvITmI3Cq6DboR00s9djUWLbAq5WjuMGDFs1fPEM7BJO7X6w ++VvTCb0O+pi2N3JfO52jpWm2t5Sw7YQ== X-Received: by 2002:adf:a381:0:b0:366:f34d:d0b7 with SMTP id ffacd0b85a97d-367756bb806mr7373704f8f.29.1719929244386; Tue, 02 Jul 2024 07:07:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGUI4bM55YqPJYK0Ha8aEnXWd8xVDASX3XaOoSllRi7/BUeVM6uH00B7hv5HZIsY2c/gPfHDw== X-Received: by 2002:adf:a381:0:b0:366:f34d:d0b7 with SMTP id ffacd0b85a97d-367756bb806mr7373666f8f.29.1719929243818; Tue, 02 Jul 2024 07:07:23 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0cd6b4sm13274976f8f.17.2024.07.02.07.07.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:07:23 -0700 (PDT) Date: Tue, 2 Jul 2024 10:07:20 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonah Palmer , Lei Yang , Eugenio =?utf-8?b?UMOpcmV6?= , Srujana Challa , Raphael Norwitz , Kevin Wolf , Hanna Reitz , Jason Wang , Paolo Bonzini , Fam Zheng , Stefan Hajnoczi , qemu-block@nongnu.org, virtio-fs@lists.linux.dev Subject: [PULL 08/91] vhost/vhost-user: Add VIRTIO_F_NOTIFICATION_DATA to vhost feature bits 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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Jonah Palmer Add support for the VIRTIO_F_NOTIFICATION_DATA feature across a variety of vhost devices. The inclusion of VIRTIO_F_NOTIFICATION_DATA in the feature bits arrays for these devices ensures that the backend is capable of offering and providing support for this feature, and that it can be disabled if the backend does not support it. Tested-by: Lei Yang Reviewed-by: Eugenio Pérez Signed-off-by: Jonah Palmer Message-Id: <20240315165557.26942-6-jonah.palmer@oracle.com> Acked-by: Srujana Challa Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/block/vhost-user-blk.c | 1 + hw/net/vhost_net.c | 2 ++ hw/scsi/vhost-scsi.c | 1 + hw/scsi/vhost-user-scsi.c | 1 + hw/virtio/vhost-user-fs.c | 2 +- hw/virtio/vhost-user-vsock.c | 1 + net/vhost-vdpa.c | 1 + 7 files changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index 9e6bbc6950..bc2677dbef 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -51,6 +51,7 @@ static const int user_feature_bits[] = { VIRTIO_F_RING_PACKED, VIRTIO_F_IOMMU_PLATFORM, VIRTIO_F_RING_RESET, + VIRTIO_F_NOTIFICATION_DATA, VHOST_INVALID_FEATURE_BIT }; diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index fd1a93701a..18898afe81 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -48,6 +48,7 @@ static const int kernel_feature_bits[] = { VIRTIO_F_IOMMU_PLATFORM, VIRTIO_F_RING_PACKED, VIRTIO_F_RING_RESET, + VIRTIO_F_NOTIFICATION_DATA, VIRTIO_NET_F_HASH_REPORT, VHOST_INVALID_FEATURE_BIT }; @@ -55,6 +56,7 @@ static const int kernel_feature_bits[] = { /* Features supported by others. */ static const int user_feature_bits[] = { VIRTIO_F_NOTIFY_ON_EMPTY, + VIRTIO_F_NOTIFICATION_DATA, VIRTIO_RING_F_INDIRECT_DESC, VIRTIO_RING_F_EVENT_IDX, diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index ae26bc19a4..3d5fe0994d 100644 --- a/hw/scsi/vhost-scsi.c +++ b/hw/scsi/vhost-scsi.c @@ -38,6 +38,7 @@ static const int kernel_feature_bits[] = { VIRTIO_RING_F_EVENT_IDX, VIRTIO_SCSI_F_HOTPLUG, VIRTIO_F_RING_RESET, + VIRTIO_F_NOTIFICATION_DATA, VHOST_INVALID_FEATURE_BIT }; diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index a63b1f4948..0b050805a8 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -36,6 +36,7 @@ static const int user_feature_bits[] = { VIRTIO_RING_F_EVENT_IDX, VIRTIO_SCSI_F_HOTPLUG, VIRTIO_F_RING_RESET, + VIRTIO_F_NOTIFICATION_DATA, VHOST_INVALID_FEATURE_BIT }; diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c index cca2cd41be..ae48cc1c96 100644 --- a/hw/virtio/vhost-user-fs.c +++ b/hw/virtio/vhost-user-fs.c @@ -33,7 +33,7 @@ static const int user_feature_bits[] = { VIRTIO_F_RING_PACKED, VIRTIO_F_IOMMU_PLATFORM, VIRTIO_F_RING_RESET, - + VIRTIO_F_NOTIFICATION_DATA, VHOST_INVALID_FEATURE_BIT }; diff --git a/hw/virtio/vhost-user-vsock.c b/hw/virtio/vhost-user-vsock.c index 9431b9792c..802b44a07d 100644 --- a/hw/virtio/vhost-user-vsock.c +++ b/hw/virtio/vhost-user-vsock.c @@ -21,6 +21,7 @@ static const int user_feature_bits[] = { VIRTIO_RING_F_INDIRECT_DESC, VIRTIO_RING_F_EVENT_IDX, VIRTIO_F_NOTIFY_ON_EMPTY, + VIRTIO_F_NOTIFICATION_DATA, VHOST_INVALID_FEATURE_BIT }; diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index eda714d1a4..daa38428c5 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -62,6 +62,7 @@ const int vdpa_feature_bits[] = { VIRTIO_F_RING_PACKED, VIRTIO_F_RING_RESET, VIRTIO_F_VERSION_1, + VIRTIO_F_NOTIFICATION_DATA, VIRTIO_NET_F_CSUM, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS, VIRTIO_NET_F_CTRL_MAC_ADDR, From patchwork Tue Jul 2 14:07:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719762 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9DCADC3065C for ; Tue, 2 Jul 2024 14:17:52 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeAi-00026P-6y; Tue, 02 Jul 2024 10:07:52 -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 1sOeAg-00025V-Ip for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:50 -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 1sOeAf-0007yw-0S for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929267; 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=Q0Pfb548kulwNGCVafgBGSBiO4uWmp/hiUtG94za6C8=; b=StqfIEoytRTMs88a13vvQGWkPBqqakiO/vFUisCNyCJ6Q/CrvDbpbz3/Y8Y1oJYbmFNoiD Pk4VxURAAWDfI1NiEpSc/IrkB6w5UJum4Zdf5NvMqha0KekkZgB+3Dx2C+FjVzWJOdjDEW h22SgPDX5b/a2z1Jq9rlRIbfnxJy1VU= 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-217-tYT61iJlNJKmlTu79vm0aA-1; Tue, 02 Jul 2024 10:07:32 -0400 X-MC-Unique: tYT61iJlNJKmlTu79vm0aA-1 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-52cda76173dso3716300e87.2 for ; Tue, 02 Jul 2024 07:07:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929247; x=1720534047; 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=Q0Pfb548kulwNGCVafgBGSBiO4uWmp/hiUtG94za6C8=; b=AKQrX13cfVtCv4EXmaukQr3BO2Xwx9gksUOOwlCf3lA065DVOUK+M/eoWJdArJCedw uW3I+iQNLjUhM+OHCZcEJWFQ786dfkkHMrh1oB7b9eD5GOQRqYMoWtzLiW3sFf+5o0HP tkeOJ0d2yHiKAaWoU86LsKcqrNuHtn47dZCIDh2mqGBW6l6SkSoctFjm73iOemnITymV 2St6oBNv0etNWfeTgOKdOzEEYH5e+TyyB4m45izOjzPS5B+SSsYdADXVQQ2dMEd7MPJP kc5vz9dFVTwaE5D0QYnsuqJqkQUsgJrzgJUl7UBloR0Gaf9IdZip2o1/7+1uaFa60eGA z5vQ== X-Gm-Message-State: AOJu0YzbLm3PG4LQR1hW71qsNx0O0YxRS0iV1Grrqosr6+ZsQfjOqk0T 3HkiQ5Uo34A7/L8RxaafhJHIHJscgRrI4wHQ2Ch9WYe+vuaKUres0aSnaZSvNsD5a+iYOiAiNst gBjskehoNLXa519UvVDyfHcIlwxEbwVJ3cVGlDjigwSp2xnfyS9t+GoMhTB3e9liC/QmnKccizf v4p46fK6OPTiSDRvOsoy/Tvrlo32l/Ag== X-Received: by 2002:a05:6512:3988:b0:52c:f2e0:db23 with SMTP id 2adb3069b0e04-52e826886a0mr6373290e87.40.1719929247217; Tue, 02 Jul 2024 07:07:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGV4T/ToQk6mIYYr8cSy5YBs4Q65XdLd6jH0D0NHTgQIdXf9mfJ1tZvqlhOosLJA3Co87D+eA== X-Received: by 2002:a05:6512:3988:b0:52c:f2e0:db23 with SMTP id 2adb3069b0e04-52e826886a0mr6373259e87.40.1719929246595; Tue, 02 Jul 2024 07:07:26 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b065316sm196782195e9.26.2024.07.02.07.07.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:07:25 -0700 (PDT) Date: Tue, 2 Jul 2024 10:07:24 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Christian =?utf-8?q?P=C3=B6tzs?= =?utf-8?q?ch?= Subject: [PULL 09/91] Fix vhost user assertion when sending more than one fd Message-ID: <5093bee0fa8a6c9712c96653da3a79bc37a4e45d.1719929191.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Christian Pötzsch If the client sends more than one region this assert triggers. The reason is that two fd's are 8 bytes and VHOST_MEMORY_BASELINE_NREGIONS is exactly 8. The assert is wrong because it should not test for the size of the fd array, but for the numbers of regions. Signed-off-by: Christian Pötzsch Message-Id: <20240426083313.3081272-1-christian.poetzsch@kernkonzept.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- subprojects/libvhost-user/libvhost-user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index a879149fef..8adb277d54 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -568,7 +568,7 @@ vu_message_read_default(VuDev *dev, int conn_fd, VhostUserMsg *vmsg) if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) { fd_size = cmsg->cmsg_len - CMSG_LEN(0); vmsg->fd_num = fd_size / sizeof(int); - assert(fd_size < VHOST_MEMORY_BASELINE_NREGIONS); + assert(vmsg->fd_num <= VHOST_MEMORY_BASELINE_NREGIONS); memcpy(vmsg->fds, CMSG_DATA(cmsg), fd_size); break; } From patchwork Tue Jul 2 14:07:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719804 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1E655C41513 for ; Tue, 2 Jul 2024 14:26:17 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeAX-00022T-5M; Tue, 02 Jul 2024 10:07:42 -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 1sOeAV-00021w-MR for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:39 -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 1sOeAU-0007wr-0e for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929257; 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=QKgBtghpdntZCNxsubdg5dbN8fdbQsXq4OpajtHNP9c=; b=E3ZltpBwmRhpyJ7Bd3sL44DKhgPvIkC7kU6lT/7gAhG9ayXnAKo1jJ0Taxb8UkiumuiNjq yEumasd3ObXLmuFJwOzvslNE83djmK/X8cv9O5vlx+TCW4o+4+fnQLqSQ0mrjouTLCiL3R vreEVhceIwKhJ1E1555hSHSPt2ZqLD0= 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-489-2lL6FM1NOiSRhrU9_utX3w-1; Tue, 02 Jul 2024 10:07:32 -0400 X-MC-Unique: 2lL6FM1NOiSRhrU9_utX3w-1 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2ee46230987so41678891fa.0 for ; Tue, 02 Jul 2024 07:07:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929250; x=1720534050; 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=QKgBtghpdntZCNxsubdg5dbN8fdbQsXq4OpajtHNP9c=; b=vCgeAQPAksoNtMoSCWOSOno9wgH0ABdW/TQUYAuLPIitu6dFjGq6h1iBy7SF4f6lhw ctQxys3C8gcLBJO4q8Kq7s5uxBUj8+Hrx+kMVgipf5RtqL+/O+rAIGdlylCDOiN5uC3P J5rsjMa60ylLSzVfIz6ZBJ9Q7j7oEaG3JbV1DDSTNFnW6hJ8eVaV5Y6TDP7SITED+Y67 ajoXSZgd2dRL2zwDUO3+y0Xpc5cxpHF2ANlql0e5XFBLAs50mD/SWAH/6LvzLFr+3koj HwqkbR+c3bM9Gr76QH0WLmxddrYahooChtYLSnj7fawae9Ch6/CwUf/CyfAFxSAVvD7Z OAcA== X-Gm-Message-State: AOJu0Yx+/NwyYmyEw7yVa5dC9XCy3HPd2N9Zfc3NEP2xVPkD7mYit9rc VAUco7J5WaDbUw82GisDKdGh+jdRjE/pXkY0TD/c8ZCtXFpIWO1QGjtbiArY/0jqd/DbElAUejH P3ejyfvkXnEbQVhLdyfVpvYGKPhix5Nwx0rNrp1KtdxcNtAMpxhEhkDWf0kTEM5iIvNZ7CAP77Y qMsJebZdfclCglIgfrqrhtJzO7B0M3Vg== X-Received: by 2002:a2e:9b50:0:b0:2ee:7a71:6e3b with SMTP id 38308e7fff4ca-2ee7a716f9emr3447831fa.27.1719929250046; Tue, 02 Jul 2024 07:07:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFM4iaAns7GOUfPGDVgEjQvEsH9+N2jBuvo+MiRqMKh7kkmQ29004uZ8ga71QcoruhGaU43zQ== X-Received: by 2002:a2e:9b50:0:b0:2ee:7a71:6e3b with SMTP id 38308e7fff4ca-2ee7a716f9emr3447661fa.27.1719929249451; Tue, 02 Jul 2024 07:07:29 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0e169dsm13248917f8f.65.2024.07.02.07.07.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:07:29 -0700 (PDT) Date: Tue, 2 Jul 2024 10:07:26 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Halil Pasic , Marc Hartmayer Subject: [PULL 10/91] vhost-vsock: add VIRTIO_F_RING_PACKED to feature_bits 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Halil Pasic Not having VIRTIO_F_RING_PACKED in feature_bits[] is a problem when the vhost-vsock device does not offer the feature bit VIRTIO_F_RING_PACKED but the in QEMU device is configured to try to use the packed layout (the virtio property "packed" is on). As of today, the Linux kernel vhost-vsock device does not support the packed queue layout (as vhost does not support packed), and does not offer VIRTIO_F_RING_PACKED. Thus when for example a vhost-vsock-ccw is used with packed=on, VIRTIO_F_RING_PACKED ends up being negotiated, despite the fact that the device does not actually support it, and one gets to keep the pieces. Fixes: 74b3e46630 ("virtio: add property to enable packed virtqueue") Reported-by: Marc Hartmayer Signed-off-by: Halil Pasic Message-Id: <20240429113334.2454197-1-pasic@linux.ibm.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-vsock-common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio/vhost-vsock-common.c b/hw/virtio/vhost-vsock-common.c index 12ea87d7a7..fd88df2560 100644 --- a/hw/virtio/vhost-vsock-common.c +++ b/hw/virtio/vhost-vsock-common.c @@ -22,6 +22,7 @@ const int feature_bits[] = { VIRTIO_VSOCK_F_SEQPACKET, VIRTIO_F_RING_RESET, + VIRTIO_F_RING_PACKED, VHOST_INVALID_FEATURE_BIT }; From patchwork Tue Jul 2 14:07:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719718 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 28A53C30658 for ; Tue, 2 Jul 2024 14:09:58 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeAe-00024x-Hk; Tue, 02 Jul 2024 10:07:48 -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 1sOeAa-00023R-T6 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:44 -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 1sOeAY-0007x4-JN for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929260; 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=Bf3inGfH3C1OrX/KdJFaqQvDHDePnfUDWhDjBaZ52tk=; b=O3j5J0v0vFSMiLulKM068Y8mV2J+86e5fbBWGJYnSwvIT+SvwfoZd9BVtJPNEb82PanvTr e3xtifQpMqxon1cx2bbaq2DCgkn/jef5fhNSeFHre+27qhez6FPf/Yd1hNQM7LmwKzv481 qsADgfDWmU2hyeIrm4R+l+bPTQThueY= 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-616-MJ4QSHjUOX-fLj2B6pW1HA-1; Tue, 02 Jul 2024 10:07:35 -0400 X-MC-Unique: MJ4QSHjUOX-fLj2B6pW1HA-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-42567dbbd20so31657415e9.0 for ; Tue, 02 Jul 2024 07:07:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929254; x=1720534054; 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=Bf3inGfH3C1OrX/KdJFaqQvDHDePnfUDWhDjBaZ52tk=; b=InVJs3fBH8s/6B/1pDV58pE0QXgadSZRvJZsempkgwv9+x/jdTwu7GgNMP4r1Ra72C W/vM/Hspb8lot8yyD6+RlDDjL7rSt0+jpXCNJYILQ5rnVgp3x2u7KMdpFrPXRNfCpGDF e+BrjtezYR1zXruYjjV/DnhzzLtcY8PCCm7KAMNk3NUKJUTHf7Po5IPQ3iZpXWCujOpl BmnRwCctgk1AwWQxX8RG6W3TIAduGaB0SSAezIwwmf/5GlaJtBOLm2vzKEaH4VjqGt0X 2h8T4Vz6nzd+ZfF6uLDNi322RgL3a9rzcraUdYjLjYkzrLYFYTFcAvbJIOm0+I4DOElX eMSg== X-Gm-Message-State: AOJu0YwloPrTHdOIl9J2K7uUSU+dhX5QEN85z6vW7oAno3OSIiUkfShM SRhYT4r6caUxcqjZhk/g3IOUrFNYXlCIQVrqByB8nylKG46FosTTDOZMIEuUMrTyD02RsbeZRYf X7nL3cpAR5xHcHxaNv424A5hDshmJCZQp6EMsk//m6ceGPcn+mI5hixj62qrC+t8XbVjjsmsnQu bIYPX3JZpQgb/g/bLG/5P2UdiuUV03qQ== X-Received: by 2002:a05:600c:4da1:b0:425:64c4:e016 with SMTP id 5b1f17b1804b1-4257a0098c1mr58126755e9.12.1719929254050; Tue, 02 Jul 2024 07:07:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGgqgXXTAj0rm4CAIuShkn4R+gTJ9PgwVNThobgo59qdwLkqdpgk8+yeCqyuWs3dnNY5m1lFA== X-Received: by 2002:a05:600c:4da1:b0:425:64c4:e016 with SMTP id 5b1f17b1804b1-4257a0098c1mr58126515e9.12.1719929253494; Tue, 02 Jul 2024 07:07:33 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af55cccsm199945575e9.16.2024.07.02.07.07.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:07:32 -0700 (PDT) Date: Tue, 2 Jul 2024 10:07:29 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Wafer , Jason Wang , Eugenio =?utf-8?b?UMOpcmV6?= Subject: [PULL 11/91] hw/virtio: Fix obtain the buffer id from the last descriptor Message-ID: <33abfea239592a706e98269b01c0096249612ea4.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Wafer The virtio-1.3 specification writes: 2.8.6 Next Flag: Descriptor Chaining Buffer ID is included in the last descriptor in the list. If the feature (_F_INDIRECT_DESC) has been negotiated, install only one descriptor in the virtqueue. Therefor the buffer id should be obtained from the first descriptor. In descriptor chaining scenarios, the buffer id should be obtained from the last descriptor. Fixes: 86044b24e8 ("virtio: basic packed virtqueue support") Signed-off-by: Wafer Reviewed-by: Jason Wang Reviewed-by: Eugenio Pérez Acked-by: Jason Wang Message-Id: <20240510072753.26158-2-wafer@jaguarmicro.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 28cd406e16..3678ec2f88 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1745,6 +1745,11 @@ static void *virtqueue_packed_pop(VirtQueue *vq, size_t sz) &indirect_desc_cache); } while (rc == VIRTQUEUE_READ_DESC_MORE); + if (desc_cache != &indirect_desc_cache) { + /* Buffer ID is included in the last descriptor in the list. */ + id = desc.id; + } + /* Now copy what we have collected and mapped */ elem = virtqueue_alloc_element(sz, out_num, in_num); for (i = 0; i < out_num; i++) { From patchwork Tue Jul 2 14:07:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719720 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B0B52C3064D for ; Tue, 2 Jul 2024 14:10:22 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeAe-000259-O8; Tue, 02 Jul 2024 10:07:48 -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 1sOeAb-00023i-ST for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07: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 1sOeAZ-0007xO-3T for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929262; 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=Hq1ZdMUpXgQO0jHpQkHjtkURKxmq/FjBLx45BW2ity0=; b=SRqRxE+INEdBxpLankakr1IyxEwS5O06Rfm6STMRlQkU/obBw0BWPQFdVr9FbHecAZHU/g E5b6WJL4fXmsqxLS2qHkrfO79guWqfPn0YtyokdRXH4+6xCyjPNLB0NhwasHPy25bPnuio 2o9/X+0EnQ4SMaW2KwbqEP+5PAOzfFQ= 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-128-EUon15auNiavX2KnKmrBsQ-1; Tue, 02 Jul 2024 10:07:39 -0400 X-MC-Unique: EUon15auNiavX2KnKmrBsQ-1 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-52cda76173dso3716467e87.2 for ; Tue, 02 Jul 2024 07:07:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929256; x=1720534056; 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=Hq1ZdMUpXgQO0jHpQkHjtkURKxmq/FjBLx45BW2ity0=; b=fdkZzH/HeETIEQ5B+/UT3yoFQbCpVvBQtVLJDzwFNspWYDo0Acluk9T6BBHnmQSqaH e/0lvXfeMAFv7CVYfTJ1LdF+9ASBlHunwQerK0/riCg85kGSwQHZzW6mTg4dnhj72Qvn aeCPZBCzfVJWt9Jxc0fg/1msPDqI9/Mw55PoddzRfu6B4t77aVYKWCv4kbCv/P3nx7l9 MlV+OVMyCGg/s7Pi5bL/c9kb+GqMOvAMCshK2MS3ABod2w8o/Eu6sRba9SBjHr4e24ct Mln7/HxVAtyjulqiQ6eVt7+ZHNmRwfQGxjANNucVAZsMuSuaVy9bSqCN0vN5ZZlN51st p+pA== X-Gm-Message-State: AOJu0YzfzxqjIhW74jjpdTGuOfbM4ma3BxZ+dNwOgYqoHTQ+oQVa75IB yFZgVA8uuJYiYw928qOzqvj8VWWHsQXUIdadUG+JnwuU8Ht1P6JaZd2dSa/TsKmEsnWgEF+QiWn 1PKL8u/ua9zPpdHKal1R1uk2mpSZ+a/ue2+byIW/6asPSBLTj6Jf3gqYlq+aBCDzVknvpJamh5L OnVkVbW2+5S2hXSWY6NPEZIWVeeglVAQ== X-Received: by 2002:a05:6512:6cf:b0:52d:582e:410f with SMTP id 2adb3069b0e04-52e826fc39amr5980456e87.46.1719929256677; Tue, 02 Jul 2024 07:07:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGymzmVHfBVpTtWSvIQDNsJDYacuIfyb5B3q5fYg+P0JgvBQl2JH1qR8VUY9x9SfW7OPt3h9Q== X-Received: by 2002:a05:6512:6cf:b0:52d:582e:410f with SMTP id 2adb3069b0e04-52e826fc39amr5980431e87.46.1719929256024; Tue, 02 Jul 2024 07:07:36 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a103371sm13371783f8f.101.2024.07.02.07.07.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:07:35 -0700 (PDT) Date: Tue, 2 Jul 2024 10:07:33 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jiqian Chen Subject: [PULL 12/91] virtio-pci: only reset pm state during resetting Message-ID: <84b58169e40f5c7428db6f0b229e01213068aa21.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Jiqian Chen Fix bug imported by 27ce0f3afc9dd ("fix Power Management Control Register for PCI Express virtio devices" After this change, observe that QEMU may erroneously clear the power status of the device, or may erroneously clear non writable registers, such as NO_SOFT_RESET, etc. Only state of PM_CTRL is writable. Only when flag VIRTIO_PCI_FLAG_INIT_PM is set, need to reset state. Fixes: 27ce0f3afc9dd ("fix Power Management Control Register for PCI Express virtio devices" Signed-off-by: Jiqian Chen Message-Id: <20240515073526.17297-2-Jiqian.Chen@amd.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-pci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index cffc7efcae..7d62e92365 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -2306,10 +2306,16 @@ static void virtio_pci_bus_reset_hold(Object *obj, ResetType type) virtio_pci_reset(qdev); if (pci_is_express(dev)) { + VirtIOPCIProxy *proxy = VIRTIO_PCI(dev); + pcie_cap_deverr_reset(dev); pcie_cap_lnkctl_reset(dev); - pci_set_word(dev->config + dev->exp.pm_cap + PCI_PM_CTRL, 0); + if (proxy->flags & VIRTIO_PCI_FLAG_INIT_PM) { + pci_word_test_and_clear_mask( + dev->config + dev->exp.pm_cap + PCI_PM_CTRL, + PCI_PM_CTRL_STATE_MASK); + } } } From patchwork Tue Jul 2 14:07:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719713 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 40551C3064D for ; Tue, 2 Jul 2024 14:09:32 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeAe-00025B-W2; Tue, 02 Jul 2024 10:07: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 1sOeAd-000246-1Y for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:47 -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 1sOeAY-0007xF-IT for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929261; 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=3bV+n5a+n2PubUhTQh2qtot7neovPmYiRH9+8WKEDSw=; b=boPF/u9hUk9B4ILn3LqZIY5n4i768QjdIqffYrFGvAj4lRgnz30zgx+NrCGBNKXqzMjJla um/WBZf40KPsN/BvYVzIHczBD3D4k35bqB2n+ylilophKMTj3eXzJbEQxSqY7S1rG80VM9 kV1qEBSKsBSK5gde40jspZmdujVt2aM= 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-247-nXCjM2ZFPVeASiLr9XDgLA-1; Tue, 02 Jul 2024 10:07:40 -0400 X-MC-Unique: nXCjM2ZFPVeASiLr9XDgLA-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-424a5a5f024so27779055e9.3 for ; Tue, 02 Jul 2024 07:07:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929259; x=1720534059; 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=3bV+n5a+n2PubUhTQh2qtot7neovPmYiRH9+8WKEDSw=; b=l/xIVxQrdQJvtc2/12YIYfEt7h1m+swn3NSkgx4UV2c0pktW73ss6vNbhSda8oRtRR YRBynekPcGClAA9PxUqmQGemyXkh7obNt1OhGmE0t9TAOUJrDuDY5Nwt4aDjhTO5NEgI Jp+3mM5vEbxfFQ2hYaM6gZoSOXa5Ix5OW2nD7HaXaOan74tI4gBQ26D8Hy0AT6S1IDGV R6Edfcad5DBatcOPiceWUCpPPESWOGuPsXU0/H+20si+qAxNRWjn6FO5KEzJlWv48Nvd YrGCBkazOXM0eB5I9h4Bu922n3kEIxTWmpX78heFOOZU/0W3Jhx0HGTREE3FgwU2rLZr brzg== X-Gm-Message-State: AOJu0Yxg3VqJ5Jd9pL+2y+SI+hKzW2TCS/cuBl8/P79xSKPDl1kDl6kR HNaK2lx4ZskrjytiYjEAcYNs8ML+RO9TMVZga8QmzTmXunt5O1Q+KkL2RA1Lz59tXs83pHGb6LX G8MD3q0h/e+j0zXY7VbRjOuw+z4wdJ16teiK2v2s+W+U1aO++Pr7sTacLc2J9O5JZkkNlYIJfLF +ZChl/+pDtTCMn5uJUJPz8yAzU1mO2iw== X-Received: by 2002:a5d:6dca:0:b0:365:f52f:cd44 with SMTP id ffacd0b85a97d-36775728576mr5520127f8f.57.1719929259039; Tue, 02 Jul 2024 07:07:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHIM1ZP+vmzsGsnx8o0JIoLbeSKLtZCenEwfTtlsov0wC79ovdtgvVToKBXbl5jQI3eO0sAow== X-Received: by 2002:a5d:6dca:0:b0:365:f52f:cd44 with SMTP id ffacd0b85a97d-36775728576mr5520110f8f.57.1719929258548; Tue, 02 Jul 2024 07:07:38 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a10307bsm13318067f8f.94.2024.07.02.07.07.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:07:38 -0700 (PDT) Date: Tue, 2 Jul 2024 10:07:36 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?Marc-Andr=C3=A9?= Lureau Subject: [PULL 13/91] vhost-user-gpu: fix import of DMABUF Message-ID: <80c8a26de5f1b7d67d4594957c0d82a0c47626be.1719929191.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, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Marc-André Lureau When using vhost-user-gpu with GL, qemu -display gtk doesn't show output and prints: qemu: eglCreateImageKHR failed Since commit 9ac06df8b ("virtio-gpu-udmabuf: correct naming of QemuDmaBuf size properties"), egl_dmabuf_import_texture() uses backing_{width,height} for the texture dimension. Fixes: 9ac06df8b ("virtio-gpu-udmabuf: correct naming of QemuDmaBuf size properties") Signed-off-by: Marc-André Lureau Message-Id: <20240515105237.1074116-1-marcandre.lureau@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/display/vhost-user-gpu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index e4b398d26c..63c64ddde6 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -281,8 +281,9 @@ vhost_user_gpu_handle_display(VhostUserGPU *g, VhostUserGpuMsg *msg) modifier = m2->modifier; } - dmabuf = qemu_dmabuf_new(m->fd_width, m->fd_height, - m->fd_stride, 0, 0, 0, 0, + dmabuf = qemu_dmabuf_new(m->width, m->height, + m->fd_stride, 0, 0, + m->fd_width, m->fd_height, m->fd_drm_fourcc, modifier, fd, false, m->fd_flags & VIRTIO_GPU_RESOURCE_FLAG_Y_0_TOP); From patchwork Tue Jul 2 14:07:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719760 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AFA41C3064D for ; Tue, 2 Jul 2024 14:17:48 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeAg-00025Z-Mp; Tue, 02 Jul 2024 10:07:50 -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 1sOeAf-00025C-3B for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07: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 1sOeAc-0007yX-Dn for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929265; 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=+cVsXdQI2RthGLy7TxkQZRDMuYIrDeTU2bckWSqVXa0=; b=JqOOt9aqTXjCqjjAE+aHMoJ2zxWHmrmTqka3OTdJU9Fwx3TSKUNArF8vP/Jx8HAXPN7aJy 6O2h2D+cERrOJZRqsJy8033iyQBMz7RqNpu0uDXg2GgKXMmVHvM2ZPHYvG/6xDeJad5eLo c9JDIhaJfyIO0i3JY/IEj3fpBiJd+aM= 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-655-6L7lHVMLPg61CZm_Axtfng-1; Tue, 02 Jul 2024 10:07:44 -0400 X-MC-Unique: 6L7lHVMLPg61CZm_Axtfng-1 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2ec507c1b59so51304981fa.3 for ; Tue, 02 Jul 2024 07:07:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929262; x=1720534062; 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=+cVsXdQI2RthGLy7TxkQZRDMuYIrDeTU2bckWSqVXa0=; b=m8DQK458z+tQHGHJinlUEQ9UkDjExVuwxgCKBbK3UPGWR5x7mAftUc0C3xbEBu2S8b GTEfdochVV5eg874NKwRnkyP/vyuYCGrMY51hvLpk5MJLUs0Rir3B/ffNrgMSfKgf4Xt 3kfKu9DTvKCFJH9Aw7KZpwOrCARo6vP6b5A2mc0PMG7sqW31d5eHc0cs9OsqwuX0xhhU kI8YwAqz6FpSxyHvxWZXkL/8q8MTGwaXMrpKljEf2YoJ2Nbd+BGvaKi/WJeT0GpNopni WnT7LlsHtM3gReSvWJp6xxhbf/ru63t9wRDOqygZnWs+IlHTovFhQ684VRKlAaG1kIcz IjoA== X-Gm-Message-State: AOJu0YztXttYGEjo7fyUpJGFzV7lhjw5sUwtKLtzP+vvqeC0HbuZxxWK pjmJ+C+RKxEogERvv15eOtA0gVP8CiQPWF9kPICCvE4cxg1oxwTWzJamo18K4F+FXMfr/DMG9fv 7u2DXvtyAHBWaxhJw5BOPm/9QzJyBhNIJe8s8CVrOtAkFW/3QgEiowBpcG9DrXvzX/35z8VKvCZ ZG6r0QWSIIPPbUjqNp8qmYitUMKilG5g== X-Received: by 2002:a2e:96cc:0:b0:2ee:7aac:f61a with SMTP id 38308e7fff4ca-2ee7aacfb2emr3832991fa.24.1719929262696; Tue, 02 Jul 2024 07:07:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFu9/ocsZ56ji3uTakB7Owb8a+TmfV8dKzHJoYEWxynvDeYv0VPmjhvtG3QMiytMDuiFwE2GA== X-Received: by 2002:a2e:96cc:0:b0:2ee:7aac:f61a with SMTP id 38308e7fff4ca-2ee7aacfb2emr3832601fa.24.1719929261974; Tue, 02 Jul 2024 07:07:41 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b064f16sm200018795e9.27.2024.07.02.07.07.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:07:41 -0700 (PDT) Date: Tue, 2 Jul 2024 10:07:38 -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?= , qemu-block@nongnu.org Subject: [PULL 14/91] Revert "vhost-user: fix lost reconnect" Message-ID: <9569fe0aacbe6c7752935c9ede427ca1e8aafe51.1719929191.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Li Feng This reverts commit f02a4b8e6431598612466f76aac64ab492849abf. Since the current patch cannot completely fix the lost reconnect problem, there is a scenario that is not considered: - When the virtio-blk driver is removed from the guest os, s->connected has no chance to be set to false, resulting in subsequent reconnection not being executed. The next patch will completely fix this issue with a better approach. Signed-off-by: Li Feng Message-Id: <20240516025753.130171-2-fengli@smartx.com> Reviewed-by: Raphael Norwitz 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-base.c | 2 +- hw/virtio/vhost-user.c | 10 ++-------- 5 files changed, 6 insertions(+), 14 deletions(-) diff --git a/include/hw/virtio/vhost-user.h b/include/hw/virtio/vhost-user.h index d7c09ffd34..324cd8663a 100644 --- a/include/hw/virtio/vhost-user.h +++ b/include/hw/virtio/vhost-user.h @@ -108,7 +108,6 @@ 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, - IOEventHandler *event_cb); + vu_async_close_fn cb); #endif diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index bc2677dbef..15cc24d017 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -385,7 +385,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_event); + vhost_user_blk_disconnect); 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 0b050805a8..421cd654f8 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -215,8 +215,7 @@ 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_event); + vhost_user_scsi_disconnect); break; case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: diff --git a/hw/virtio/vhost-user-base.c b/hw/virtio/vhost-user-base.c index a83167191e..4b54255682 100644 --- a/hw/virtio/vhost-user-base.c +++ b/hw/virtio/vhost-user-base.c @@ -254,7 +254,7 @@ static void vub_event(void *opaque, QEMUChrEvent event) case CHR_EVENT_CLOSED: /* defer close until later to avoid circular close */ vhost_user_async_close(dev, &vub->chardev, &vub->vhost_dev, - vub_disconnect, vub_event); + vub_disconnect); 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 cdf9af4a4b..c929097e87 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -2776,7 +2776,6 @@ typedef struct { DeviceState *dev; CharBackend *cd; struct vhost_dev *vhost; - IOEventHandler *event_cb; } VhostAsyncCallback; static void vhost_user_async_close_bh(void *opaque) @@ -2791,10 +2790,7 @@ 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); } @@ -2806,8 +2802,7 @@ 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, - IOEventHandler *event_cb) + vu_async_close_fn cb) { if (!runstate_check(RUN_STATE_SHUTDOWN)) { /* @@ -2823,7 +2818,6 @@ 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 Tue Jul 2 14:07:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719750 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 80F98C30658 for ; Tue, 2 Jul 2024 14:13:44 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeAj-00026w-Qm; Tue, 02 Jul 2024 10:07: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 1sOeAi-00026O-47 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:52 -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 1sOeAf-0007zZ-SI for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929269; 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=cwZ47LpotxgqMUotTFYaru0nOsyfZI/sw2MfKtbkph8=; b=EaJByCDMcxc5DCe3m/4z6pOoNRKCqTpxdi3Wd9B8UYmm1J5fegQ/tFGETsSKEiYezxArp8 FrZ2R5Xeas508UhPGe+7kl3S8rkYm6VXUA4adqcZGK4XIZpj1Ws1ErullYF34m0EmXlPes zSXb52PrFI9jt8fisFtIL+Ee0FTDDgw= 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-693-o8WKhhLgPdyCdgfLE2eYQg-1; Tue, 02 Jul 2024 10:07:47 -0400 X-MC-Unique: o8WKhhLgPdyCdgfLE2eYQg-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-36743ab5fb3so2630478f8f.1 for ; Tue, 02 Jul 2024 07:07:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929266; x=1720534066; 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=cwZ47LpotxgqMUotTFYaru0nOsyfZI/sw2MfKtbkph8=; b=UXsWUjwcyaTS8nh1GRQTwTPH4TeBsFUosZmss1MV1SAm3EI/vdVMlzeivveCeR2aWK D059eCSGCsjf5Hi0h08Og5j6ZzqpuFL8pYt8xgrVYUvUk4Kelwe6VAeRTm1/OUJGd6wU jrbNM/2beikJs3BzcCwNxajE4ruFq1LvFaLVNbNmGljI4SgbAnFabisJ6XbWm/OumW6m WWirr6CtrWqOe35bCm6aFJV5SJK6ivjvVBqoBNcFG4BmIcpY7ZhN0TSXff2elXUP0JAT HaBuLDzdJiZ6me2PyUCUwqJUfbQgDYakLHM7yv3V3f3x6wGsOrXTUlS424MvWj5ku+hW WFvg== X-Gm-Message-State: AOJu0YzNLJEa5W2EjPO1sUl1kMOqfW8lonFjP5JZ83PgEW/PhqvO/+lW WwIqfR4DFXFCa+T5RO54l7QGzYk8bKJTCFcDuhkg8aif02qQOybYar8r+zxnE4Ie4EWtVmqEA0m SHfgoDI6gEELpy0NKX8w1ivqVcKJ6949wxLs1PLrIOkYp2FjROt0/TGG/br130OeljfI/O+aCEG 4jSZtdUob3ohL6HKP9MJE92VrLxyjYbg== X-Received: by 2002:adf:f2ca:0:b0:366:ee81:b87c with SMTP id ffacd0b85a97d-36774f6bf88mr8214068f8f.15.1719929265893; Tue, 02 Jul 2024 07:07:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGrmSBBO1A0Pe+jdo0RDQVQ6XGCma7tuiFyTcLrn2jyS/37dQMuN5VA4TYjIKNS2K/zrHx32A== X-Received: by 2002:adf:f2ca:0:b0:366:ee81:b87c with SMTP id ffacd0b85a97d-36774f6bf88mr8214036f8f.15.1719929265280; Tue, 02 Jul 2024 07:07:45 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0fb9absm13366984f8f.80.2024.07.02.07.07.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:07:44 -0700 (PDT) Date: Tue, 2 Jul 2024 10:07:42 -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?= , qemu-block@nongnu.org Subject: [PULL 15/91] vhost-user: fix lost reconnect again Message-ID: <6eaf0e612b415877d1c411b95bed2ecb53b546bb.1719929191.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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 fail 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. We need to ensure that even if vhost_dev_init initialization fails, the event handler still needs to be reinstalled when s->connected is false. All vhost-user devices have this issue, including vhost-user-blk/scsi. Fixes: 71e076a07d ("hw/virtio: generalise CHR_EVENT_CLOSED handling") Signed-off-by: Li Feng Message-Id: <20240516025753.130171-3-fengli@smartx.com> Reviewed-by: Raphael Norwitz Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/block/vhost-user-blk.c | 3 ++- hw/scsi/vhost-user-scsi.c | 3 ++- hw/virtio/vhost-user-base.c | 3 ++- hw/virtio/vhost-user.c | 10 +--------- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index 15cc24d017..fdbc30b9ce 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -354,7 +354,7 @@ static void vhost_user_blk_disconnect(DeviceState *dev) VHostUserBlk *s = VHOST_USER_BLK(vdev); if (!s->connected) { - return; + goto done; } s->connected = false; @@ -362,6 +362,7 @@ static void vhost_user_blk_disconnect(DeviceState *dev) vhost_dev_cleanup(&s->dev); +done: /* Re-instate the event handler for new connections */ qemu_chr_fe_set_handlers(&s->chardev, NULL, NULL, vhost_user_blk_event, NULL, dev, NULL, true); diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index 421cd654f8..cc91ade525 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -182,7 +182,7 @@ static void vhost_user_scsi_disconnect(DeviceState *dev) VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(dev); if (!s->connected) { - return; + goto done; } s->connected = false; @@ -190,6 +190,7 @@ static void vhost_user_scsi_disconnect(DeviceState *dev) vhost_dev_cleanup(&vsc->dev); +done: /* 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); diff --git a/hw/virtio/vhost-user-base.c b/hw/virtio/vhost-user-base.c index 4b54255682..11e72b1e3b 100644 --- a/hw/virtio/vhost-user-base.c +++ b/hw/virtio/vhost-user-base.c @@ -225,13 +225,14 @@ static void vub_disconnect(DeviceState *dev) VHostUserBase *vub = VHOST_USER_BASE(vdev); if (!vub->connected) { - return; + goto done; } vub->connected = false; vub_stop(vdev); vhost_dev_cleanup(&vub->vhost_dev); +done: /* Re-instate the event handler for new connections */ qemu_chr_fe_set_handlers(&vub->chardev, NULL, NULL, vub_event, diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index c929097e87..c407ea8939 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -2781,16 +2781,8 @@ typedef struct { static void vhost_user_async_close_bh(void *opaque) { VhostAsyncCallback *data = opaque; - struct vhost_dev *vhost = data->vhost; - /* - * If the vhost_dev has been cleared in the meantime there is - * nothing left to do as some other path has completed the - * cleanup. - */ - if (vhost->vdev) { - data->cb(data->dev); - } + data->cb(data->dev); g_free(data); } From patchwork Tue Jul 2 14:07:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719707 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EC0DAC30658 for ; Tue, 2 Jul 2024 14:08:14 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeAo-00027Q-N1; Tue, 02 Jul 2024 10:07:59 -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 1sOeAl-000274-PM for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:55 -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 1sOeAj-00080C-KQ for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:07:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929272; 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=2dkENUzfzIIIcUTPF2EEwEXmUV3lpfWAm7D6XMdf5LE=; b=enU5Gl2GkFrUuF6VkFu6CsxeENM41H9M4y94aoQrAt8K1XYPRvUUEGYEJ5nUUVi21ze3FM TDvG+sQNaU0TQtQo6wc7fyvR9eMSJH0Bojcjsv6S4meIGh3veF7UkmPxgpViO2xBWPtfQS X0M9kmjnbdPcHcdqYVziu3IxdDEpvPM= 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-489-QbgU7H88OUuXFhKA27K9NQ-1; Tue, 02 Jul 2024 10:07:50 -0400 X-MC-Unique: QbgU7H88OUuXFhKA27K9NQ-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-3625bef4461so2106809f8f.1 for ; Tue, 02 Jul 2024 07:07:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929268; x=1720534068; 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=2dkENUzfzIIIcUTPF2EEwEXmUV3lpfWAm7D6XMdf5LE=; b=X3a2bplqfbbzfYWUa6Z5zx3O2xO3zC/hFvqMc5BJHpT2SOlCL1v0Gs6bOeHCo+X/JE 6Oy/moWo8pybDbsDwbHud1woZauGYuBQ0GLox84jwagNU5iI4F74xA5HhsSYjCQFGwBU ZCH/WuxSiLR5jeUCod3tOaMMd2cwcDGtCZ6OOj/qnI9Qs2aUH3MdJrL9cG7F2RTtC6NA XKb4LUbcCt4UwyhQ+nWXxldikszqnBU8WK5snfSka5729XXLZx8epd2eqgli6HxhhjQl pKISkmK9rWY1wjNDQ5XlqnATwTNEjTsdKCgHwgNTcZfScuZ4puiS1bJZRuKAToXg45HI IxFw== X-Gm-Message-State: AOJu0YwH/B2Ba7Swcth105lZxohi++RBRG7d7/AJA58USxT7O+nID5xW 0BXjwJmOFWMtYW81iEuufWylKSYcGbwP5fKrEPjRFkFZHIS7Xx+Ev3LnQVODaMYuSmWNsFc6O50 OuAXL2+Q+F6sy9qvl5zJtv4wtN5mg84zeFK26SGISqxohTayNPM4QSwATHHNxJbkbF3DuQJ/Y72 3Pr1s4fxwz9V0hq84D1gWMtw9MGfrwBQ== X-Received: by 2002:adf:fe89:0:b0:362:23d5:3928 with SMTP id ffacd0b85a97d-36760a782dfmr10036522f8f.17.1719929268575; Tue, 02 Jul 2024 07:07:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG57xXCEOvsjg3Z/3qLFCEJnKToPuhkGzSojMGDwiU2OYr+opfvgpPfIXglPzJt7Cti7ieiGQ== X-Received: by 2002:adf:fe89:0:b0:362:23d5:3928 with SMTP id ffacd0b85a97d-36760a782dfmr10036494f8f.17.1719929268053; Tue, 02 Jul 2024 07:07:48 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b061eedsm191132295e9.26.2024.07.02.07.07.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:07:47 -0700 (PDT) Date: Tue, 2 Jul 2024 10:07:45 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Gregory Price , Gregory Price , Jonathan Cameron , Fan Ni Subject: [PULL 16/91] hw/cxl/mailbox: change CCI cmd set structure to be a member, not a reference Message-ID: <05b70ceba033759d44c6d3d9b24118cd9fc9d616.1719929191.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Gregory Price This allows devices to have fully customized CCIs, along with complex devices where wrapper devices can override or add additional CCI commands without having to replicate full command structures or pollute a base device with every command that might ever be used. Signed-off-by: Gregory Price Signed-off-by: Jonathan Cameron Signed-off-by: Fan Ni Message-Id: <20240523174651.1089554-2-nifan.cxl@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/cxl/cxl_device.h | 2 +- hw/cxl/cxl-mailbox-utils.c | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h index 279b276bda..ccc4611875 100644 --- a/include/hw/cxl/cxl_device.h +++ b/include/hw/cxl/cxl_device.h @@ -164,7 +164,7 @@ typedef struct CXLEventLog { } CXLEventLog; typedef struct CXLCCI { - const struct cxl_cmd (*cxl_cmd_set)[256]; + struct cxl_cmd cxl_cmd_set[256][256]; struct cel_log { uint16_t opcode; uint16_t effect; diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index e5eb97cb91..2c9f50f0f9 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -1447,10 +1447,21 @@ void cxl_init_cci(CXLCCI *cci, size_t payload_max) bg_timercb, cci); } +static void cxl_copy_cci_commands(CXLCCI *cci, const struct cxl_cmd (*cxl_cmds)[256]) +{ + for (int set = 0; set < 256; set++) { + for (int cmd = 0; cmd < 256; cmd++) { + if (cxl_cmds[set][cmd].handler) { + cci->cxl_cmd_set[set][cmd] = cxl_cmds[set][cmd]; + } + } + } +} + void cxl_initialize_mailbox_swcci(CXLCCI *cci, DeviceState *intf, DeviceState *d, size_t payload_max) { - cci->cxl_cmd_set = cxl_cmd_set_sw; + cxl_copy_cci_commands(cci, cxl_cmd_set_sw); cci->d = d; cci->intf = intf; cxl_init_cci(cci, payload_max); @@ -1458,7 +1469,7 @@ void cxl_initialize_mailbox_swcci(CXLCCI *cci, DeviceState *intf, void cxl_initialize_mailbox_t3(CXLCCI *cci, DeviceState *d, size_t payload_max) { - cci->cxl_cmd_set = cxl_cmd_set; + cxl_copy_cci_commands(cci, cxl_cmd_set); cci->d = d; /* No separation for PCI MB as protocol handled in PCI device */ @@ -1476,7 +1487,7 @@ static const struct cxl_cmd cxl_cmd_set_t3_ld[256][256] = { void cxl_initialize_t3_ld_cci(CXLCCI *cci, DeviceState *d, DeviceState *intf, size_t payload_max) { - cci->cxl_cmd_set = cxl_cmd_set_t3_ld; + cxl_copy_cci_commands(cci, cxl_cmd_set_t3_ld); cci->d = d; cci->intf = intf; cxl_init_cci(cci, payload_max); @@ -1496,7 +1507,7 @@ void cxl_initialize_t3_fm_owned_ld_mctpcci(CXLCCI *cci, DeviceState *d, DeviceState *intf, size_t payload_max) { - cci->cxl_cmd_set = cxl_cmd_set_t3_fm_owned_ld_mctp; + cxl_copy_cci_commands(cci, cxl_cmd_set_t3_fm_owned_ld_mctp); cci->d = d; cci->intf = intf; cxl_init_cci(cci, payload_max); From patchwork Tue Jul 2 14:07:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719710 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33606C3064D for ; Tue, 2 Jul 2024 14:08:49 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeAy-0002Xa-Ae; Tue, 02 Jul 2024 10:08:09 -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 1sOeAt-0002Pi-Fx for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:03 -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 1sOeAm-00080g-Mr for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929276; 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=I7oOBawQ17ekJGPjTeJH6qenvWsB1BSkAwbq0wuPpCg=; b=f/yxZS8XfLBn37P7bovOimpV2RrrMhevsmKeTd7JInRz9xCoVEHV/kONnOiOigCQLmXJ14 NuPOoRcpOzt8GbKBW52MeiVp+IirBHlBJmoygO+MjPgF74Y9cbwEsBq1ejeQh4XlhL/8gZ MKKUbJneaHQsuk8OQm6i4lvEVdGqg0g= 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-86-YOBoCjopNKm_sfNqT6rJQg-1; Tue, 02 Jul 2024 10:07:53 -0400 X-MC-Unique: YOBoCjopNKm_sfNqT6rJQg-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4255f94080bso29669845e9.2 for ; Tue, 02 Jul 2024 07:07:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929271; x=1720534071; 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=I7oOBawQ17ekJGPjTeJH6qenvWsB1BSkAwbq0wuPpCg=; b=sRMSCF6yss8clufIDb8CBa5nuQjf7l3df/FFKpLJ+jYyWyWDnChlC5mExtftNIFQR3 noOm3yAxUmHwTCzhU+NiqJWiTc6SXk9Q8Zr6fkPgwRuFzUMGT3oaNdFvaIRxG3XqUwwI tpecAPrE+lzZk/mDhd37gEcxFkxwuEx68YQEzKmIcdJKeq1gMqKhTB8pZqNe3neaTtvq Oohd0lRTuy/ItcHg/dYZDvSwQYoQ33sfgwq6G7Akw0vqCoTJdAC/wYR9m8hlmyp7C5WF ctArDwZYRN8AGNVD79S1gGdeO8hmfcHPj0ibOQSRszPV5sMxdOUexasf/Hp42ji91pM4 gT2w== X-Gm-Message-State: AOJu0YyEfOwG3EBRf2jszf/vmiy2ukmWmKaHw+32z4DuouBskTLgDQy8 RX3+D3fyamABAkFr7RbXU8NgYCT73qgZtpMl9R+xJSuqBQFeG1r1+jXR7aXap6kkGq23yXMrEm/ tcYg909QvJoWE6GVmGBwtRCzT2seBf8kfjQKUadrNWhucHxXhs2IUHntNOmAsJYCw1wMX1jHbu3 AtADKsyUWjLFG2f9Yal/RPqACtlB0FsA== X-Received: by 2002:a5d:598e:0:b0:362:4ce:2171 with SMTP id ffacd0b85a97d-3677571c1famr5822540f8f.52.1719929271683; Tue, 02 Jul 2024 07:07:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6J/xB/tWrSfg2unlai84hYbi+kiEygCd2zLRXQLV+Fp2UjpW5lITljNwG2JXdSSNf6W+k5A== X-Received: by 2002:a5d:598e:0:b0:362:4ce:2171 with SMTP id ffacd0b85a97d-3677571c1famr5822505f8f.52.1719929271128; Tue, 02 Jul 2024 07:07:51 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3678a23b349sm1509179f8f.36.2024.07.02.07.07.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:07:50 -0700 (PDT) Date: Tue, 2 Jul 2024 10:07:48 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Gregory Price , Gregory Price , Jonathan Cameron , Fan Ni Subject: [PULL 17/91] hw/cxl/mailbox: interface to add CCI commands to an existing CCI Message-ID: <67adb7979b6c1151a906d99f19fccf1e789316b1.1719929191.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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Gregory Price This enables wrapper devices to customize the base device's CCI (for example, with custom commands outside the specification) without the need to change the base device. The also enabled the base device to dispatch those commands without requiring additional driver support. Heavily edited by Jonathan Cameron to increase code reuse Signed-off-by: Gregory Price Signed-off-by: Jonathan Cameron Signed-off-by: Fan Ni Message-Id: <20240523174651.1089554-3-nifan.cxl@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/cxl/cxl_device.h | 2 ++ hw/cxl/cxl-mailbox-utils.c | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h index ccc4611875..a5f8e25020 100644 --- a/include/hw/cxl/cxl_device.h +++ b/include/hw/cxl/cxl_device.h @@ -301,6 +301,8 @@ void cxl_initialize_mailbox_t3(CXLCCI *cci, DeviceState *d, size_t payload_max); void cxl_initialize_mailbox_swcci(CXLCCI *cci, DeviceState *intf, DeviceState *d, size_t payload_max); void cxl_init_cci(CXLCCI *cci, size_t payload_max); +void cxl_add_cci_commands(CXLCCI *cci, const struct cxl_cmd (*cxl_cmd_set)[256], + size_t payload_max); int cxl_process_cci_message(CXLCCI *cci, uint8_t set, uint8_t cmd, size_t len_in, uint8_t *pl_in, size_t *len_out, uint8_t *pl_out, diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index 2c9f50f0f9..2a64c58e2f 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -1424,9 +1424,9 @@ static void bg_timercb(void *opaque) } } -void cxl_init_cci(CXLCCI *cci, size_t payload_max) +static void cxl_rebuild_cel(CXLCCI *cci) { - cci->payload_max = payload_max; + cci->cel_size = 0; /* Reset for a fresh build */ for (int set = 0; set < 256; set++) { for (int cmd = 0; cmd < 256; cmd++) { if (cci->cxl_cmd_set[set][cmd].handler) { @@ -1440,6 +1440,13 @@ void cxl_init_cci(CXLCCI *cci, size_t payload_max) } } } +} + +void cxl_init_cci(CXLCCI *cci, size_t payload_max) +{ + cci->payload_max = payload_max; + cxl_rebuild_cel(cci); + cci->bg.complete_pct = 0; cci->bg.starttime = 0; cci->bg.runtime = 0; @@ -1458,6 +1465,14 @@ static void cxl_copy_cci_commands(CXLCCI *cci, const struct cxl_cmd (*cxl_cmds)[ } } +void cxl_add_cci_commands(CXLCCI *cci, const struct cxl_cmd (*cxl_cmd_set)[256], + size_t payload_max) +{ + cci->payload_max = MAX(payload_max, cci->payload_max); + cxl_copy_cci_commands(cci, cxl_cmd_set); + cxl_rebuild_cel(cci); +} + void cxl_initialize_mailbox_swcci(CXLCCI *cci, DeviceState *intf, DeviceState *d, size_t payload_max) { From patchwork Tue Jul 2 14:07:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719841 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 44799C30658 for ; Tue, 2 Jul 2024 14:27:18 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeAv-0002UA-Az; Tue, 02 Jul 2024 10:08: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 1sOeAr-0002OT-G9 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08: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 1sOeAo-00080y-HR for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929277; 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=R2rkXgOWy7oaxjC82Fwhko4ewIXnfZhtW9KkNOPqa7A=; b=DYLDX/3EBozASiv6n/Y5lQ+FBqbdyzUJ31enMJt7X28dI0mPELwaWZSoM4ZYUIasa2wFs9 NSfIvyauHVFs8qjkKFzhy+AaZS3HUbejdmUCI6xDOAVMvuZKeUJ2mM6agkYUeCZszPZV99 776keFrO0S8fNyTb2X0/fkiY2pW1pkA= 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-349-UAbieWo1N4OjF9e-occ0IA-1; Tue, 02 Jul 2024 10:07:56 -0400 X-MC-Unique: UAbieWo1N4OjF9e-occ0IA-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4255f94080bso29671135e9.2 for ; Tue, 02 Jul 2024 07:07:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929275; x=1720534075; 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=R2rkXgOWy7oaxjC82Fwhko4ewIXnfZhtW9KkNOPqa7A=; b=sUDHwmlDPGsl1RnbUGeyPorKIM2E6ANn5R4+h7CnbTHaUYAuRl83Da3K1+0101Mhsp Z/PMKhL8eCxvwWYXJVMqpyMxiraOWkilS9tCynG3VFhw7dfBQ538L+/GKSKYjpwRY8XK WeIubEI5j9JroK8w7V1VAf+QXRP9yLzR1yiZisbF+37Wd5oGA7lNLfWwImUM5KPDM9uI csm/JBU2bBXoeMoD8kGSSenH9dZkxHcuv02w6kpDVmr+ujE0oobCnDv7YJf8uHfl+hzM EsF7A9NC0UiX9QxmSMYZTVGikBA0Yx5oOpf9DFwf77fV2q2sGqRwkQ/rGJ8G2T+mn4Qk utHA== X-Gm-Message-State: AOJu0YwnbTUB6N6296fsk/yrMIS96ZPs/hZYVc641/gLxX4s6wy/d17+ IULsXHLdbO6lx/VORlNVkLCSa8PLQ2/hMd0CHk+gDsFmQvRxvKFwjnG0p8s0TC1crmzK0dbP53w iQTwWl5fu33dghvL4pLQAPKReDHGnl2kAJiwRKezSjs9jD2N+Do/aZQtOTmw4xUOMR1b4iny0vO nl8NwszKAx0FLorNS0bLEB2vvP/PthWA== X-Received: by 2002:a05:600c:492f:b0:424:a5d8:ac83 with SMTP id 5b1f17b1804b1-4257a03acddmr47831615e9.41.1719929275147; Tue, 02 Jul 2024 07:07:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG1hlY2v4BJ6yEstzJiLUzKEAnawVgGZ0v0W1UoDtIl3vwYLFT+TXU5ilYgRZBh0PN35zuVXA== X-Received: by 2002:a05:600c:492f:b0:424:a5d8:ac83 with SMTP id 5b1f17b1804b1-4257a03acddmr47831405e9.41.1719929274634; Tue, 02 Jul 2024 07:07:54 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0d8cd8sm13303291f8f.27.2024.07.02.07.07.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:07:54 -0700 (PDT) Date: Tue, 2 Jul 2024 10:07:51 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Fan Ni , Gregory Price , Jonathan Cameron Subject: [PULL 18/91] hw/cxl/cxl-mailbox-utils: Add dc_event_log_size field to output payload of identify memory device command Message-ID: <7a21e5dedbbcec11ebab7a53186085f09a53f9e7.1719929191.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Fan Ni Based on CXL spec r3.1 Table 8-127 (Identify Memory Device Output Payload), dynamic capacity event log size should be part of output of the Identify command. Add dc_event_log_size to the output payload for the host to get the info. Reviewed-by: Gregory Price Reviewed-by: Jonathan Cameron Signed-off-by: Fan Ni Message-Id: <20240523174651.1089554-4-nifan.cxl@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/cxl/cxl-mailbox-utils.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index 2a64c58e2f..626acc1d0d 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -21,6 +21,7 @@ #include "sysemu/hostmem.h" #define CXL_CAPACITY_MULTIPLIER (256 * MiB) +#define CXL_DC_EVENT_LOG_SIZE 8 /* * How to add a new command, example. The command set FOO, with cmd BAR. @@ -780,8 +781,9 @@ static CXLRetCode cmd_identify_memory_device(const struct cxl_cmd *cmd, uint16_t inject_poison_limit; uint8_t poison_caps; uint8_t qos_telemetry_caps; + uint16_t dc_event_log_size; } QEMU_PACKED *id; - QEMU_BUILD_BUG_ON(sizeof(*id) != 0x43); + QEMU_BUILD_BUG_ON(sizeof(*id) != 0x45); CXLType3Dev *ct3d = CXL_TYPE3(cci->d); CXLType3Class *cvc = CXL_TYPE3_GET_CLASS(ct3d); CXLDeviceState *cxl_dstate = &ct3d->cxl_dstate; @@ -807,6 +809,7 @@ static CXLRetCode cmd_identify_memory_device(const struct cxl_cmd *cmd, st24_le_p(id->poison_list_max_mer, 256); /* No limit - so limited by main poison record limit */ stw_le_p(&id->inject_poison_limit, 0); + stw_le_p(&id->dc_event_log_size, CXL_DC_EVENT_LOG_SIZE); *len_out = sizeof(*id); return CXL_MBOX_SUCCESS; From patchwork Tue Jul 2 14:07:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719724 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A6034C3065C for ; Tue, 2 Jul 2024 14:11:35 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeB0-0002aJ-DV; Tue, 02 Jul 2024 10:08: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 1sOeAw-0002VP-0P for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:06 -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 1sOeAu-00081b-2j for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929281; 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=Q5yMEJxQrvHs2013SKJXv7QWp1/VlpmqevozX2UnFx8=; b=Weo7Lno///QjuCf2Bti3HuR+Pvg84NjUxnLqJAkIhXU9q9oDchG5zH2MV1ei8p3uxcQ16c NGoKtnFsV1x0F52iTWiKNCqvNzGJiq3p5ilryOoPPr2OPowBBfQ77rb6NFLEk8HAeArbQ5 Ix3vRpHjJfEJAyctcCactUJ/HJDzt10= 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-554-a_HDeQMfOS-LYxDnDYdshA-1; Tue, 02 Jul 2024 10:07:59 -0400 X-MC-Unique: a_HDeQMfOS-LYxDnDYdshA-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-3678f832c75so101495f8f.3 for ; Tue, 02 Jul 2024 07:07:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929278; x=1720534078; 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=Q5yMEJxQrvHs2013SKJXv7QWp1/VlpmqevozX2UnFx8=; b=vFjc9WJaJh01kg6RXfetkKYqCP0uB8F0+76L7Wq1ldafBhEI9BmsJ0r5xxwNNyvC/D S+ST1vF0/peZ4/RpGQnxSfhrDYAxmImxORSNttbVtfjhXmlFWLKCIVyAZrjyIkIRttT0 Gy3LYscztpYgpkdBAp4eX0P97LdpLSiDMHk83XeBn+L44rYa05zdliTZouBYWyv1OXn8 yIS5ylOkgod+xSerUwKDiPiuLt2I2laxCzSjT7Q5XEA6Gd0KVH6ekywvFj3HesKQ0Sx7 riyDgVfroAPCFR0ZE+A3j9iNL5a52rdNHY50eoKlfQ5krNZzAprTFlrARx03GOnvr+Lr IUyQ== X-Gm-Message-State: AOJu0Yx2lXAB+Jv7eHE71DGRBindoK4cTNYcUOBYjB7TWe6jaWSbRqdf awO/SizjIQJ/r8X3JQ/AJsQezaHcn3qhBxdl081KJ6ojv83G7eslrNT/EA0giJ2ASXc56KvwHzw IGP5SWuAcQ7b+lx3DhzdfXSY1u5iLz06hmvuvaYw0bFYLrzpIOWqMgDdgVtgU/LXGkKM73gM3a3 uVNqozSVLW3oGSMp7yF7a2Rt4JlYC2UA== X-Received: by 2002:adf:fe51:0:b0:367:40e6:46a7 with SMTP id ffacd0b85a97d-367756aaceemr6192282f8f.28.1719929277977; Tue, 02 Jul 2024 07:07:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGwuCiF7bKnGdQ9HRLEATic7czP7pcUHjIRY37b1LTB3J2FXFq3M3KV4ozVmmswef3pKvJbAQ== X-Received: by 2002:adf:fe51:0:b0:367:40e6:46a7 with SMTP id ffacd0b85a97d-367756aaceemr6192253f8f.28.1719929277363; Tue, 02 Jul 2024 07:07:57 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0cd712sm13349005f8f.20.2024.07.02.07.07.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:07:56 -0700 (PDT) Date: Tue, 2 Jul 2024 10:07:54 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Fan Ni , Gregory Price , Jonathan Cameron Subject: [PULL 19/91] hw/cxl/cxl-mailbox-utils: Add dynamic capacity region representative and mailbox command support Message-ID: <0f0f140b100392fd938eb6933752155ea68b26a8.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Fan Ni Per cxl spec r3.1, add dynamic capacity (DC) region representative based on Table 8-165 and extend the cxl type3 device definition to include DC region information. Also, based on info in 8.2.9.9.9.1, add 'Get Dynamic Capacity Configuration' mailbox support. Note: we store region decode length as byte-wise length on the device, which should be divided by 256 * MiB before being returned to the host for "Get Dynamic Capacity Configuration" mailbox command per specification. Reviewed-by: Gregory Price Reviewed-by: Jonathan Cameron Signed-off-by: Fan Ni Message-Id: <20240523174651.1089554-5-nifan.cxl@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/cxl/cxl_device.h | 16 +++++++ hw/cxl/cxl-mailbox-utils.c | 96 +++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h index a5f8e25020..e839370266 100644 --- a/include/hw/cxl/cxl_device.h +++ b/include/hw/cxl/cxl_device.h @@ -422,6 +422,17 @@ typedef struct CXLPoison { typedef QLIST_HEAD(, CXLPoison) CXLPoisonList; #define CXL_POISON_LIST_LIMIT 256 +#define DCD_MAX_NUM_REGION 8 + +typedef struct CXLDCRegion { + uint64_t base; /* aligned to 256*MiB */ + uint64_t decode_len; /* aligned to 256*MiB */ + uint64_t len; + uint64_t block_size; + uint32_t dsmadhandle; + uint8_t flags; +} CXLDCRegion; + struct CXLType3Dev { /* Private */ PCIDevice parent_obj; @@ -454,6 +465,11 @@ struct CXLType3Dev { unsigned int poison_list_cnt; bool poison_list_overflowed; uint64_t poison_list_overflow_ts; + + struct dynamic_capacity { + uint8_t num_regions; /* 0-8 regions */ + CXLDCRegion regions[DCD_MAX_NUM_REGION]; + } dc; }; #define TYPE_CXL_TYPE3 "cxl-type3" diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index 626acc1d0d..bede28e3c8 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -22,6 +22,8 @@ #define CXL_CAPACITY_MULTIPLIER (256 * MiB) #define CXL_DC_EVENT_LOG_SIZE 8 +#define CXL_NUM_EXTENTS_SUPPORTED 512 +#define CXL_NUM_TAGS_SUPPORTED 0 /* * How to add a new command, example. The command set FOO, with cmd BAR. @@ -80,6 +82,8 @@ enum { #define GET_POISON_LIST 0x0 #define INJECT_POISON 0x1 #define CLEAR_POISON 0x2 + DCD_CONFIG = 0x48, + #define GET_DC_CONFIG 0x0 PHYSICAL_SWITCH = 0x51, #define IDENTIFY_SWITCH_DEVICE 0x0 #define GET_PHYSICAL_PORT_STATE 0x1 @@ -1238,6 +1242,88 @@ static CXLRetCode cmd_media_clear_poison(const struct cxl_cmd *cmd, return CXL_MBOX_SUCCESS; } +/* + * CXL r3.1 section 8.2.9.9.9.1: Get Dynamic Capacity Configuration + * (Opcode: 4800h) + */ +static CXLRetCode cmd_dcd_get_dyn_cap_config(const struct cxl_cmd *cmd, + uint8_t *payload_in, + size_t len_in, + uint8_t *payload_out, + size_t *len_out, + CXLCCI *cci) +{ + CXLType3Dev *ct3d = CXL_TYPE3(cci->d); + struct { + uint8_t region_cnt; + uint8_t start_rid; + } QEMU_PACKED *in = (void *)payload_in; + struct { + uint8_t num_regions; + uint8_t regions_returned; + uint8_t rsvd1[6]; + struct { + uint64_t base; + uint64_t decode_len; + uint64_t region_len; + uint64_t block_size; + uint32_t dsmadhandle; + uint8_t flags; + uint8_t rsvd2[3]; + } QEMU_PACKED records[]; + } QEMU_PACKED *out = (void *)payload_out; + struct { + uint32_t num_extents_supported; + uint32_t num_extents_available; + uint32_t num_tags_supported; + uint32_t num_tags_available; + } QEMU_PACKED *extra_out; + uint16_t record_count; + uint16_t i; + uint16_t out_pl_len; + uint8_t start_rid; + + start_rid = in->start_rid; + if (start_rid >= ct3d->dc.num_regions) { + return CXL_MBOX_INVALID_INPUT; + } + + record_count = MIN(ct3d->dc.num_regions - in->start_rid, in->region_cnt); + + out_pl_len = sizeof(*out) + record_count * sizeof(out->records[0]); + extra_out = (void *)(payload_out + out_pl_len); + out_pl_len += sizeof(*extra_out); + assert(out_pl_len <= CXL_MAILBOX_MAX_PAYLOAD_SIZE); + + out->num_regions = ct3d->dc.num_regions; + out->regions_returned = record_count; + for (i = 0; i < record_count; i++) { + stq_le_p(&out->records[i].base, + ct3d->dc.regions[start_rid + i].base); + stq_le_p(&out->records[i].decode_len, + ct3d->dc.regions[start_rid + i].decode_len / + CXL_CAPACITY_MULTIPLIER); + stq_le_p(&out->records[i].region_len, + ct3d->dc.regions[start_rid + i].len); + stq_le_p(&out->records[i].block_size, + ct3d->dc.regions[start_rid + i].block_size); + stl_le_p(&out->records[i].dsmadhandle, + ct3d->dc.regions[start_rid + i].dsmadhandle); + out->records[i].flags = ct3d->dc.regions[start_rid + i].flags; + } + /* + * TODO: Assign values once extents and tags are introduced + * to use. + */ + stl_le_p(&extra_out->num_extents_supported, CXL_NUM_EXTENTS_SUPPORTED); + stl_le_p(&extra_out->num_extents_available, CXL_NUM_EXTENTS_SUPPORTED); + stl_le_p(&extra_out->num_tags_supported, CXL_NUM_TAGS_SUPPORTED); + stl_le_p(&extra_out->num_tags_available, CXL_NUM_TAGS_SUPPORTED); + + *len_out = out_pl_len; + return CXL_MBOX_SUCCESS; +} + #define IMMEDIATE_CONFIG_CHANGE (1 << 1) #define IMMEDIATE_DATA_CHANGE (1 << 2) #define IMMEDIATE_POLICY_CHANGE (1 << 3) @@ -1282,6 +1368,11 @@ static const struct cxl_cmd cxl_cmd_set[256][256] = { cmd_media_clear_poison, 72, 0 }, }; +static const struct cxl_cmd cxl_cmd_set_dcd[256][256] = { + [DCD_CONFIG][GET_DC_CONFIG] = { "DCD_GET_DC_CONFIG", + cmd_dcd_get_dyn_cap_config, 2, 0 }, +}; + static const struct cxl_cmd cxl_cmd_set_sw[256][256] = { [INFOSTAT][IS_IDENTIFY] = { "IDENTIFY", cmd_infostat_identify, 0, 0 }, [INFOSTAT][BACKGROUND_OPERATION_STATUS] = { "BACKGROUND_OPERATION_STATUS", @@ -1487,7 +1578,12 @@ void cxl_initialize_mailbox_swcci(CXLCCI *cci, DeviceState *intf, void cxl_initialize_mailbox_t3(CXLCCI *cci, DeviceState *d, size_t payload_max) { + CXLType3Dev *ct3d = CXL_TYPE3(d); + cxl_copy_cci_commands(cci, cxl_cmd_set); + if (ct3d->dc.num_regions) { + cxl_copy_cci_commands(cci, cxl_cmd_set_dcd); + } cci->d = d; /* No separation for PCI MB as protocol handled in PCI device */ From patchwork Tue Jul 2 14:07:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719709 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9E7F1C3064D for ; Tue, 2 Jul 2024 14:08:27 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeBB-0002fk-GX; Tue, 02 Jul 2024 10:08:21 -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 1sOeAw-0002WU-LP for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:06 -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 1sOeAu-00083H-Ul for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929284; 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=/tkdF9wBgRXJ0C7b2uR1oP4dL+2Be2HPdzcygUpss9I=; b=gIY04t149Mw1/ilnmefrNaPUdJ8P0R2nLaXkA6JpR9OAJYEy2YF+U6xE026YSWW02SGdSf iYj/6czbyDK/0g42fhVYJ8Grw8nQe0++t2X/qbQm8CcRF8lQaJZVMl7X0VlfrpQu1Xfu0W nDxDO5px6rLEv637qo7qXf75lCxJ3mg= 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-606-iSAmvJvtNYi3SBScrgX39w-1; Tue, 02 Jul 2024 10:08:02 -0400 X-MC-Unique: iSAmvJvtNYi3SBScrgX39w-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4248fa5daacso29552115e9.0 for ; Tue, 02 Jul 2024 07:08:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929281; x=1720534081; 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=/tkdF9wBgRXJ0C7b2uR1oP4dL+2Be2HPdzcygUpss9I=; b=skmLKAXMA/7EJXiMChjqTGZ7J/BWHczL7VWyg0DGg/hFAeKhfPNxD+rp55b84E5ptk wZHsWLPtR/GTkbN6o3iEceENjw0XuRa+VfXxhs+3xLbUEIsn4P7WWboJt+4Tb51q7qy8 FtUjGDi2ZloiJDPVs1I9B4JjadIw5P5eUL3j8vBkTQrjVQrcpEWaUKOUxScJAvPAHx64 ksrXv3vywupn7vl5sXuhWyOGkqQTchCiEHr7awNL2rqCUm9tJ2p7KNQ1eCmhQn1qkgEI dXbWl4jdrGdwbsKMkiDnmm1igH7I8zZowB6YoXD7DBf8gvEoekVUzsoUXlj/3yFCsW/F Eq0g== X-Gm-Message-State: AOJu0YyGGTpTlQac7DAI979qFdNI/yX8XlrXQNyJDgluov8AB77QIp3d +pVokOKWIgrpB/awNI1hfc/5w8s1J1hie9uTtO/75YUtKO2/jbvDp9lwPI3mgEMTqcSInzuiOPV TXFi9PWJzebNjFS+Qx/bR4Yf7eFgQA0W5Gn0L38CDQWFz+ppJcsF7xWmFyBeUpZoSK10G7mEMBM wnPqrx+Qyo+dWFy5pMR1It8jBD2zsNWw== X-Received: by 2002:a05:600c:1550:b0:425:7a6b:4e82 with SMTP id 5b1f17b1804b1-4257a6b5129mr57627295e9.27.1719929281126; Tue, 02 Jul 2024 07:08:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEjN+JaLWULneOF9R1UcSl6WQu6fzqhder0nM0IxOwIW9AqrKjfmUFqLBQp5QhzVL5iZ9zKVw== X-Received: by 2002:a05:600c:1550:b0:425:7a6b:4e82 with SMTP id 5b1f17b1804b1-4257a6b5129mr57627095e9.27.1719929280593; Tue, 02 Jul 2024 07:08:00 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b097b77sm196790735e9.33.2024.07.02.07.07.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:08:00 -0700 (PDT) Date: Tue, 2 Jul 2024 10:07:57 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Fan Ni , Gregory Price , Jonathan Cameron Subject: [PULL 20/91] include/hw/cxl/cxl_device: Rename mem_size as static_mem_size for type3 memory devices Message-ID: <25851080772387ae33d6ee94250b3a31bf719e5c.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Fan Ni Rename mem_size as static_mem_size for type3 memdev to cover static RAM and pmem capacity, preparing for the introduction of dynamic capacity to support dynamic capacity devices. Reviewed-by: Gregory Price Reviewed-by: Jonathan Cameron Signed-off-by: Fan Ni Message-Id: <20240523174651.1089554-6-nifan.cxl@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/cxl/cxl_device.h | 2 +- hw/cxl/cxl-mailbox-utils.c | 4 ++-- hw/mem/cxl_type3.c | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h index e839370266..f7f56b44e3 100644 --- a/include/hw/cxl/cxl_device.h +++ b/include/hw/cxl/cxl_device.h @@ -234,7 +234,7 @@ typedef struct cxl_device_state { } timestamp; /* memory region size, HDM */ - uint64_t mem_size; + uint64_t static_mem_size; uint64_t pmem_size; uint64_t vmem_size; diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index bede28e3c8..b592473587 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -803,7 +803,7 @@ static CXLRetCode cmd_identify_memory_device(const struct cxl_cmd *cmd, snprintf(id->fw_revision, 0x10, "BWFW VERSION %02d", 0); stq_le_p(&id->total_capacity, - cxl_dstate->mem_size / CXL_CAPACITY_MULTIPLIER); + cxl_dstate->static_mem_size / CXL_CAPACITY_MULTIPLIER); stq_le_p(&id->persistent_capacity, cxl_dstate->pmem_size / CXL_CAPACITY_MULTIPLIER); stq_le_p(&id->volatile_capacity, @@ -1179,7 +1179,7 @@ static CXLRetCode cmd_media_clear_poison(const struct cxl_cmd *cmd, struct clear_poison_pl *in = (void *)payload_in; dpa = ldq_le_p(&in->dpa); - if (dpa + CXL_CACHE_LINE_SIZE > cxl_dstate->mem_size) { + if (dpa + CXL_CACHE_LINE_SIZE > cxl_dstate->static_mem_size) { return CXL_MBOX_INVALID_PA; } diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index 3e42490b6c..7194c8f902 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -608,7 +608,7 @@ static bool cxl_setup_memory(CXLType3Dev *ct3d, Error **errp) } address_space_init(&ct3d->hostvmem_as, vmr, v_name); ct3d->cxl_dstate.vmem_size = memory_region_size(vmr); - ct3d->cxl_dstate.mem_size += memory_region_size(vmr); + ct3d->cxl_dstate.static_mem_size += memory_region_size(vmr); g_free(v_name); } @@ -631,7 +631,7 @@ static bool cxl_setup_memory(CXLType3Dev *ct3d, Error **errp) } address_space_init(&ct3d->hostpmem_as, pmr, p_name); ct3d->cxl_dstate.pmem_size = memory_region_size(pmr); - ct3d->cxl_dstate.mem_size += memory_region_size(pmr); + ct3d->cxl_dstate.static_mem_size += memory_region_size(pmr); g_free(p_name); } @@ -837,7 +837,7 @@ static int cxl_type3_hpa_to_as_and_dpa(CXLType3Dev *ct3d, return -EINVAL; } - if (*dpa_offset > ct3d->cxl_dstate.mem_size) { + if (*dpa_offset > ct3d->cxl_dstate.static_mem_size) { return -EINVAL; } @@ -1010,7 +1010,7 @@ static bool set_cacheline(CXLType3Dev *ct3d, uint64_t dpa_offset, uint8_t *data) return false; } - if (dpa_offset + CXL_CACHE_LINE_SIZE > ct3d->cxl_dstate.mem_size) { + if (dpa_offset + CXL_CACHE_LINE_SIZE > ct3d->cxl_dstate.static_mem_size) { return false; } From patchwork Tue Jul 2 14:08:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719711 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DECA5C30658 for ; Tue, 2 Jul 2024 14:08:54 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeBF-0002kb-FH; Tue, 02 Jul 2024 10:08: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 1sOeB0-0002aw-Ta for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08: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 1sOeAy-000849-RH for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929287; 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=1ElU1S3yGZ4jv6gdF/qOH23dlnO7FdnAYenskxuOvWI=; b=KQTf4rvAGcgolcDDwxByjYd9lyRxqdTcp5KTvQi10dGUQVzjmAZlFUILgEqCU8ZYMxHs2U gwdgylRmTt6gZ0XJMtBMdPhvGK+jSFUh1oyrfd5TNh1OUeiU04OQ5U+51vLtU/96SXZ2wn O92Ous5jFEfyFXo1f3TmSqt+hCHYz4w= 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-682-Y_Xn281lPvKVHjAhousRtQ-1; Tue, 02 Jul 2024 10:08:05 -0400 X-MC-Unique: Y_Xn281lPvKVHjAhousRtQ-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4256569a4faso27256655e9.1 for ; Tue, 02 Jul 2024 07:08:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929284; x=1720534084; 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=1ElU1S3yGZ4jv6gdF/qOH23dlnO7FdnAYenskxuOvWI=; b=QZNKkb3bMAxxt0umnrIFsp0XcQAgFCIlu3aLH9UmTnCXRXfxC130S4K554oSM8aA3l T+UEoba883EeGBVbZAxp/00Hp/DSvFLW+X3wsrO0B2MB7OAwOwOTQAzgN1CMg7jd+k5J IY1k35lQf9fXjFY276Cc1wQxCrsLXgi4PZm16hOWVhGmukPStI+2zi3etJOFXATLZCjU s/eg4WC+yFZC685+nJ7FTqgDLNhrDXIjj+hY/VTwJusFTvOcHrt9/DFio64R+lv96suw O4Kuf4oaQsplvauo9qLpkRnct/x7nUMDcR32AJGHycuPWnu4dhJ8fFhDkh4aTQwczMO4 FK9g== X-Gm-Message-State: AOJu0YyHaVNgtjc2e9297Yku0aUyjRKAJt7FonP1lTLjKKXMKWFXoYqP pHj60ViaWrVS6Mq7jZdfFIlRj1js8wC7fKTGiU58eRUiGcs3Qexq7qrgGXh5ZAxm5qqwqAMV3se OwQ6VxHeDnWzw6bRTM/+gAC7dQmnQTwT5wXt2XvbQrl1ETJx77hFcZE5PVv8vIWqLFca4f6KoYl HGfb2HEimhy/tf598ahpniQI76oud2fQ== X-Received: by 2002:adf:ecd0:0:b0:367:40eb:a3c3 with SMTP id ffacd0b85a97d-36774f935c8mr7382662f8f.34.1719929284356; Tue, 02 Jul 2024 07:08:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGryx5YNTA4PNwnB9WgSIWZKjOpCNFDltYwthIRikwa8nNEw4dcON/3zIfsenj59NizL85QPQ== X-Received: by 2002:adf:ecd0:0:b0:367:40eb:a3c3 with SMTP id ffacd0b85a97d-36774f935c8mr7382632f8f.34.1719929283742; Tue, 02 Jul 2024 07:08:03 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a103d00sm13371625f8f.99.2024.07.02.07.08.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:08:03 -0700 (PDT) Date: Tue, 2 Jul 2024 10:08:00 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Fan Ni , Gregory Price , Jonathan Cameron , Li Zhijian Subject: [PULL 21/91] hw/mem/cxl_type3: Add support to create DC regions to type3 memory devices 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Fan Ni With the change, when setting up memory for type3 memory device, we can create DC regions. A property 'num-dc-regions' is added to ct3_props to allow users to pass the number of DC regions to create. To make it easier, other region parameters like region base, length, and block size are hard coded. If needed, these parameters can be added easily. With the change, we can create DC regions with proper kernel side support like below: region=$(cat /sys/bus/cxl/devices/decoder0.0/create_dc_region) echo $region > /sys/bus/cxl/devices/decoder0.0/create_dc_region echo 256 > /sys/bus/cxl/devices/$region/interleave_granularity echo 1 > /sys/bus/cxl/devices/$region/interleave_ways echo "dc0" >/sys/bus/cxl/devices/decoder2.0/mode echo 0x40000000 >/sys/bus/cxl/devices/decoder2.0/dpa_size echo 0x40000000 > /sys/bus/cxl/devices/$region/size echo "decoder2.0" > /sys/bus/cxl/devices/$region/target0 echo 1 > /sys/bus/cxl/devices/$region/commit echo $region > /sys/bus/cxl/drivers/cxl_region/bind Reviewed-by: Gregory Price Reviewed-by: Jonathan Cameron Signed-off-by: Fan Ni Message-Id: <20240523174651.1089554-7-nifan.cxl@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Li Zhijian --- hw/mem/cxl_type3.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index 7194c8f902..06c6f9bb78 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -30,6 +30,7 @@ #include "hw/pci/msix.h" #define DWORD_BYTE 4 +#define CXL_CAPACITY_MULTIPLIER (256 * MiB) /* Default CDAT entries for a memory region */ enum { @@ -567,6 +568,50 @@ static void ct3d_reg_write(void *opaque, hwaddr offset, uint64_t value, } } +/* + * TODO: dc region configuration will be updated once host backend and address + * space support is added for DCD. + */ +static bool cxl_create_dc_regions(CXLType3Dev *ct3d, Error **errp) +{ + int i; + uint64_t region_base = 0; + uint64_t region_len = 2 * GiB; + uint64_t decode_len = 2 * GiB; + uint64_t blk_size = 2 * MiB; + CXLDCRegion *region; + MemoryRegion *mr; + + if (ct3d->hostvmem) { + mr = host_memory_backend_get_memory(ct3d->hostvmem); + region_base += memory_region_size(mr); + } + if (ct3d->hostpmem) { + mr = host_memory_backend_get_memory(ct3d->hostpmem); + region_base += memory_region_size(mr); + } + if (region_base % CXL_CAPACITY_MULTIPLIER != 0) { + error_setg(errp, "DC region base not aligned to 0x%lx", + CXL_CAPACITY_MULTIPLIER); + return false; + } + + for (i = 0, region = &ct3d->dc.regions[0]; + i < ct3d->dc.num_regions; + i++, region++, region_base += region_len) { + *region = (CXLDCRegion) { + .base = region_base, + .decode_len = decode_len, + .len = region_len, + .block_size = blk_size, + /* dsmad_handle set when creating CDAT table entries */ + .flags = 0, + }; + } + + return true; +} + static bool cxl_setup_memory(CXLType3Dev *ct3d, Error **errp) { DeviceState *ds = DEVICE(ct3d); @@ -635,6 +680,13 @@ static bool cxl_setup_memory(CXLType3Dev *ct3d, Error **errp) g_free(p_name); } + if (ct3d->dc.num_regions > 0) { + if (!cxl_create_dc_regions(ct3d, errp)) { + error_append_hint(errp, "setup DC regions failed"); + return false; + } + } + return true; } @@ -930,6 +982,7 @@ static Property ct3_props[] = { HostMemoryBackend *), DEFINE_PROP_UINT64("sn", CXLType3Dev, sn, UI64_NULL), DEFINE_PROP_STRING("cdat", CXLType3Dev, cxl_cstate.cdat.filename), + DEFINE_PROP_UINT8("num-dc-regions", CXLType3Dev, dc.num_regions, 0), DEFINE_PROP_END_OF_LIST(), }; From patchwork Tue Jul 2 14:08:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719752 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1A848C3064D for ; Tue, 2 Jul 2024 14:14:01 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeBH-0002qg-Bv; Tue, 02 Jul 2024 10:08: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 1sOeB5-0002dQ-0B for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08: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 1sOeB3-00085d-Az for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929292; 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=FMOgEcAe53x2nl/kUwLBbhwXiRFlv4+KNdbX+UZGPhI=; b=Rv+Yi4guUjGceMuBraNPFZxPW0xCKSrR1m9N5v7JH82p7Z5GBiXe5GiG02qndCPXB/qIns XhY7IgIWnbEA3XnabBHzIFyQYsGKLiXE4DPGhXHufzFk3CakJFhe307D49oK3i35DVX+ve kNearytWq9bGZE78k79Iur0nkBI0cAc= 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-96-ugcoxOOFPAijp1Q2hDod_A-1; Tue, 02 Jul 2024 10:08:09 -0400 X-MC-Unique: ugcoxOOFPAijp1Q2hDod_A-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-42566e8a9efso39079775e9.2 for ; Tue, 02 Jul 2024 07:08:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929287; x=1720534087; 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=FMOgEcAe53x2nl/kUwLBbhwXiRFlv4+KNdbX+UZGPhI=; b=v3LWgjGIagGhXXSi9zRzEjO4TVC8dDsgtKdwwOcHTHw6aTgXs2SBFIAALjCHSC1Vqe ouCwW5uYcQrdI7slzSNdH2qRV5z5286jkXQbY8lf6MCKmiuyk8nv8SoAEQZncAyQxLH5 +dPLPKhPzcI8cdJydccG4Nwl8CUpSnVjkWc3gPIdSCRKExSAFSzURRo0dsFQlUZVoU90 6Fax30qGAcBu4xaCffW3plfzkqDT4htgY9i0WiKJIZa2yyrfsIpiIU8bBAEwQzG5rdIX fR+w5VUIyGrHpGQuid2XHXwtuqMOzijDG7GWarpqxoyZjC0xAor4XetUWh9lIpUMh3KM 7HXw== X-Gm-Message-State: AOJu0YymsJ9RKWpdoumwBb68JAnlvmNyvi+ON0zeqkM6BLhaqrUKLKbF HcbEMDziBbKEyH2N54Zrgr1Lyn851zdIUAd+4x+Y2u5nAkyVbHaN+qD7vpV9HaSE63bUsfb5ue1 bFhoo8LTsUr0KPachXaEAlkdy3jzRHGyfzbvR3VUVfR1KTj2lskRrL/v2nr6aQaFCstzYsuh4DV 7QThVcHH7L7tpvoA/ymjE4ViuNflApng== X-Received: by 2002:a05:600c:47c7:b0:425:5f73:e2e1 with SMTP id 5b1f17b1804b1-4257a00c088mr75859975e9.22.1719929287443; Tue, 02 Jul 2024 07:08:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEpAqU6sWFMZZDpcaKWJOIOFQLed38qFVLFC0AWcnAIyzxV8Wppjj9zWHXMXjIzh0vSbcs0KA== X-Received: by 2002:a05:600c:47c7:b0:425:5f73:e2e1 with SMTP id 5b1f17b1804b1-4257a00c088mr75859635e9.22.1719929286729; Tue, 02 Jul 2024 07:08:06 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af55aeasm196745725e9.17.2024.07.02.07.08.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:08:06 -0700 (PDT) Date: Tue, 2 Jul 2024 10:08:04 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Fan Ni , Gregory Price , Jonathan Cameron Subject: [PULL 22/91] hw/mem/cxl-type3: Refactor ct3_build_cdat_entries_for_mr to take mr size instead of mr as argument Message-ID: <69e4fb569dc1602bfeef5b8c58de5f40cd5d756e.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Fan Ni The function ct3_build_cdat_entries_for_mr only uses size of the passed memory region argument, refactor the function definition to make the passed arguments more specific. Reviewed-by: Gregory Price Reviewed-by: Jonathan Cameron Signed-off-by: Fan Ni Message-Id: <20240523174651.1089554-8-nifan.cxl@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/mem/cxl_type3.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index 06c6f9bb78..51be50ce87 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -44,7 +44,7 @@ enum { }; static void ct3_build_cdat_entries_for_mr(CDATSubHeader **cdat_table, - int dsmad_handle, MemoryRegion *mr, + int dsmad_handle, uint64_t size, bool is_pmem, uint64_t dpa_base) { CDATDsmas *dsmas; @@ -63,7 +63,7 @@ static void ct3_build_cdat_entries_for_mr(CDATSubHeader **cdat_table, .DSMADhandle = dsmad_handle, .flags = is_pmem ? CDAT_DSMAS_FLAG_NV : 0, .DPA_base = dpa_base, - .DPA_length = memory_region_size(mr), + .DPA_length = size, }; /* For now, no memory side cache, plausiblish numbers */ @@ -132,7 +132,7 @@ static void ct3_build_cdat_entries_for_mr(CDATSubHeader **cdat_table, */ .EFI_memory_type_attr = is_pmem ? 2 : 1, .DPA_offset = 0, - .DPA_length = memory_region_size(mr), + .DPA_length = size, }; /* Header always at start of structure */ @@ -149,6 +149,7 @@ static int ct3_build_cdat_table(CDATSubHeader ***cdat_table, void *priv) g_autofree CDATSubHeader **table = NULL; CXLType3Dev *ct3d = priv; MemoryRegion *volatile_mr = NULL, *nonvolatile_mr = NULL; + uint64_t vmr_size = 0, pmr_size = 0; int dsmad_handle = 0; int cur_ent = 0; int len = 0; @@ -163,6 +164,7 @@ static int ct3_build_cdat_table(CDATSubHeader ***cdat_table, void *priv) return -EINVAL; } len += CT3_CDAT_NUM_ENTRIES; + vmr_size = memory_region_size(volatile_mr); } if (ct3d->hostpmem) { @@ -171,21 +173,22 @@ static int ct3_build_cdat_table(CDATSubHeader ***cdat_table, void *priv) return -EINVAL; } len += CT3_CDAT_NUM_ENTRIES; + pmr_size = memory_region_size(nonvolatile_mr); } table = g_malloc0(len * sizeof(*table)); /* Now fill them in */ if (volatile_mr) { - ct3_build_cdat_entries_for_mr(table, dsmad_handle++, volatile_mr, + ct3_build_cdat_entries_for_mr(table, dsmad_handle++, vmr_size, false, 0); cur_ent = CT3_CDAT_NUM_ENTRIES; } if (nonvolatile_mr) { - uint64_t base = volatile_mr ? memory_region_size(volatile_mr) : 0; + uint64_t base = vmr_size; ct3_build_cdat_entries_for_mr(&(table[cur_ent]), dsmad_handle++, - nonvolatile_mr, true, base); + pmr_size, true, base); cur_ent += CT3_CDAT_NUM_ENTRIES; } assert(len == cur_ent); From patchwork Tue Jul 2 14:08:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719737 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A4784C30658 for ; Tue, 2 Jul 2024 14:12:45 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeBL-00035B-AK; Tue, 02 Jul 2024 10:08:31 -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 1sOeBC-0002hW-Nt for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08: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 1sOeB9-00088d-SU for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929297; 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=eEQf5dMTcN0eNEr2HFQRzAcaAdzyZe0zdBh6kTUpqX4=; b=eY1nz9NbfOBqDGDkxja+MnK/V0A2Dz56v8qoZp06DzNpOym+0mPZUm9b+Q5K+33dSOfGEJ xcEGjkxwx8TNZ/WIjxKgcVNRKRRTQzBygI0leMmxbD/yhmT1FmxtnTKp+pSTDLw9fMosMY tMZgg/Em6/RadQl+HZ34W7LiPGxAmOw= 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-458-E27uhZtYMCqtol3M134v8w-1; Tue, 02 Jul 2024 10:08:13 -0400 X-MC-Unique: E27uhZtYMCqtol3M134v8w-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4248fa5daacso29553585e9.0 for ; Tue, 02 Jul 2024 07:08:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929292; x=1720534092; 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=eEQf5dMTcN0eNEr2HFQRzAcaAdzyZe0zdBh6kTUpqX4=; b=WmnBVcFljaTTJ1ZDMkW+YPyxhzAqcZrksA0dmC0f+E+tIvtfrqhiBJPjE9JWG8s/+l iU6jE189QGX56yUpRklbVNIv47r8/vMUjDyr+UlABA98OUl6JVFPesMtv0IKwlGrpgZ9 kgjpNZqRYsB+fBCDx7JsR0carw6qck0S7d+zuauTWDd52vlaIaPNMWpKHmcnQiaXYp9g jczLOQj0abjiyWHyNqDOP87FHYYsZfF6XXQjW1tdqDgekRJ3Cg85q3dbhItGW57l+iOh 4sP3GEyLIGuPf9ivsM1yjS2edktvpG6zt3AScI/7IrVOwtToWEupB85XLVjccDk9aCaw gttg== X-Gm-Message-State: AOJu0YxKStxthh0yMZKFkUQ+tT9KChurNnceg2top+hsLjhIk+yBPR8/ R0h4dfyOUWLeT3aL0b428cIzIKqCeu0x5IEwBZxj0z1MT9npR7fLOmsVctaiPrecrZs9vwsn1hU E0OEg/UfFuTnutvwx6E/M5f7bfffK8ZvKVyqvuMnClkleVgnBGEknw1knwaSUxCJq3Ns+XloEGk 3y5DP8/O8u000ntjQFwmIZqsA6r7k2YQ== X-Received: by 2002:a05:6000:18ac:b0:364:6c08:b9b2 with SMTP id ffacd0b85a97d-3677572159amr6305385f8f.45.1719929291775; Tue, 02 Jul 2024 07:08:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFugIvaEKS/cGHK0slP13Bi9WJXqSQmwE312dJz6vJpeVTrtJBEEPrLOsXSaIWBPRe4RFpPuw== X-Received: by 2002:a05:6000:18ac:b0:364:6c08:b9b2 with SMTP id ffacd0b85a97d-3677572159amr6305342f8f.45.1719929291132; Tue, 02 Jul 2024 07:08:11 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0e146bsm13295355f8f.57.2024.07.02.07.08.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:08:09 -0700 (PDT) Date: Tue, 2 Jul 2024 10:08:06 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Fan Ni , Gregory Price , Jonathan Cameron Subject: [PULL 23/91] hw/mem/cxl_type3: Add host backend and address space handling for DC regions Message-ID: <90de94612bb568117e038c6ce9edd35d17d239f9.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Fan Ni Add (file/memory backed) host backend for DCD. All the dynamic capacity regions will share a single, large enough host backend. Set up address space for DC regions to support read/write operations to dynamic capacity for DCD. With the change, the following support is added: 1. Add a new property to type3 device "volatile-dc-memdev" to point to host memory backend for dynamic capacity. Currently, all DC regions share one host backend; 2. Add namespace for dynamic capacity for read/write support; 3. Create cdat entries for each dynamic capacity region. Reviewed-by: Gregory Price Signed-off-by: Fan Ni Message-Id: <20240523174651.1089554-9-nifan.cxl@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/cxl/cxl_device.h | 8 ++ hw/cxl/cxl-mailbox-utils.c | 16 +++- hw/mem/cxl_type3.c | 177 +++++++++++++++++++++++++++++------- 3 files changed, 164 insertions(+), 37 deletions(-) diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h index f7f56b44e3..c2c3df0d2a 100644 --- a/include/hw/cxl/cxl_device.h +++ b/include/hw/cxl/cxl_device.h @@ -467,6 +467,14 @@ struct CXLType3Dev { uint64_t poison_list_overflow_ts; struct dynamic_capacity { + HostMemoryBackend *host_dc; + AddressSpace host_dc_as; + /* + * total_capacity is equivalent to the dynamic capability + * memory region size. + */ + uint64_t total_capacity; /* 256M aligned */ + uint8_t num_regions; /* 0-8 regions */ CXLDCRegion regions[DCD_MAX_NUM_REGION]; } dc; diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index b592473587..6ad227f112 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -622,7 +622,8 @@ static CXLRetCode cmd_firmware_update_get_info(const struct cxl_cmd *cmd, size_t *len_out, CXLCCI *cci) { - CXLDeviceState *cxl_dstate = &CXL_TYPE3(cci->d)->cxl_dstate; + CXLType3Dev *ct3d = CXL_TYPE3(cci->d); + CXLDeviceState *cxl_dstate = &ct3d->cxl_dstate; struct { uint8_t slots_supported; uint8_t slot_info; @@ -636,7 +637,8 @@ static CXLRetCode cmd_firmware_update_get_info(const struct cxl_cmd *cmd, QEMU_BUILD_BUG_ON(sizeof(*fw_info) != 0x50); if ((cxl_dstate->vmem_size < CXL_CAPACITY_MULTIPLIER) || - (cxl_dstate->pmem_size < CXL_CAPACITY_MULTIPLIER)) { + (cxl_dstate->pmem_size < CXL_CAPACITY_MULTIPLIER) || + (ct3d->dc.total_capacity < CXL_CAPACITY_MULTIPLIER)) { return CXL_MBOX_INTERNAL_ERROR; } @@ -793,7 +795,8 @@ static CXLRetCode cmd_identify_memory_device(const struct cxl_cmd *cmd, CXLDeviceState *cxl_dstate = &ct3d->cxl_dstate; if ((!QEMU_IS_ALIGNED(cxl_dstate->vmem_size, CXL_CAPACITY_MULTIPLIER)) || - (!QEMU_IS_ALIGNED(cxl_dstate->pmem_size, CXL_CAPACITY_MULTIPLIER))) { + (!QEMU_IS_ALIGNED(cxl_dstate->pmem_size, CXL_CAPACITY_MULTIPLIER)) || + (!QEMU_IS_ALIGNED(ct3d->dc.total_capacity, CXL_CAPACITY_MULTIPLIER))) { return CXL_MBOX_INTERNAL_ERROR; } @@ -835,9 +838,11 @@ static CXLRetCode cmd_ccls_get_partition_info(const struct cxl_cmd *cmd, uint64_t next_pmem; } QEMU_PACKED *part_info = (void *)payload_out; QEMU_BUILD_BUG_ON(sizeof(*part_info) != 0x20); + CXLType3Dev *ct3d = container_of(cxl_dstate, CXLType3Dev, cxl_dstate); if ((!QEMU_IS_ALIGNED(cxl_dstate->vmem_size, CXL_CAPACITY_MULTIPLIER)) || - (!QEMU_IS_ALIGNED(cxl_dstate->pmem_size, CXL_CAPACITY_MULTIPLIER))) { + (!QEMU_IS_ALIGNED(cxl_dstate->pmem_size, CXL_CAPACITY_MULTIPLIER)) || + (!QEMU_IS_ALIGNED(ct3d->dc.total_capacity, CXL_CAPACITY_MULTIPLIER))) { return CXL_MBOX_INTERNAL_ERROR; } @@ -1179,7 +1184,8 @@ static CXLRetCode cmd_media_clear_poison(const struct cxl_cmd *cmd, struct clear_poison_pl *in = (void *)payload_in; dpa = ldq_le_p(&in->dpa); - if (dpa + CXL_CACHE_LINE_SIZE > cxl_dstate->static_mem_size) { + if (dpa + CXL_CACHE_LINE_SIZE > cxl_dstate->static_mem_size + + ct3d->dc.total_capacity) { return CXL_MBOX_INVALID_PA; } diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index 51be50ce87..658570aa1a 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -45,7 +45,8 @@ enum { static void ct3_build_cdat_entries_for_mr(CDATSubHeader **cdat_table, int dsmad_handle, uint64_t size, - bool is_pmem, uint64_t dpa_base) + bool is_pmem, bool is_dynamic, + uint64_t dpa_base) { CDATDsmas *dsmas; CDATDslbis *dslbis0; @@ -61,7 +62,8 @@ static void ct3_build_cdat_entries_for_mr(CDATSubHeader **cdat_table, .length = sizeof(*dsmas), }, .DSMADhandle = dsmad_handle, - .flags = is_pmem ? CDAT_DSMAS_FLAG_NV : 0, + .flags = (is_pmem ? CDAT_DSMAS_FLAG_NV : 0) | + (is_dynamic ? CDAT_DSMAS_FLAG_DYNAMIC_CAP : 0), .DPA_base = dpa_base, .DPA_length = size, }; @@ -149,12 +151,13 @@ static int ct3_build_cdat_table(CDATSubHeader ***cdat_table, void *priv) g_autofree CDATSubHeader **table = NULL; CXLType3Dev *ct3d = priv; MemoryRegion *volatile_mr = NULL, *nonvolatile_mr = NULL; + MemoryRegion *dc_mr = NULL; uint64_t vmr_size = 0, pmr_size = 0; int dsmad_handle = 0; int cur_ent = 0; int len = 0; - if (!ct3d->hostpmem && !ct3d->hostvmem) { + if (!ct3d->hostpmem && !ct3d->hostvmem && !ct3d->dc.num_regions) { return 0; } @@ -176,21 +179,54 @@ static int ct3_build_cdat_table(CDATSubHeader ***cdat_table, void *priv) pmr_size = memory_region_size(nonvolatile_mr); } + if (ct3d->dc.num_regions) { + if (!ct3d->dc.host_dc) { + return -EINVAL; + } + dc_mr = host_memory_backend_get_memory(ct3d->dc.host_dc); + if (!dc_mr) { + return -EINVAL; + } + len += CT3_CDAT_NUM_ENTRIES * ct3d->dc.num_regions; + } + table = g_malloc0(len * sizeof(*table)); /* Now fill them in */ if (volatile_mr) { ct3_build_cdat_entries_for_mr(table, dsmad_handle++, vmr_size, - false, 0); + false, false, 0); cur_ent = CT3_CDAT_NUM_ENTRIES; } if (nonvolatile_mr) { uint64_t base = vmr_size; ct3_build_cdat_entries_for_mr(&(table[cur_ent]), dsmad_handle++, - pmr_size, true, base); + pmr_size, true, false, base); cur_ent += CT3_CDAT_NUM_ENTRIES; } + + if (dc_mr) { + int i; + uint64_t region_base = vmr_size + pmr_size; + + /* + * We assume the dynamic capacity to be volatile for now. + * Non-volatile dynamic capacity will be added if needed in the + * future. + */ + for (i = 0; i < ct3d->dc.num_regions; i++) { + ct3_build_cdat_entries_for_mr(&(table[cur_ent]), + dsmad_handle++, + ct3d->dc.regions[i].len, + false, true, region_base); + ct3d->dc.regions[i].dsmadhandle = dsmad_handle - 1; + + cur_ent += CT3_CDAT_NUM_ENTRIES; + region_base += ct3d->dc.regions[i].len; + } + } + assert(len == cur_ent); *cdat_table = g_steal_pointer(&table); @@ -301,10 +337,17 @@ static void build_dvsecs(CXLType3Dev *ct3d) range2_size_lo = (2 << 5) | (2 << 2) | 0x3 | (ct3d->hostpmem->size & 0xF0000000); } - } else { + } else if (ct3d->hostpmem) { range1_size_hi = ct3d->hostpmem->size >> 32; range1_size_lo = (2 << 5) | (2 << 2) | 0x3 | (ct3d->hostpmem->size & 0xF0000000); + } else { + /* + * For DCD with no static memory, set memory active, memory class bits. + * No range is set. + */ + range1_size_hi = 0; + range1_size_lo = (2 << 5) | (2 << 2) | 0x3; } dvsec = (uint8_t *)&(CXLDVSECDevice){ @@ -579,11 +622,29 @@ static bool cxl_create_dc_regions(CXLType3Dev *ct3d, Error **errp) { int i; uint64_t region_base = 0; - uint64_t region_len = 2 * GiB; - uint64_t decode_len = 2 * GiB; + uint64_t region_len; + uint64_t decode_len; uint64_t blk_size = 2 * MiB; CXLDCRegion *region; MemoryRegion *mr; + uint64_t dc_size; + + mr = host_memory_backend_get_memory(ct3d->dc.host_dc); + dc_size = memory_region_size(mr); + region_len = DIV_ROUND_UP(dc_size, ct3d->dc.num_regions); + + if (dc_size % (ct3d->dc.num_regions * CXL_CAPACITY_MULTIPLIER) != 0) { + error_setg(errp, + "backend size is not multiple of region len: 0x%" PRIx64, + region_len); + return false; + } + if (region_len % CXL_CAPACITY_MULTIPLIER != 0) { + error_setg(errp, "DC region size is unaligned to 0x%" PRIx64, + CXL_CAPACITY_MULTIPLIER); + return false; + } + decode_len = region_len; if (ct3d->hostvmem) { mr = host_memory_backend_get_memory(ct3d->hostvmem); @@ -594,7 +655,7 @@ static bool cxl_create_dc_regions(CXLType3Dev *ct3d, Error **errp) region_base += memory_region_size(mr); } if (region_base % CXL_CAPACITY_MULTIPLIER != 0) { - error_setg(errp, "DC region base not aligned to 0x%lx", + error_setg(errp, "DC region base not aligned to 0x%" PRIx64, CXL_CAPACITY_MULTIPLIER); return false; } @@ -610,6 +671,7 @@ static bool cxl_create_dc_regions(CXLType3Dev *ct3d, Error **errp) /* dsmad_handle set when creating CDAT table entries */ .flags = 0, }; + ct3d->dc.total_capacity += region->len; } return true; @@ -619,7 +681,8 @@ static bool cxl_setup_memory(CXLType3Dev *ct3d, Error **errp) { DeviceState *ds = DEVICE(ct3d); - if (!ct3d->hostmem && !ct3d->hostvmem && !ct3d->hostpmem) { + if (!ct3d->hostmem && !ct3d->hostvmem && !ct3d->hostpmem + && !ct3d->dc.num_regions) { error_setg(errp, "at least one memdev property must be set"); return false; } else if (ct3d->hostmem && ct3d->hostpmem) { @@ -683,7 +746,37 @@ static bool cxl_setup_memory(CXLType3Dev *ct3d, Error **errp) g_free(p_name); } + ct3d->dc.total_capacity = 0; if (ct3d->dc.num_regions > 0) { + MemoryRegion *dc_mr; + char *dc_name; + + if (!ct3d->dc.host_dc) { + error_setg(errp, "dynamic capacity must have a backing device"); + return false; + } + + dc_mr = host_memory_backend_get_memory(ct3d->dc.host_dc); + if (!dc_mr) { + error_setg(errp, "dynamic capacity must have a backing device"); + return false; + } + + /* + * Set DC regions as volatile for now, non-volatile support can + * be added in the future if needed. + */ + memory_region_set_nonvolatile(dc_mr, false); + memory_region_set_enabled(dc_mr, true); + host_memory_backend_set_mapped(ct3d->dc.host_dc, true); + if (ds->id) { + dc_name = g_strdup_printf("cxl-dcd-dpa-dc-space:%s", ds->id); + } else { + dc_name = g_strdup("cxl-dcd-dpa-dc-space"); + } + address_space_init(&ct3d->dc.host_dc_as, dc_mr, dc_name); + g_free(dc_name); + if (!cxl_create_dc_regions(ct3d, errp)) { error_append_hint(errp, "setup DC regions failed"); return false; @@ -779,6 +872,9 @@ err_release_cdat: err_free_special_ops: g_free(regs->special_ops); err_address_space_free: + if (ct3d->dc.host_dc) { + address_space_destroy(&ct3d->dc.host_dc_as); + } if (ct3d->hostpmem) { address_space_destroy(&ct3d->hostpmem_as); } @@ -797,6 +893,9 @@ static void ct3_exit(PCIDevice *pci_dev) pcie_aer_exit(pci_dev); cxl_doe_cdat_release(cxl_cstate); g_free(regs->special_ops); + if (ct3d->dc.host_dc) { + address_space_destroy(&ct3d->dc.host_dc_as); + } if (ct3d->hostpmem) { address_space_destroy(&ct3d->hostpmem_as); } @@ -875,16 +974,23 @@ static int cxl_type3_hpa_to_as_and_dpa(CXLType3Dev *ct3d, AddressSpace **as, uint64_t *dpa_offset) { - MemoryRegion *vmr = NULL, *pmr = NULL; + MemoryRegion *vmr = NULL, *pmr = NULL, *dc_mr = NULL; + uint64_t vmr_size = 0, pmr_size = 0, dc_size = 0; if (ct3d->hostvmem) { vmr = host_memory_backend_get_memory(ct3d->hostvmem); + vmr_size = memory_region_size(vmr); } if (ct3d->hostpmem) { pmr = host_memory_backend_get_memory(ct3d->hostpmem); + pmr_size = memory_region_size(pmr); + } + if (ct3d->dc.host_dc) { + dc_mr = host_memory_backend_get_memory(ct3d->dc.host_dc); + dc_size = memory_region_size(dc_mr); } - if (!vmr && !pmr) { + if (!vmr && !pmr && !dc_mr) { return -ENODEV; } @@ -892,19 +998,18 @@ static int cxl_type3_hpa_to_as_and_dpa(CXLType3Dev *ct3d, return -EINVAL; } - if (*dpa_offset > ct3d->cxl_dstate.static_mem_size) { + if (*dpa_offset >= vmr_size + pmr_size + dc_size) { return -EINVAL; } - if (vmr) { - if (*dpa_offset < memory_region_size(vmr)) { - *as = &ct3d->hostvmem_as; - } else { - *as = &ct3d->hostpmem_as; - *dpa_offset -= memory_region_size(vmr); - } - } else { + if (*dpa_offset < vmr_size) { + *as = &ct3d->hostvmem_as; + } else if (*dpa_offset < vmr_size + pmr_size) { *as = &ct3d->hostpmem_as; + *dpa_offset -= vmr_size; + } else { + *as = &ct3d->dc.host_dc_as; + *dpa_offset -= (vmr_size + pmr_size); } return 0; @@ -986,6 +1091,8 @@ static Property ct3_props[] = { DEFINE_PROP_UINT64("sn", CXLType3Dev, sn, UI64_NULL), DEFINE_PROP_STRING("cdat", CXLType3Dev, cxl_cstate.cdat.filename), DEFINE_PROP_UINT8("num-dc-regions", CXLType3Dev, dc.num_regions, 0), + DEFINE_PROP_LINK("volatile-dc-memdev", CXLType3Dev, dc.host_dc, + TYPE_MEMORY_BACKEND, HostMemoryBackend *), DEFINE_PROP_END_OF_LIST(), }; @@ -1052,33 +1159,39 @@ static void set_lsa(CXLType3Dev *ct3d, const void *buf, uint64_t size, static bool set_cacheline(CXLType3Dev *ct3d, uint64_t dpa_offset, uint8_t *data) { - MemoryRegion *vmr = NULL, *pmr = NULL; + MemoryRegion *vmr = NULL, *pmr = NULL, *dc_mr = NULL; AddressSpace *as; + uint64_t vmr_size = 0, pmr_size = 0, dc_size = 0; if (ct3d->hostvmem) { vmr = host_memory_backend_get_memory(ct3d->hostvmem); + vmr_size = memory_region_size(vmr); } if (ct3d->hostpmem) { pmr = host_memory_backend_get_memory(ct3d->hostpmem); + pmr_size = memory_region_size(pmr); } + if (ct3d->dc.host_dc) { + dc_mr = host_memory_backend_get_memory(ct3d->dc.host_dc); + dc_size = memory_region_size(dc_mr); + } - if (!vmr && !pmr) { + if (!vmr && !pmr && !dc_mr) { return false; } - if (dpa_offset + CXL_CACHE_LINE_SIZE > ct3d->cxl_dstate.static_mem_size) { + if (dpa_offset + CXL_CACHE_LINE_SIZE > vmr_size + pmr_size + dc_size) { return false; } - if (vmr) { - if (dpa_offset < memory_region_size(vmr)) { - as = &ct3d->hostvmem_as; - } else { - as = &ct3d->hostpmem_as; - dpa_offset -= memory_region_size(vmr); - } - } else { + if (dpa_offset < vmr_size) { + as = &ct3d->hostvmem_as; + } else if (dpa_offset < vmr_size + pmr_size) { as = &ct3d->hostpmem_as; + dpa_offset -= vmr_size; + } else { + as = &ct3d->dc.host_dc_as; + dpa_offset -= (vmr_size + pmr_size); } address_space_write(as, dpa_offset, MEMTXATTRS_UNSPECIFIED, &data, From patchwork Tue Jul 2 14:08:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719714 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 800A3C30658 for ; Tue, 2 Jul 2024 14:09:33 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeBT-00046A-UK; Tue, 02 Jul 2024 10:08: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 1sOeBP-0003Tu-5O for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08: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 1sOeBC-000891-GC for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929301; 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=Y6BvONQ3xHQ5Uc0x7v2hZbGWG9V5fJeg5muDy0KhuLY=; b=F/uQET7Qca53qo43mWNvMtnxyjjf7G2mvSuU3Z6QuShEnUmNb2Hm3ZhBKQ2qg+mYDWjEoE Dvt55Lqy9/ytsMNi32fQbIrY8D5AJzUjoul7Ly88MlEJk9ujDxPSv84gVubtI7kx2thUwD PJ80v9vsDICY8uB7X1Y8YloRVd3z5vA= 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-416-kiiw9xz8PR2wCT4ls7Fc8g-1; Tue, 02 Jul 2024 10:08:17 -0400 X-MC-Unique: kiiw9xz8PR2wCT4ls7Fc8g-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4256569a4faso27257915e9.1 for ; Tue, 02 Jul 2024 07:08:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929294; x=1720534094; 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=Y6BvONQ3xHQ5Uc0x7v2hZbGWG9V5fJeg5muDy0KhuLY=; b=Di3jkhYcY7s0dW2CZO8c3Sw9NVqmrH+YT802/Wyg0wNYZP22bmHC4nfpnPDlykR3pp +DdjZT9fzyqUeSEBdwMV1Pclty9b4lL0P+5pkXowZB8qJKsraNDzHIuFNrXjmMiBvPVP 5g1Bp2bxm/5ZiTFvhsEWZh+d+JYo1L8i6/q5VLx6GaGe5qSvQsIHcG8b1zfOW8T+IR5p SRurZ2zKEFUcB40LU8oE2ICfac55qD048WercQAivnWhQRUSX1hYFnRbexDNomLliIHv vyo9REh0MwWCS5Zw4EME8WaWMYG6Orja+uZMW52f0k/0EKZG+ezzeb0H9WAmnYCO/3RD ncCQ== X-Gm-Message-State: AOJu0YxvEetJJpa0r8bdlliYzlzlOHbFmFBEjAZorOHtQqCSA9mOYRql TZZAeDTEP9Q1MWRH5/vP2EXaoWSCJrwtknc7m5WVFFqSuvPhqcOsP1jqvL/toDMrUzsF0hHPh1q kw6tiF1ID9WWJwbdP7+J/MTN0BajFX/zZ5uA8Z2PYhjAxoDZ9IizVjK9K+MoFPKwO8zfRNe32+t CNU0uBJWrDupCAPDfPtp/5aczmUT9OrA== X-Received: by 2002:a05:6000:1882:b0:366:f455:e7c1 with SMTP id ffacd0b85a97d-36774f89a12mr9119119f8f.27.1719929294409; Tue, 02 Jul 2024 07:08:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEF2LbjU/R8DzLzAW6etD11DlzChD+6rZqhkBgca0xk0uNhEhf1WYK665xoJOLDYXnTD+rB5A== X-Received: by 2002:a05:6000:1882:b0:366:f455:e7c1 with SMTP id ffacd0b85a97d-36774f89a12mr9119080f8f.27.1719929293828; Tue, 02 Jul 2024 07:08:13 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0e143csm13295057f8f.59.2024.07.02.07.08.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:08:13 -0700 (PDT) Date: Tue, 2 Jul 2024 10:08:11 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Fan Ni , Svetly Todorov , Jonathan Cameron Subject: [PULL 24/91] hw/mem/cxl_type3: Add DC extent list representative and get DC extent list mailbox support Message-ID: <1c9221f19e62e448a9ca71a2d5c8a369102a0c38.1719929191.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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, T_SPF_HELO_TEMPERROR=0.01, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Fan Ni Add dynamic capacity extent list representative to the definition of CXLType3Dev and implement get DC extent list mailbox command per CXL.spec.3.1:.8.2.9.9.9.2. Tested-by: Svetly Todorov Reviewed-by: Jonathan Cameron Signed-off-by: Fan Ni Message-Id: <20240523174651.1089554-10-nifan.cxl@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/cxl/cxl_device.h | 22 +++++++++++ hw/cxl/cxl-mailbox-utils.c | 73 ++++++++++++++++++++++++++++++++++++- hw/mem/cxl_type3.c | 1 + 3 files changed, 95 insertions(+), 1 deletion(-) diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h index c2c3df0d2a..6aec6ac983 100644 --- a/include/hw/cxl/cxl_device.h +++ b/include/hw/cxl/cxl_device.h @@ -424,6 +424,25 @@ typedef QLIST_HEAD(, CXLPoison) CXLPoisonList; #define DCD_MAX_NUM_REGION 8 +typedef struct CXLDCExtentRaw { + uint64_t start_dpa; + uint64_t len; + uint8_t tag[0x10]; + uint16_t shared_seq; + uint8_t rsvd[0x6]; +} QEMU_PACKED CXLDCExtentRaw; + +typedef struct CXLDCExtent { + uint64_t start_dpa; + uint64_t len; + uint8_t tag[0x10]; + uint16_t shared_seq; + uint8_t rsvd[0x6]; + + QTAILQ_ENTRY(CXLDCExtent) node; +} CXLDCExtent; +typedef QTAILQ_HEAD(, CXLDCExtent) CXLDCExtentList; + typedef struct CXLDCRegion { uint64_t base; /* aligned to 256*MiB */ uint64_t decode_len; /* aligned to 256*MiB */ @@ -474,6 +493,9 @@ struct CXLType3Dev { * memory region size. */ uint64_t total_capacity; /* 256M aligned */ + CXLDCExtentList extents; + uint32_t total_extent_count; + uint32_t ext_list_gen_seq; uint8_t num_regions; /* 0-8 regions */ CXLDCRegion regions[DCD_MAX_NUM_REGION]; diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index 6ad227f112..7872d2f3e6 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -84,6 +84,7 @@ enum { #define CLEAR_POISON 0x2 DCD_CONFIG = 0x48, #define GET_DC_CONFIG 0x0 + #define GET_DYN_CAP_EXT_LIST 0x1 PHYSICAL_SWITCH = 0x51, #define IDENTIFY_SWITCH_DEVICE 0x0 #define GET_PHYSICAL_PORT_STATE 0x1 @@ -1322,7 +1323,8 @@ static CXLRetCode cmd_dcd_get_dyn_cap_config(const struct cxl_cmd *cmd, * to use. */ stl_le_p(&extra_out->num_extents_supported, CXL_NUM_EXTENTS_SUPPORTED); - stl_le_p(&extra_out->num_extents_available, CXL_NUM_EXTENTS_SUPPORTED); + stl_le_p(&extra_out->num_extents_available, CXL_NUM_EXTENTS_SUPPORTED - + ct3d->dc.total_extent_count); stl_le_p(&extra_out->num_tags_supported, CXL_NUM_TAGS_SUPPORTED); stl_le_p(&extra_out->num_tags_available, CXL_NUM_TAGS_SUPPORTED); @@ -1330,6 +1332,72 @@ static CXLRetCode cmd_dcd_get_dyn_cap_config(const struct cxl_cmd *cmd, return CXL_MBOX_SUCCESS; } +/* + * CXL r3.1 section 8.2.9.9.9.2: + * Get Dynamic Capacity Extent List (Opcode 4801h) + */ +static CXLRetCode cmd_dcd_get_dyn_cap_ext_list(const struct cxl_cmd *cmd, + uint8_t *payload_in, + size_t len_in, + uint8_t *payload_out, + size_t *len_out, + CXLCCI *cci) +{ + CXLType3Dev *ct3d = CXL_TYPE3(cci->d); + struct { + uint32_t extent_cnt; + uint32_t start_extent_id; + } QEMU_PACKED *in = (void *)payload_in; + struct { + uint32_t count; + uint32_t total_extents; + uint32_t generation_num; + uint8_t rsvd[4]; + CXLDCExtentRaw records[]; + } QEMU_PACKED *out = (void *)payload_out; + uint32_t start_extent_id = in->start_extent_id; + CXLDCExtentList *extent_list = &ct3d->dc.extents; + uint16_t record_count = 0, i = 0, record_done = 0; + uint16_t out_pl_len, size; + CXLDCExtent *ent; + + if (start_extent_id > ct3d->dc.total_extent_count) { + return CXL_MBOX_INVALID_INPUT; + } + + record_count = MIN(in->extent_cnt, + ct3d->dc.total_extent_count - start_extent_id); + size = CXL_MAILBOX_MAX_PAYLOAD_SIZE - sizeof(*out); + record_count = MIN(record_count, size / sizeof(out->records[0])); + out_pl_len = sizeof(*out) + record_count * sizeof(out->records[0]); + + stl_le_p(&out->count, record_count); + stl_le_p(&out->total_extents, ct3d->dc.total_extent_count); + stl_le_p(&out->generation_num, ct3d->dc.ext_list_gen_seq); + + if (record_count > 0) { + CXLDCExtentRaw *out_rec = &out->records[record_done]; + + QTAILQ_FOREACH(ent, extent_list, node) { + if (i++ < start_extent_id) { + continue; + } + stq_le_p(&out_rec->start_dpa, ent->start_dpa); + stq_le_p(&out_rec->len, ent->len); + memcpy(&out_rec->tag, ent->tag, 0x10); + stw_le_p(&out_rec->shared_seq, ent->shared_seq); + + record_done++; + if (record_done == record_count) { + break; + } + } + } + + *len_out = out_pl_len; + return CXL_MBOX_SUCCESS; +} + #define IMMEDIATE_CONFIG_CHANGE (1 << 1) #define IMMEDIATE_DATA_CHANGE (1 << 2) #define IMMEDIATE_POLICY_CHANGE (1 << 3) @@ -1377,6 +1445,9 @@ static const struct cxl_cmd cxl_cmd_set[256][256] = { static const struct cxl_cmd cxl_cmd_set_dcd[256][256] = { [DCD_CONFIG][GET_DC_CONFIG] = { "DCD_GET_DC_CONFIG", cmd_dcd_get_dyn_cap_config, 2, 0 }, + [DCD_CONFIG][GET_DYN_CAP_EXT_LIST] = { + "DCD_GET_DYNAMIC_CAPACITY_EXTENT_LIST", cmd_dcd_get_dyn_cap_ext_list, + 8, 0 }, }; static const struct cxl_cmd cxl_cmd_set_sw[256][256] = { diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index 658570aa1a..2075846b1b 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -673,6 +673,7 @@ static bool cxl_create_dc_regions(CXLType3Dev *ct3d, Error **errp) }; ct3d->dc.total_capacity += region->len; } + QTAILQ_INIT(&ct3d->dc.extents); return true; } From patchwork Tue Jul 2 14:08:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719734 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 04ABCC3064D for ; Tue, 2 Jul 2024 14:12:02 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeBL-00038B-Vs; Tue, 02 Jul 2024 10:08: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 1sOeBH-0002sA-OF for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:29 -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 1sOeBB-00088t-AY for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929300; 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=OLpu8QtF+gouN+ualw24jfsLt/1sw7VC0fnWp2szNZc=; b=TLO5NU6iau+MiewtP8swOisNUVrZIXlWCBQtM8FF8huErn7Rf/aFc7QjTF7qY2PAIBhRdL tWdL53teixGjuObeiSinr02LOzTcHmYxyR8wu+fY+1zJ6V2rlCSuC43kp/lAYR/cbeyyFx dMphFv1XM4O+oWiPd6fBS6KWdim3b3U= 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-537-OVc6LEXjMHyhIIxSR0T8Ig-1; Tue, 02 Jul 2024 10:08:19 -0400 X-MC-Unique: OVc6LEXjMHyhIIxSR0T8Ig-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-3653f54d94eso2753491f8f.2 for ; Tue, 02 Jul 2024 07:08:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929297; x=1720534097; 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=OLpu8QtF+gouN+ualw24jfsLt/1sw7VC0fnWp2szNZc=; b=LHSPwUeh8TKSqw9cHGtCW7v2BxtbF6TXQJa+wFKgjcLO9hFTNys3ZxNjvg9b3agEPl wXvVuqwfd+l/9rBIu0jdcevyflvicuLScbpS6ZyE6mssUfhtg6MuLp/MBYrFe7MkQg3m v4QCbLmTUKPeVSXkQZFJ6SUfOQUEPKD1cTLM62Wbf9HSXejyI8Kwx4TPtByExdWkTtPr MLXatvT4OnrF0/mscn8cyoFlqw5yCj/P6V1vfCbluJ2h08R8tQZ5uYn9zQS65Z5dx/eO i1IwRC19/6nrtR+yOww2bwCKWA8K41LT2zXYp3cdO3ZX5iyROFKjRaHEBG21M1+S108f MMEg== X-Gm-Message-State: AOJu0YxbLyrlXd/P7/jYYPdzTdUiX8lOvesTXlH+60M2MCcYwoO+fNyn e1FDgcdd+FEyQ4/lIHp82MWJfeeLSkm6+OwCmrRgT9XDqP9AVmGM4/aHtaz/yoNHLFCiMxuzf5K ikIoWvHq6imiy6xPOkvO6cVR7L7WeUgaSyuQzRo1Wziu+1moUHqXx2xWTbNedfnbHSPAW9uXJKM lmVd8d68QP6CeFjYZcstqJuPmW4EJ8fA== X-Received: by 2002:a5d:4e45:0:b0:35f:22df:8d9a with SMTP id ffacd0b85a97d-36775728c76mr7089132f8f.69.1719929297535; Tue, 02 Jul 2024 07:08:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGAeKVFdfSaw+Ai17QvmnqAzagvomT89dRJNyWKqBwxFGO8h40LVG+Uus60YF8mILTCxuFZyw== X-Received: by 2002:a5d:4e45:0:b0:35f:22df:8d9a with SMTP id ffacd0b85a97d-36775728c76mr7089093f8f.69.1719929296919; Tue, 02 Jul 2024 07:08:16 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0e1481sm13324565f8f.55.2024.07.02.07.08.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:08:16 -0700 (PDT) Date: Tue, 2 Jul 2024 10:08:14 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Fan Ni , Svetly Todorov , Gregory Price , Jonathan Cameron Subject: [PULL 25/91] hw/cxl/cxl-mailbox-utils: Add mailbox commands to support add/release dynamic capacity response Message-ID: <16fd1b1216a2895a7995345ad6630151954c43a3.1719929191.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, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Fan Ni Per CXL spec 3.1, two mailbox commands are implemented: Add Dynamic Capacity Response (Opcode 4802h) 8.2.9.9.9.3, and Release Dynamic Capacity (Opcode 4803h) 8.2.9.9.9.4. For the process of the above two commands, we use two-pass approach. Pass 1: Check whether the input payload is valid or not; if not, skip Pass 2 and return mailbox process error. Pass 2: Do the real work--add or release extents, respectively. Tested-by: Svetly Todorov Reviewed-by: Gregory Price Signed-off-by: Fan Ni Message-Id: <20240523174651.1089554-11-nifan.cxl@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/cxl/cxl_device.h | 4 + hw/cxl/cxl-mailbox-utils.c | 394 ++++++++++++++++++++++++++++++++++++ hw/mem/cxl_type3.c | 11 + 3 files changed, 409 insertions(+) diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h index 6aec6ac983..df3511e91b 100644 --- a/include/hw/cxl/cxl_device.h +++ b/include/hw/cxl/cxl_device.h @@ -551,4 +551,8 @@ void cxl_event_irq_assert(CXLType3Dev *ct3d); void cxl_set_poison_list_overflowed(CXLType3Dev *ct3d); +CXLDCRegion *cxl_find_dc_region(CXLType3Dev *ct3d, uint64_t dpa, uint64_t len); + +void cxl_remove_extent_from_extent_list(CXLDCExtentList *list, + CXLDCExtent *extent); #endif diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index 7872d2f3e6..e322407fb3 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -19,6 +19,7 @@ #include "qemu/units.h" #include "qemu/uuid.h" #include "sysemu/hostmem.h" +#include "qemu/range.h" #define CXL_CAPACITY_MULTIPLIER (256 * MiB) #define CXL_DC_EVENT_LOG_SIZE 8 @@ -85,6 +86,8 @@ enum { DCD_CONFIG = 0x48, #define GET_DC_CONFIG 0x0 #define GET_DYN_CAP_EXT_LIST 0x1 + #define ADD_DYN_CAP_RSP 0x2 + #define RELEASE_DYN_CAP 0x3 PHYSICAL_SWITCH = 0x51, #define IDENTIFY_SWITCH_DEVICE 0x0 #define GET_PHYSICAL_PORT_STATE 0x1 @@ -1398,6 +1401,391 @@ static CXLRetCode cmd_dcd_get_dyn_cap_ext_list(const struct cxl_cmd *cmd, return CXL_MBOX_SUCCESS; } +/* + * Check whether any bit between addr[nr, nr+size) is set, + * return true if any bit is set, otherwise return false + */ +static bool test_any_bits_set(const unsigned long *addr, unsigned long nr, + unsigned long size) +{ + unsigned long res = find_next_bit(addr, size + nr, nr); + + return res < nr + size; +} + +CXLDCRegion *cxl_find_dc_region(CXLType3Dev *ct3d, uint64_t dpa, uint64_t len) +{ + int i; + CXLDCRegion *region = &ct3d->dc.regions[0]; + + if (dpa < region->base || + dpa >= region->base + ct3d->dc.total_capacity) { + return NULL; + } + + /* + * CXL r3.1 section 9.13.3: Dynamic Capacity Device (DCD) + * + * Regions are used in increasing-DPA order, with Region 0 being used for + * the lowest DPA of Dynamic Capacity and Region 7 for the highest DPA. + * So check from the last region to find where the dpa belongs. Extents that + * cross multiple regions are not allowed. + */ + for (i = ct3d->dc.num_regions - 1; i >= 0; i--) { + region = &ct3d->dc.regions[i]; + if (dpa >= region->base) { + if (dpa + len > region->base + region->len) { + return NULL; + } + return region; + } + } + + return NULL; +} + +static void cxl_insert_extent_to_extent_list(CXLDCExtentList *list, + uint64_t dpa, + uint64_t len, + uint8_t *tag, + uint16_t shared_seq) +{ + CXLDCExtent *extent; + + extent = g_new0(CXLDCExtent, 1); + extent->start_dpa = dpa; + extent->len = len; + if (tag) { + memcpy(extent->tag, tag, 0x10); + } + extent->shared_seq = shared_seq; + + QTAILQ_INSERT_TAIL(list, extent, node); +} + +void cxl_remove_extent_from_extent_list(CXLDCExtentList *list, + CXLDCExtent *extent) +{ + QTAILQ_REMOVE(list, extent, node); + g_free(extent); +} + +/* + * CXL r3.1 Table 8-168: Add Dynamic Capacity Response Input Payload + * CXL r3.1 Table 8-170: Release Dynamic Capacity Input Payload + */ +typedef struct CXLUpdateDCExtentListInPl { + uint32_t num_entries_updated; + uint8_t flags; + uint8_t rsvd[3]; + /* CXL r3.1 Table 8-169: Updated Extent */ + struct { + uint64_t start_dpa; + uint64_t len; + uint8_t rsvd[8]; + } QEMU_PACKED updated_entries[]; +} QEMU_PACKED CXLUpdateDCExtentListInPl; + +/* + * For the extents in the extent list to operate, check whether they are valid + * 1. The extent should be in the range of a valid DC region; + * 2. The extent should not cross multiple regions; + * 3. The start DPA and the length of the extent should align with the block + * size of the region; + * 4. The address range of multiple extents in the list should not overlap. + */ +static CXLRetCode cxl_detect_malformed_extent_list(CXLType3Dev *ct3d, + const CXLUpdateDCExtentListInPl *in) +{ + uint64_t min_block_size = UINT64_MAX; + CXLDCRegion *region; + CXLDCRegion *lastregion = &ct3d->dc.regions[ct3d->dc.num_regions - 1]; + g_autofree unsigned long *blk_bitmap = NULL; + uint64_t dpa, len; + uint32_t i; + + for (i = 0; i < ct3d->dc.num_regions; i++) { + region = &ct3d->dc.regions[i]; + min_block_size = MIN(min_block_size, region->block_size); + } + + blk_bitmap = bitmap_new((lastregion->base + lastregion->len - + ct3d->dc.regions[0].base) / min_block_size); + + for (i = 0; i < in->num_entries_updated; i++) { + dpa = in->updated_entries[i].start_dpa; + len = in->updated_entries[i].len; + + region = cxl_find_dc_region(ct3d, dpa, len); + if (!region) { + return CXL_MBOX_INVALID_PA; + } + + dpa -= ct3d->dc.regions[0].base; + if (dpa % region->block_size || len % region->block_size) { + return CXL_MBOX_INVALID_EXTENT_LIST; + } + /* the dpa range already covered by some other extents in the list */ + if (test_any_bits_set(blk_bitmap, dpa / min_block_size, + len / min_block_size)) { + return CXL_MBOX_INVALID_EXTENT_LIST; + } + bitmap_set(blk_bitmap, dpa / min_block_size, len / min_block_size); + } + + return CXL_MBOX_SUCCESS; +} + +static CXLRetCode cxl_dcd_add_dyn_cap_rsp_dry_run(CXLType3Dev *ct3d, + const CXLUpdateDCExtentListInPl *in) +{ + uint32_t i; + CXLDCExtent *ent; + uint64_t dpa, len; + Range range1, range2; + + for (i = 0; i < in->num_entries_updated; i++) { + dpa = in->updated_entries[i].start_dpa; + len = in->updated_entries[i].len; + + range_init_nofail(&range1, dpa, len); + + /* + * TODO: once the pending extent list is added, check against + * the list will be added here. + */ + + /* to-be-added range should not overlap with range already accepted */ + QTAILQ_FOREACH(ent, &ct3d->dc.extents, node) { + range_init_nofail(&range2, ent->start_dpa, ent->len); + if (range_overlaps_range(&range1, &range2)) { + return CXL_MBOX_INVALID_PA; + } + } + } + return CXL_MBOX_SUCCESS; +} + +/* + * CXL r3.1 section 8.2.9.9.9.3: Add Dynamic Capacity Response (Opcode 4802h) + * An extent is added to the extent list and becomes usable only after the + * response is processed successfully. + */ +static CXLRetCode cmd_dcd_add_dyn_cap_rsp(const struct cxl_cmd *cmd, + uint8_t *payload_in, + size_t len_in, + uint8_t *payload_out, + size_t *len_out, + CXLCCI *cci) +{ + CXLUpdateDCExtentListInPl *in = (void *)payload_in; + CXLType3Dev *ct3d = CXL_TYPE3(cci->d); + CXLDCExtentList *extent_list = &ct3d->dc.extents; + uint32_t i; + uint64_t dpa, len; + CXLRetCode ret; + + if (in->num_entries_updated == 0) { + /* + * TODO: once the pending list is introduced, extents in the beginning + * will get wiped out. + */ + return CXL_MBOX_SUCCESS; + } + + /* Adding extents causes exceeding device's extent tracking ability. */ + if (in->num_entries_updated + ct3d->dc.total_extent_count > + CXL_NUM_EXTENTS_SUPPORTED) { + return CXL_MBOX_RESOURCES_EXHAUSTED; + } + + ret = cxl_detect_malformed_extent_list(ct3d, in); + if (ret != CXL_MBOX_SUCCESS) { + return ret; + } + + ret = cxl_dcd_add_dyn_cap_rsp_dry_run(ct3d, in); + if (ret != CXL_MBOX_SUCCESS) { + return ret; + } + + for (i = 0; i < in->num_entries_updated; i++) { + dpa = in->updated_entries[i].start_dpa; + len = in->updated_entries[i].len; + + cxl_insert_extent_to_extent_list(extent_list, dpa, len, NULL, 0); + ct3d->dc.total_extent_count += 1; + /* + * TODO: we will add a pending extent list based on event log record + * and process the list accordingly here. + */ + } + + return CXL_MBOX_SUCCESS; +} + +/* + * Copy extent list from src to dst + * Return value: number of extents copied + */ +static uint32_t copy_extent_list(CXLDCExtentList *dst, + const CXLDCExtentList *src) +{ + uint32_t cnt = 0; + CXLDCExtent *ent; + + if (!dst || !src) { + return 0; + } + + QTAILQ_FOREACH(ent, src, node) { + cxl_insert_extent_to_extent_list(dst, ent->start_dpa, ent->len, + ent->tag, ent->shared_seq); + cnt++; + } + return cnt; +} + +static CXLRetCode cxl_dc_extent_release_dry_run(CXLType3Dev *ct3d, + const CXLUpdateDCExtentListInPl *in, CXLDCExtentList *updated_list, + uint32_t *updated_list_size) +{ + CXLDCExtent *ent, *ent_next; + uint64_t dpa, len; + uint32_t i; + int cnt_delta = 0; + CXLRetCode ret = CXL_MBOX_SUCCESS; + + QTAILQ_INIT(updated_list); + copy_extent_list(updated_list, &ct3d->dc.extents); + + for (i = 0; i < in->num_entries_updated; i++) { + Range range; + + dpa = in->updated_entries[i].start_dpa; + len = in->updated_entries[i].len; + + while (len > 0) { + QTAILQ_FOREACH(ent, updated_list, node) { + range_init_nofail(&range, ent->start_dpa, ent->len); + + if (range_contains(&range, dpa)) { + uint64_t len1, len2 = 0, len_done = 0; + uint64_t ent_start_dpa = ent->start_dpa; + uint64_t ent_len = ent->len; + + len1 = dpa - ent->start_dpa; + /* Found the extent or the subset of an existing extent */ + if (range_contains(&range, dpa + len - 1)) { + len2 = ent_start_dpa + ent_len - dpa - len; + } else { + /* + * TODO: we reject the attempt to remove an extent + * that overlaps with multiple extents in the device + * for now. We will allow it once superset release + * support is added. + */ + ret = CXL_MBOX_INVALID_PA; + goto free_and_exit; + } + len_done = ent_len - len1 - len2; + + cxl_remove_extent_from_extent_list(updated_list, ent); + cnt_delta--; + + if (len1) { + cxl_insert_extent_to_extent_list(updated_list, + ent_start_dpa, + len1, NULL, 0); + cnt_delta++; + } + if (len2) { + cxl_insert_extent_to_extent_list(updated_list, + dpa + len, + len2, NULL, 0); + cnt_delta++; + } + + if (cnt_delta + ct3d->dc.total_extent_count > + CXL_NUM_EXTENTS_SUPPORTED) { + ret = CXL_MBOX_RESOURCES_EXHAUSTED; + goto free_and_exit; + } + + len -= len_done; + /* len == 0 here until superset release is added */ + break; + } + } + if (len) { + ret = CXL_MBOX_INVALID_PA; + goto free_and_exit; + } + } + } +free_and_exit: + if (ret != CXL_MBOX_SUCCESS) { + QTAILQ_FOREACH_SAFE(ent, updated_list, node, ent_next) { + cxl_remove_extent_from_extent_list(updated_list, ent); + } + *updated_list_size = 0; + } else { + *updated_list_size = ct3d->dc.total_extent_count + cnt_delta; + } + + return ret; +} + +/* + * CXL r3.1 section 8.2.9.9.9.4: Release Dynamic Capacity (Opcode 4803h) + */ +static CXLRetCode cmd_dcd_release_dyn_cap(const struct cxl_cmd *cmd, + uint8_t *payload_in, + size_t len_in, + uint8_t *payload_out, + size_t *len_out, + CXLCCI *cci) +{ + CXLUpdateDCExtentListInPl *in = (void *)payload_in; + CXLType3Dev *ct3d = CXL_TYPE3(cci->d); + CXLDCExtentList updated_list; + CXLDCExtent *ent, *ent_next; + uint32_t updated_list_size; + CXLRetCode ret; + + if (in->num_entries_updated == 0) { + return CXL_MBOX_INVALID_INPUT; + } + + ret = cxl_detect_malformed_extent_list(ct3d, in); + if (ret != CXL_MBOX_SUCCESS) { + return ret; + } + + ret = cxl_dc_extent_release_dry_run(ct3d, in, &updated_list, + &updated_list_size); + if (ret != CXL_MBOX_SUCCESS) { + return ret; + } + + /* + * If the dry run release passes, the returned updated_list will + * be the updated extent list and we just need to clear the extents + * in the accepted list and copy extents in the updated_list to accepted + * list and update the extent count; + */ + QTAILQ_FOREACH_SAFE(ent, &ct3d->dc.extents, node, ent_next) { + cxl_remove_extent_from_extent_list(&ct3d->dc.extents, ent); + } + copy_extent_list(&ct3d->dc.extents, &updated_list); + QTAILQ_FOREACH_SAFE(ent, &updated_list, node, ent_next) { + cxl_remove_extent_from_extent_list(&updated_list, ent); + } + ct3d->dc.total_extent_count = updated_list_size; + + return CXL_MBOX_SUCCESS; +} + #define IMMEDIATE_CONFIG_CHANGE (1 << 1) #define IMMEDIATE_DATA_CHANGE (1 << 2) #define IMMEDIATE_POLICY_CHANGE (1 << 3) @@ -1448,6 +1836,12 @@ static const struct cxl_cmd cxl_cmd_set_dcd[256][256] = { [DCD_CONFIG][GET_DYN_CAP_EXT_LIST] = { "DCD_GET_DYNAMIC_CAPACITY_EXTENT_LIST", cmd_dcd_get_dyn_cap_ext_list, 8, 0 }, + [DCD_CONFIG][ADD_DYN_CAP_RSP] = { + "DCD_ADD_DYNAMIC_CAPACITY_RESPONSE", cmd_dcd_add_dyn_cap_rsp, + ~0, IMMEDIATE_DATA_CHANGE }, + [DCD_CONFIG][RELEASE_DYN_CAP] = { + "DCD_RELEASE_DYNAMIC_CAPACITY", cmd_dcd_release_dyn_cap, + ~0, IMMEDIATE_DATA_CHANGE }, }; static const struct cxl_cmd cxl_cmd_set_sw[256][256] = { diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index 2075846b1b..db5191b3b7 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -678,6 +678,15 @@ static bool cxl_create_dc_regions(CXLType3Dev *ct3d, Error **errp) return true; } +static void cxl_destroy_dc_regions(CXLType3Dev *ct3d) +{ + CXLDCExtent *ent, *ent_next; + + QTAILQ_FOREACH_SAFE(ent, &ct3d->dc.extents, node, ent_next) { + cxl_remove_extent_from_extent_list(&ct3d->dc.extents, ent); + } +} + static bool cxl_setup_memory(CXLType3Dev *ct3d, Error **errp) { DeviceState *ds = DEVICE(ct3d); @@ -874,6 +883,7 @@ err_free_special_ops: g_free(regs->special_ops); err_address_space_free: if (ct3d->dc.host_dc) { + cxl_destroy_dc_regions(ct3d); address_space_destroy(&ct3d->dc.host_dc_as); } if (ct3d->hostpmem) { @@ -895,6 +905,7 @@ static void ct3_exit(PCIDevice *pci_dev) cxl_doe_cdat_release(cxl_cstate); g_free(regs->special_ops); if (ct3d->dc.host_dc) { + cxl_destroy_dc_regions(ct3d); address_space_destroy(&ct3d->dc.host_dc_as); } if (ct3d->hostpmem) { From patchwork Tue Jul 2 14:08:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719727 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 063F2C3064D for ; Tue, 2 Jul 2024 14:11:50 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeBY-0004h9-L6; Tue, 02 Jul 2024 10:08: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 1sOeBW-0004Sw-DO for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:43 -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 1sOeBF-00089W-8C for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929304; 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=luTRPHAeeb1OyXMCpOc0nu4ARMny/qSptOQ/dYaP6qI=; b=NtLmFGJwhlHcVElYMgeieDEn/lWJWWiIJnF1UXPZYvW+Vaj+RvcEcezYV420rbnZctYjHU RZtzRK08jGeLAfAz36hQxt5KY7//eAq6oQk7Mna4Vms9mnybB5cc2uq+4PIqpg10Fee/OJ NBvNK8fboE8n8AQtfmNN3AoGFAyGzhs= 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-423-0l2rJKdhNKmFIhrVV36jlQ-1; Tue, 02 Jul 2024 10:08:23 -0400 X-MC-Unique: 0l2rJKdhNKmFIhrVV36jlQ-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4258675a6easo15701355e9.3 for ; Tue, 02 Jul 2024 07:08:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929301; x=1720534101; 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=luTRPHAeeb1OyXMCpOc0nu4ARMny/qSptOQ/dYaP6qI=; b=Z4kx0yDnxvpsfuR/G6/S6Lc1rok2G6RdRVSstr0c68k2cSGEDytMC4nP9t786eITyJ YuZYFzFER8xgqS6tIrH7qtF/oyimpsWu50qlgepEvrTdP/rKAj6H7ECNkx+Z5IlfU4sR 0xHBBn76QP9jKEFoRVe6xv8fPfE97kItJNaB8KhYO5BEpeu8thgcDiS3wGfEBpaqEC69 VX8aNBc1e5OJnKRPEy2SDN7qjasF8NPBnlZxhqPB7Cw1ycBzaKaEinggdoZkYbn/jKkD BOUVmf9YPfs0HsoYK1BAyiOkR1AAe2uAXDMoDZTyyApD3zXJf54hPCwGnbyIYXtKd1ed 05aw== X-Gm-Message-State: AOJu0YyXeFj2XeBPq1qOM68j40dH6gRaKwg2E7MrLZl4xYjFPXf6pXdr jn8E9JyH0rhGhYqGKUspMVmYx3xjjBtexCXvTJilKLIiejCimjZioGRFL5eapl6ohMzASRvTFgP xLNOe2mVGJXea/Slzj99e3VN2SCJuNP6DrzNFdQTz3A795Scdg+VvSHz7qdNeg5FiNdWr1nibre N+EpvuyaXl8gmYIBtg1rrTzYQ9lIb4oQ== X-Received: by 2002:a7b:cc96:0:b0:425:7798:6d66 with SMTP id 5b1f17b1804b1-4257a02b915mr55924585e9.1.1719929301470; Tue, 02 Jul 2024 07:08:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGbxU9QLaUlq/ReD15+6VqlCP5i1NPNcWddJa1z+lIFuDKzKsihxwJi1/QGnH5rv9z+CRb1qw== X-Received: by 2002:a7b:cc96:0:b0:425:7798:6d66 with SMTP id 5b1f17b1804b1-4257a02b915mr55924155e9.1.1719929300576; Tue, 02 Jul 2024 07:08:20 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b0c0f1bsm196740425e9.44.2024.07.02.07.08.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:08:19 -0700 (PDT) Date: Tue, 2 Jul 2024 10:08:17 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Fan Ni , Svetly Todorov , Gregory Price , Jonathan Cameron , Eric Blake , Markus Armbruster Subject: [PULL 26/91] hw/cxl/events: Add qmp interfaces to add/release dynamic capacity extents 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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Fan Ni To simulate FM functionalities for initiating Dynamic Capacity Add (Opcode 5604h) and Dynamic Capacity Release (Opcode 5605h) as in CXL spec r3.1 7.6.7.6.5 and 7.6.7.6.6, we implemented two QMP interfaces to issue add/release dynamic capacity extents requests. With the change, we allow to release an extent only when its DPA range is contained by a single accepted extent in the device. That is to say, extent superset release is not supported yet. 1. Add dynamic capacity extents: For example, the command to add two continuous extents (each 128MiB long) to region 0 (starting at DPA offset 0) looks like below: { "execute": "qmp_capabilities" } { "execute": "cxl-add-dynamic-capacity", "arguments": { "path": "/machine/peripheral/cxl-dcd0", "host-id": 0, "selection-policy": "prescriptive", "region": 0, "extents": [ { "offset": 0, "len": 134217728 }, { "offset": 134217728, "len": 134217728 } ] } } 2. Release dynamic capacity extents: For example, the command to release an extent of size 128MiB from region 0 (DPA offset 128MiB) looks like below: { "execute": "cxl-release-dynamic-capacity", "arguments": { "path": "/machine/peripheral/cxl-dcd0", "host-id": 0, "removal-policy":"prescriptive", "region": 0, "extents": [ { "offset": 134217728, "len": 134217728 } ] } } Tested-by: Svetly Todorov Reviewed-by: Gregory Price Signed-off-by: Fan Ni Message-Id: <20240523174651.1089554-12-nifan.cxl@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- qapi/cxl.json | 143 +++++++++++++++++ include/hw/cxl/cxl_device.h | 22 +++ include/hw/cxl/cxl_events.h | 18 +++ hw/cxl/cxl-mailbox-utils.c | 62 ++++++-- hw/mem/cxl_type3.c | 306 +++++++++++++++++++++++++++++++++++- hw/mem/cxl_type3_stubs.c | 25 +++ 6 files changed, 563 insertions(+), 13 deletions(-) diff --git a/qapi/cxl.json b/qapi/cxl.json index 4281726dec..57d9f82014 100644 --- a/qapi/cxl.json +++ b/qapi/cxl.json @@ -361,3 +361,146 @@ ## {'command': 'cxl-inject-correctable-error', 'data': {'path': 'str', 'type': 'CxlCorErrorType'}} + +## +# @CXLDynamicCapacityExtent: +# +# A single dynamic capacity extent +# +# @offset: The offset (in bytes) to the start of the region +# where the extent belongs to. +# +# @len: The length of the extent in bytes. +# +# Since: 9.1 +## +{ 'struct': 'CXLDynamicCapacityExtent', + 'data': { + 'offset':'uint64', + 'len': 'uint64' + } +} + +## +# @CXLExtSelPolicy: +# +# The policy to use for selecting which extents comprise the added +# capacity, as defined in cxl spec r3.1 Table 7-70. +# +# @free: 0h = Free +# +# @contiguous: 1h = Continuous +# +# @prescriptive: 2h = Prescriptive +# +# @enable-shared-access: 3h = Enable Shared Access +# +# Since: 9.1 +## +{ 'enum': 'CXLExtSelPolicy', + 'data': ['free', + 'contiguous', + 'prescriptive', + 'enable-shared-access'] +} + +## +# @cxl-add-dynamic-capacity: +# +# Command to initiate to add dynamic capacity extents to a host. It +# simulates operations defined in cxl spec r3.1 7.6.7.6.5. +# +# @path: CXL DCD canonical QOM path. +# +# @host-id: The "Host ID" field as defined in cxl spec r3.1 +# Table 7-70. +# +# @selection-policy: The "Selection Policy" bits as defined in +# cxl spec r3.1 Table 7-70. It specifies the policy to use for +# selecting which extents comprise the added capacity. +# +# @region: The "Region Number" field as defined in cxl spec r3.1 +# Table 7-70. The dynamic capacity region where the capacity +# is being added. Valid range is from 0-7. +# +# @tag: The "Tag" field as defined in cxl spec r3.1 Table 7-70. +# +# @extents: The "Extent List" field as defined in cxl spec r3.1 +# Table 7-70. +# +# Since : 9.1 +## +{ 'command': 'cxl-add-dynamic-capacity', + 'data': { 'path': 'str', + 'host-id': 'uint16', + 'selection-policy': 'CXLExtSelPolicy', + 'region': 'uint8', + '*tag': 'str', + 'extents': [ 'CXLDynamicCapacityExtent' ] + } +} + +## +# @CXLExtRemovalPolicy: +# +# The policy to use for selecting which extents comprise the released +# capacity, defined in the "Flags" field in cxl spec r3.1 Table 7-71. +# +# @tag-based: value = 0h. Extents are selected by the device based +# on tag, with no requirement for contiguous extents. +# +# @prescriptive: value = 1h. Extent list of capacity to release is +# included in the request payload. +# +# Since: 9.1 +## +{ 'enum': 'CXLExtRemovalPolicy', + 'data': ['tag-based', + 'prescriptive'] +} + +## +# @cxl-release-dynamic-capacity: +# +# Command to initiate to release dynamic capacity extents from a +# host. It simulates operations defined in cxl spec r3.1 7.6.7.6.6. +# +# @path: CXL DCD canonical QOM path. +# +# @host-id: The "Host ID" field as defined in cxl spec r3.1 +# Table 7-71. +# +# @removal-policy: Bit[3:0] of the "Flags" field as defined in cxl +# spec r3.1 Table 7-71. +# +# @forced-removal: Bit[4] of the "Flags" field in cxl spec r3.1 +# Table 7-71. When set, device does not wait for a Release +# Dynamic Capacity command from the host. Host immediately +# loses access to released capacity. +# +# @sanitize-on-release: Bit[5] of the "Flags" field in cxl spec r3.1 +# Table 7-71. When set, device should sanitize all released +# capacity as a result of this request. +# +# @region: The "Region Number" field as defined in cxl spec r3.1 +# Table 7-71. The dynamic capacity region where the capacity +# is being added. Valid range is from 0-7. +# +# @tag: The "Tag" field as defined in cxl spec r3.1 Table 7-71. +# +# @extents: The "Extent List" field as defined in cxl spec r3.1 +# Table 7-71. +# +# Since : 9.1 +## +{ 'command': 'cxl-release-dynamic-capacity', + 'data': { 'path': 'str', + 'host-id': 'uint16', + 'removal-policy': 'CXLExtRemovalPolicy', + '*forced-removal': 'bool', + '*sanitize-on-release': 'bool', + 'region': 'uint8', + '*tag': 'str', + 'extents': [ 'CXLDynamicCapacityExtent' ] + } +} diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h index df3511e91b..c69ff6b5de 100644 --- a/include/hw/cxl/cxl_device.h +++ b/include/hw/cxl/cxl_device.h @@ -443,6 +443,12 @@ typedef struct CXLDCExtent { } CXLDCExtent; typedef QTAILQ_HEAD(, CXLDCExtent) CXLDCExtentList; +typedef struct CXLDCExtentGroup { + CXLDCExtentList list; + QTAILQ_ENTRY(CXLDCExtentGroup) node; +} CXLDCExtentGroup; +typedef QTAILQ_HEAD(, CXLDCExtentGroup) CXLDCExtentGroupList; + typedef struct CXLDCRegion { uint64_t base; /* aligned to 256*MiB */ uint64_t decode_len; /* aligned to 256*MiB */ @@ -494,6 +500,7 @@ struct CXLType3Dev { */ uint64_t total_capacity; /* 256M aligned */ CXLDCExtentList extents; + CXLDCExtentGroupList extents_pending; uint32_t total_extent_count; uint32_t ext_list_gen_seq; @@ -555,4 +562,19 @@ CXLDCRegion *cxl_find_dc_region(CXLType3Dev *ct3d, uint64_t dpa, uint64_t len); void cxl_remove_extent_from_extent_list(CXLDCExtentList *list, CXLDCExtent *extent); +void cxl_insert_extent_to_extent_list(CXLDCExtentList *list, uint64_t dpa, + uint64_t len, uint8_t *tag, + uint16_t shared_seq); +bool test_any_bits_set(const unsigned long *addr, unsigned long nr, + unsigned long size); +bool cxl_extents_contains_dpa_range(CXLDCExtentList *list, + uint64_t dpa, uint64_t len); +CXLDCExtentGroup *cxl_insert_extent_to_extent_group(CXLDCExtentGroup *group, + uint64_t dpa, + uint64_t len, + uint8_t *tag, + uint16_t shared_seq); +void cxl_extent_group_list_insert_tail(CXLDCExtentGroupList *list, + CXLDCExtentGroup *group); +void cxl_extent_group_list_delete_front(CXLDCExtentGroupList *list); #endif diff --git a/include/hw/cxl/cxl_events.h b/include/hw/cxl/cxl_events.h index 5170b8dbf8..38cadaa0f3 100644 --- a/include/hw/cxl/cxl_events.h +++ b/include/hw/cxl/cxl_events.h @@ -166,4 +166,22 @@ typedef struct CXLEventMemoryModule { uint8_t reserved[0x3d]; } QEMU_PACKED CXLEventMemoryModule; +/* + * CXL r3.1 section Table 8-50: Dynamic Capacity Event Record + * All fields little endian. + */ +typedef struct CXLEventDynamicCapacity { + CXLEventRecordHdr hdr; + uint8_t type; + uint8_t validity_flags; + uint16_t host_id; + uint8_t updated_region_id; + uint8_t flags; + uint8_t reserved2[2]; + uint8_t dynamic_capacity_extent[0x28]; /* defined in cxl_device.h */ + uint8_t reserved[0x18]; + uint32_t extents_avail; + uint32_t tags_avail; +} QEMU_PACKED CXLEventDynamicCapacity; + #endif /* CXL_EVENTS_H */ diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index e322407fb3..64387f34ce 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -1405,7 +1405,7 @@ static CXLRetCode cmd_dcd_get_dyn_cap_ext_list(const struct cxl_cmd *cmd, * Check whether any bit between addr[nr, nr+size) is set, * return true if any bit is set, otherwise return false */ -static bool test_any_bits_set(const unsigned long *addr, unsigned long nr, +bool test_any_bits_set(const unsigned long *addr, unsigned long nr, unsigned long size) { unsigned long res = find_next_bit(addr, size + nr, nr); @@ -1444,7 +1444,7 @@ CXLDCRegion *cxl_find_dc_region(CXLType3Dev *ct3d, uint64_t dpa, uint64_t len) return NULL; } -static void cxl_insert_extent_to_extent_list(CXLDCExtentList *list, +void cxl_insert_extent_to_extent_list(CXLDCExtentList *list, uint64_t dpa, uint64_t len, uint8_t *tag, @@ -1470,6 +1470,44 @@ void cxl_remove_extent_from_extent_list(CXLDCExtentList *list, g_free(extent); } +/* + * Add a new extent to the extent "group" if group exists; + * otherwise, create a new group + * Return value: the extent group where the extent is inserted. + */ +CXLDCExtentGroup *cxl_insert_extent_to_extent_group(CXLDCExtentGroup *group, + uint64_t dpa, + uint64_t len, + uint8_t *tag, + uint16_t shared_seq) +{ + if (!group) { + group = g_new0(CXLDCExtentGroup, 1); + QTAILQ_INIT(&group->list); + } + cxl_insert_extent_to_extent_list(&group->list, dpa, len, + tag, shared_seq); + return group; +} + +void cxl_extent_group_list_insert_tail(CXLDCExtentGroupList *list, + CXLDCExtentGroup *group) +{ + QTAILQ_INSERT_TAIL(list, group, node); +} + +void cxl_extent_group_list_delete_front(CXLDCExtentGroupList *list) +{ + CXLDCExtent *ent, *ent_next; + CXLDCExtentGroup *group = QTAILQ_FIRST(list); + + QTAILQ_REMOVE(list, group, node); + QTAILQ_FOREACH_SAFE(ent, &group->list, node, ent_next) { + cxl_remove_extent_from_extent_list(&group->list, ent); + } + g_free(group); +} + /* * CXL r3.1 Table 8-168: Add Dynamic Capacity Response Input Payload * CXL r3.1 Table 8-170: Release Dynamic Capacity Input Payload @@ -1541,6 +1579,7 @@ static CXLRetCode cxl_dcd_add_dyn_cap_rsp_dry_run(CXLType3Dev *ct3d, { uint32_t i; CXLDCExtent *ent; + CXLDCExtentGroup *ext_group; uint64_t dpa, len; Range range1, range2; @@ -1551,9 +1590,13 @@ static CXLRetCode cxl_dcd_add_dyn_cap_rsp_dry_run(CXLType3Dev *ct3d, range_init_nofail(&range1, dpa, len); /* - * TODO: once the pending extent list is added, check against - * the list will be added here. + * The host-accepted DPA range must be contained by the first extent + * group in the pending list */ + ext_group = QTAILQ_FIRST(&ct3d->dc.extents_pending); + if (!cxl_extents_contains_dpa_range(&ext_group->list, dpa, len)) { + return CXL_MBOX_INVALID_PA; + } /* to-be-added range should not overlap with range already accepted */ QTAILQ_FOREACH(ent, &ct3d->dc.extents, node) { @@ -1586,10 +1629,7 @@ static CXLRetCode cmd_dcd_add_dyn_cap_rsp(const struct cxl_cmd *cmd, CXLRetCode ret; if (in->num_entries_updated == 0) { - /* - * TODO: once the pending list is introduced, extents in the beginning - * will get wiped out. - */ + cxl_extent_group_list_delete_front(&ct3d->dc.extents_pending); return CXL_MBOX_SUCCESS; } @@ -1615,11 +1655,9 @@ static CXLRetCode cmd_dcd_add_dyn_cap_rsp(const struct cxl_cmd *cmd, cxl_insert_extent_to_extent_list(extent_list, dpa, len, NULL, 0); ct3d->dc.total_extent_count += 1; - /* - * TODO: we will add a pending extent list based on event log record - * and process the list accordingly here. - */ } + /* Remove the first extent group in the pending list */ + cxl_extent_group_list_delete_front(&ct3d->dc.extents_pending); return CXL_MBOX_SUCCESS; } diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index db5191b3b7..f53bcca6d3 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -674,6 +674,7 @@ static bool cxl_create_dc_regions(CXLType3Dev *ct3d, Error **errp) ct3d->dc.total_capacity += region->len; } QTAILQ_INIT(&ct3d->dc.extents); + QTAILQ_INIT(&ct3d->dc.extents_pending); return true; } @@ -681,10 +682,19 @@ static bool cxl_create_dc_regions(CXLType3Dev *ct3d, Error **errp) static void cxl_destroy_dc_regions(CXLType3Dev *ct3d) { CXLDCExtent *ent, *ent_next; + CXLDCExtentGroup *group, *group_next; QTAILQ_FOREACH_SAFE(ent, &ct3d->dc.extents, node, ent_next) { cxl_remove_extent_from_extent_list(&ct3d->dc.extents, ent); } + + QTAILQ_FOREACH_SAFE(group, &ct3d->dc.extents_pending, node, group_next) { + QTAILQ_REMOVE(&ct3d->dc.extents_pending, group, node); + QTAILQ_FOREACH_SAFE(ent, &group->list, node, ent_next) { + cxl_remove_extent_from_extent_list(&group->list, ent); + } + g_free(group); + } } static bool cxl_setup_memory(CXLType3Dev *ct3d, Error **errp) @@ -1449,7 +1459,6 @@ static int ct3d_qmp_cxl_event_log_enc(CxlEventLog log) return CXL_EVENT_TYPE_FAIL; case CXL_EVENT_LOG_FATAL: return CXL_EVENT_TYPE_FATAL; -/* DCD not yet supported */ default: return -EINVAL; } @@ -1700,6 +1709,301 @@ void qmp_cxl_inject_memory_module_event(const char *path, CxlEventLog log, } } +/* CXL r3.1 Table 8-50: Dynamic Capacity Event Record */ +static const QemuUUID dynamic_capacity_uuid = { + .data = UUID(0xca95afa7, 0xf183, 0x4018, 0x8c, 0x2f, + 0x95, 0x26, 0x8e, 0x10, 0x1a, 0x2a), +}; + +typedef enum CXLDCEventType { + DC_EVENT_ADD_CAPACITY = 0x0, + DC_EVENT_RELEASE_CAPACITY = 0x1, + DC_EVENT_FORCED_RELEASE_CAPACITY = 0x2, + DC_EVENT_REGION_CONFIG_UPDATED = 0x3, + DC_EVENT_ADD_CAPACITY_RSP = 0x4, + DC_EVENT_CAPACITY_RELEASED = 0x5, +} CXLDCEventType; + +/* + * Check whether the range [dpa, dpa + len - 1] has overlaps with extents in + * the list. + * Return value: return true if has overlaps; otherwise, return false + */ +static bool cxl_extents_overlaps_dpa_range(CXLDCExtentList *list, + uint64_t dpa, uint64_t len) +{ + CXLDCExtent *ent; + Range range1, range2; + + if (!list) { + return false; + } + + range_init_nofail(&range1, dpa, len); + QTAILQ_FOREACH(ent, list, node) { + range_init_nofail(&range2, ent->start_dpa, ent->len); + if (range_overlaps_range(&range1, &range2)) { + return true; + } + } + return false; +} + +/* + * Check whether the range [dpa, dpa + len - 1] is contained by extents in + * the list. + * Will check multiple extents containment once superset release is added. + * Return value: return true if range is contained; otherwise, return false + */ +bool cxl_extents_contains_dpa_range(CXLDCExtentList *list, + uint64_t dpa, uint64_t len) +{ + CXLDCExtent *ent; + Range range1, range2; + + if (!list) { + return false; + } + + range_init_nofail(&range1, dpa, len); + QTAILQ_FOREACH(ent, list, node) { + range_init_nofail(&range2, ent->start_dpa, ent->len); + if (range_contains_range(&range2, &range1)) { + return true; + } + } + return false; +} + +static bool cxl_extent_groups_overlaps_dpa_range(CXLDCExtentGroupList *list, + uint64_t dpa, uint64_t len) +{ + CXLDCExtentGroup *group; + + if (!list) { + return false; + } + + QTAILQ_FOREACH(group, list, node) { + if (cxl_extents_overlaps_dpa_range(&group->list, dpa, len)) { + return true; + } + } + return false; +} + +/* + * The main function to process dynamic capacity event with extent list. + * Currently DC extents add/release requests are processed. + */ +static void qmp_cxl_process_dynamic_capacity_prescriptive(const char *path, + uint16_t hid, CXLDCEventType type, uint8_t rid, + CXLDynamicCapacityExtentList *records, Error **errp) +{ + Object *obj; + CXLEventDynamicCapacity dCap = {}; + CXLEventRecordHdr *hdr = &dCap.hdr; + CXLType3Dev *dcd; + uint8_t flags = 1 << CXL_EVENT_TYPE_INFO; + uint32_t num_extents = 0; + CXLDynamicCapacityExtentList *list; + CXLDCExtentGroup *group = NULL; + g_autofree CXLDCExtentRaw *extents = NULL; + uint8_t enc_log = CXL_EVENT_TYPE_DYNAMIC_CAP; + uint64_t dpa, offset, len, block_size; + g_autofree unsigned long *blk_bitmap = NULL; + int i; + + obj = object_resolve_path_type(path, TYPE_CXL_TYPE3, NULL); + if (!obj) { + error_setg(errp, "Unable to resolve CXL type 3 device"); + return; + } + + dcd = CXL_TYPE3(obj); + if (!dcd->dc.num_regions) { + error_setg(errp, "No dynamic capacity support from the device"); + return; + } + + + if (rid >= dcd->dc.num_regions) { + error_setg(errp, "region id is too large"); + return; + } + block_size = dcd->dc.regions[rid].block_size; + blk_bitmap = bitmap_new(dcd->dc.regions[rid].len / block_size); + + /* Sanity check and count the extents */ + list = records; + while (list) { + offset = list->value->offset; + len = list->value->len; + dpa = offset + dcd->dc.regions[rid].base; + + if (len == 0) { + error_setg(errp, "extent with 0 length is not allowed"); + return; + } + + if (offset % block_size || len % block_size) { + error_setg(errp, "dpa or len is not aligned to region block size"); + return; + } + + if (offset + len > dcd->dc.regions[rid].len) { + error_setg(errp, "extent range is beyond the region end"); + return; + } + + /* No duplicate or overlapped extents are allowed */ + if (test_any_bits_set(blk_bitmap, offset / block_size, + len / block_size)) { + error_setg(errp, "duplicate or overlapped extents are detected"); + return; + } + bitmap_set(blk_bitmap, offset / block_size, len / block_size); + + if (type == DC_EVENT_RELEASE_CAPACITY) { + if (cxl_extent_groups_overlaps_dpa_range(&dcd->dc.extents_pending, + dpa, len)) { + error_setg(errp, + "cannot release extent with pending DPA range"); + return; + } + if (!cxl_extents_contains_dpa_range(&dcd->dc.extents, dpa, len)) { + error_setg(errp, + "cannot release extent with non-existing DPA range"); + return; + } + } else if (type == DC_EVENT_ADD_CAPACITY) { + if (cxl_extents_overlaps_dpa_range(&dcd->dc.extents, dpa, len)) { + error_setg(errp, + "cannot add DPA already accessible to the same LD"); + return; + } + if (cxl_extent_groups_overlaps_dpa_range(&dcd->dc.extents_pending, + dpa, len)) { + error_setg(errp, + "cannot add DPA again while still pending"); + return; + } + } + list = list->next; + num_extents++; + } + + /* Create extent list for event being passed to host */ + i = 0; + list = records; + extents = g_new0(CXLDCExtentRaw, num_extents); + while (list) { + offset = list->value->offset; + len = list->value->len; + dpa = dcd->dc.regions[rid].base + offset; + + extents[i].start_dpa = dpa; + extents[i].len = len; + memset(extents[i].tag, 0, 0x10); + extents[i].shared_seq = 0; + if (type == DC_EVENT_ADD_CAPACITY) { + group = cxl_insert_extent_to_extent_group(group, + extents[i].start_dpa, + extents[i].len, + extents[i].tag, + extents[i].shared_seq); + } + + list = list->next; + i++; + } + if (group) { + cxl_extent_group_list_insert_tail(&dcd->dc.extents_pending, group); + } + + /* + * CXL r3.1 section 8.2.9.2.1.6: Dynamic Capacity Event Record + * + * All Dynamic Capacity event records shall set the Event Record Severity + * field in the Common Event Record Format to Informational Event. All + * Dynamic Capacity related events shall be logged in the Dynamic Capacity + * Event Log. + */ + cxl_assign_event_header(hdr, &dynamic_capacity_uuid, flags, sizeof(dCap), + cxl_device_get_timestamp(&dcd->cxl_dstate)); + + dCap.type = type; + /* FIXME: for now, validity flag is cleared */ + dCap.validity_flags = 0; + stw_le_p(&dCap.host_id, hid); + /* only valid for DC_REGION_CONFIG_UPDATED event */ + dCap.updated_region_id = 0; + dCap.flags = 0; + for (i = 0; i < num_extents; i++) { + memcpy(&dCap.dynamic_capacity_extent, &extents[i], + sizeof(CXLDCExtentRaw)); + + if (i < num_extents - 1) { + /* Set "More" flag */ + dCap.flags |= BIT(0); + } + + if (cxl_event_insert(&dcd->cxl_dstate, enc_log, + (CXLEventRecordRaw *)&dCap)) { + cxl_event_irq_assert(dcd); + } + } +} + +void qmp_cxl_add_dynamic_capacity(const char *path, uint16_t host_id, + CXLExtSelPolicy sel_policy, uint8_t region, + const char *tag, + CXLDynamicCapacityExtentList *extents, + Error **errp) +{ + switch (sel_policy) { + case CXL_EXT_SEL_POLICY_PRESCRIPTIVE: + qmp_cxl_process_dynamic_capacity_prescriptive(path, host_id, + DC_EVENT_ADD_CAPACITY, + region, extents, errp); + return; + default: + error_setg(errp, "Selection policy not supported"); + return; + } +} + +void qmp_cxl_release_dynamic_capacity(const char *path, uint16_t host_id, + CXLExtRemovalPolicy removal_policy, + bool has_forced_removal, + bool forced_removal, + bool has_sanitize_on_release, + bool sanitize_on_release, + uint8_t region, + const char *tag, + CXLDynamicCapacityExtentList *extents, + Error **errp) +{ + CXLDCEventType type = DC_EVENT_RELEASE_CAPACITY; + + if (has_forced_removal && forced_removal) { + /* TODO: enable forced removal in the future */ + type = DC_EVENT_FORCED_RELEASE_CAPACITY; + error_setg(errp, "Forced removal not supported yet"); + return; + } + + switch (removal_policy) { + case CXL_EXT_REMOVAL_POLICY_PRESCRIPTIVE: + qmp_cxl_process_dynamic_capacity_prescriptive(path, host_id, type, + region, extents, errp); + return; + default: + error_setg(errp, "Removal policy not supported"); + return; + } +} + static void ct3_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); diff --git a/hw/mem/cxl_type3_stubs.c b/hw/mem/cxl_type3_stubs.c index 3e1851e32b..45419bbefe 100644 --- a/hw/mem/cxl_type3_stubs.c +++ b/hw/mem/cxl_type3_stubs.c @@ -67,3 +67,28 @@ void qmp_cxl_inject_correctable_error(const char *path, CxlCorErrorType type, { error_setg(errp, "CXL Type 3 support is not compiled in"); } + +void qmp_cxl_add_dynamic_capacity(const char *path, + uint16_t host_id, + CXLExtSelPolicy sel_policy, + uint8_t region, + const char *tag, + CXLDynamicCapacityExtentList *extents, + Error **errp) +{ + error_setg(errp, "CXL Type 3 support is not compiled in"); +} + +void qmp_cxl_release_dynamic_capacity(const char *path, uint16_t host_id, + CXLExtRemovalPolicy removal_policy, + bool has_forced_removal, + bool forced_removal, + bool has_sanitize_on_release, + bool sanitize_on_release, + uint8_t region, + const char *tag, + CXLDynamicCapacityExtentList *extents, + Error **errp) +{ + error_setg(errp, "CXL Type 3 support is not compiled in"); +} From patchwork Tue Jul 2 14:08:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719785 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 041FBC3064D for ; Tue, 2 Jul 2024 14:21:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeBQ-0003fX-VZ; Tue, 02 Jul 2024 10:08: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 1sOeBO-0003TF-VP for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08: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 1sOeBJ-00089x-39 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929308; 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=J5j8n04Q1gRbmovO7PmlswqpHPYyPExcO8mAPNVjzhI=; b=eKiNAJ4APK+6x8OaLiECZ064I4Wug+pSJCh8d8rddou2VCx62BiPuykwjQBszjxdKWKLkA WTQuev6ndEQJl+4dhF+F00VVz6Rbop/C4k+7shdCdrzniAVC2q+GqAW+B48KjCdu8Xi4gB 4y5MyUw/bH6n/G1Rf8lHGCWcRkR12EM= 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-452-AGfBPtKYNiewLhkRQfY4nQ-1; Tue, 02 Jul 2024 10:08:26 -0400 X-MC-Unique: AGfBPtKYNiewLhkRQfY4nQ-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-42565672e0aso27270035e9.0 for ; Tue, 02 Jul 2024 07:08:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929304; x=1720534104; 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=J5j8n04Q1gRbmovO7PmlswqpHPYyPExcO8mAPNVjzhI=; b=ehfcBIgtNzAdwtReQwOqGafwmS4fLslvcztin6QZ/5M1gHRDDn0Z3o5LGBI7uQtlAv LZAOLX3Wr2FAclrzmozUyrDvlo/Wam2oxfeLb59/GdN2DTpi5CfBEmmjkS2ftJBvB7ty RJHWYwgxUkienOtlyie2ELN4HBs7G8fBfwtvDc/apf+WbCkbMQkbxg0Xa7SmVF4Xoi/7 KTpC5PoiBq7xec0f8G90meCjZmrMHHyRfwgEVz3UfuFQo0hRgAFiF8kBOt6zDxyamXIC kYHnBIJKRRwCL2WSF9Yw1W2oo1ed6tbOVYjjhl+bTv0JI/9pMDvhIa4cUakRmEJZ8oyu U8Iw== X-Gm-Message-State: AOJu0YyVn2HWnX05PLt2proB/AnO18UAXOWP+1zrWfk3ANI7XZiPsuEm k424WsS99g3UEHqRKSWeB416xMwK1t+av8Q0T/h+WtL7gi+ELJUIdk5vJDMy7R34JsOaUWpQFJ3 LbmLup7R+JlgO6HNt2xcy45kOTq1OxQeasqSIp1xhX3y6fju+QbtndGqx2vAMQ0vtwgJUNzkl2I nqakraThPRiXOIoT7lSz8+QTueiHI/Uw== X-Received: by 2002:a05:6000:1284:b0:367:8fb4:ddc4 with SMTP id ffacd0b85a97d-3678fb4de44mr207320f8f.33.1719929304457; Tue, 02 Jul 2024 07:08:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFN1C0l7b95ycstiW8O6EM41WAfGPeS0kcr+KoXTUgfz9E7dwASYZ38Bsyjc4BKTxpQ/UFWyg== X-Received: by 2002:a05:6000:1284:b0:367:8fb4:ddc4 with SMTP id ffacd0b85a97d-3678fb4de44mr207290f8f.33.1719929303847; Tue, 02 Jul 2024 07:08:23 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4257a4d4cd1sm136670395e9.28.2024.07.02.07.08.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:08:23 -0700 (PDT) Date: Tue, 2 Jul 2024 10:08:20 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Fan Ni , Svetly Todorov , Gregory Price , Jonathan Cameron Subject: [PULL 27/91] hw/mem/cxl_type3: Add DPA range validation for accesses to DC 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.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Fan Ni All DPA ranges in the DC regions are invalid to access until an extent covering the range has been successfully accepted by the host. A bitmap is added to each region to record whether a DC block in the region has been backed by a DC extent. Each bit in the bitmap represents a DC block. When a DC extent is accepted, all the bits representing the blocks in the extent are set, which will be cleared when the extent is released. Tested-by: Svetly Todorov Reviewed-by: Gregory Price Reviewed-by: Jonathan Cameron Signed-off-by: Fan Ni Message-Id: <20240523174651.1089554-13-nifan.cxl@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/cxl/cxl_device.h | 7 ++++ hw/cxl/cxl-mailbox-utils.c | 3 ++ hw/mem/cxl_type3.c | 76 +++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+) diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h index c69ff6b5de..0a4fcb2800 100644 --- a/include/hw/cxl/cxl_device.h +++ b/include/hw/cxl/cxl_device.h @@ -456,6 +456,7 @@ typedef struct CXLDCRegion { uint64_t block_size; uint32_t dsmadhandle; uint8_t flags; + unsigned long *blk_bitmap; } CXLDCRegion; struct CXLType3Dev { @@ -577,4 +578,10 @@ CXLDCExtentGroup *cxl_insert_extent_to_extent_group(CXLDCExtentGroup *group, void cxl_extent_group_list_insert_tail(CXLDCExtentGroupList *list, CXLDCExtentGroup *group); void cxl_extent_group_list_delete_front(CXLDCExtentGroupList *list); +void ct3_set_region_block_backed(CXLType3Dev *ct3d, uint64_t dpa, + uint64_t len); +void ct3_clear_region_block_backed(CXLType3Dev *ct3d, uint64_t dpa, + uint64_t len); +bool ct3_test_region_block_backed(CXLType3Dev *ct3d, uint64_t dpa, + uint64_t len); #endif diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index 64387f34ce..c4852112fe 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -1655,6 +1655,7 @@ static CXLRetCode cmd_dcd_add_dyn_cap_rsp(const struct cxl_cmd *cmd, cxl_insert_extent_to_extent_list(extent_list, dpa, len, NULL, 0); ct3d->dc.total_extent_count += 1; + ct3_set_region_block_backed(ct3d, dpa, len); } /* Remove the first extent group in the pending list */ cxl_extent_group_list_delete_front(&ct3d->dc.extents_pending); @@ -1813,10 +1814,12 @@ static CXLRetCode cmd_dcd_release_dyn_cap(const struct cxl_cmd *cmd, * list and update the extent count; */ QTAILQ_FOREACH_SAFE(ent, &ct3d->dc.extents, node, ent_next) { + ct3_clear_region_block_backed(ct3d, ent->start_dpa, ent->len); cxl_remove_extent_from_extent_list(&ct3d->dc.extents, ent); } copy_extent_list(&ct3d->dc.extents, &updated_list); QTAILQ_FOREACH_SAFE(ent, &updated_list, node, ent_next) { + ct3_set_region_block_backed(ct3d, ent->start_dpa, ent->len); cxl_remove_extent_from_extent_list(&updated_list, ent); } ct3d->dc.total_extent_count = updated_list_size; diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index f53bcca6d3..0d18259ec0 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -672,6 +672,7 @@ static bool cxl_create_dc_regions(CXLType3Dev *ct3d, Error **errp) .flags = 0, }; ct3d->dc.total_capacity += region->len; + region->blk_bitmap = bitmap_new(region->len / region->block_size); } QTAILQ_INIT(&ct3d->dc.extents); QTAILQ_INIT(&ct3d->dc.extents_pending); @@ -683,6 +684,8 @@ static void cxl_destroy_dc_regions(CXLType3Dev *ct3d) { CXLDCExtent *ent, *ent_next; CXLDCExtentGroup *group, *group_next; + int i; + CXLDCRegion *region; QTAILQ_FOREACH_SAFE(ent, &ct3d->dc.extents, node, ent_next) { cxl_remove_extent_from_extent_list(&ct3d->dc.extents, ent); @@ -695,6 +698,11 @@ static void cxl_destroy_dc_regions(CXLType3Dev *ct3d) } g_free(group); } + + for (i = 0; i < ct3d->dc.num_regions; i++) { + region = &ct3d->dc.regions[i]; + g_free(region->blk_bitmap); + } } static bool cxl_setup_memory(CXLType3Dev *ct3d, Error **errp) @@ -926,6 +934,70 @@ static void ct3_exit(PCIDevice *pci_dev) } } +/* + * Mark the DPA range [dpa, dap + len - 1] to be backed and accessible. This + * happens when a DC extent is added and accepted by the host. + */ +void ct3_set_region_block_backed(CXLType3Dev *ct3d, uint64_t dpa, + uint64_t len) +{ + CXLDCRegion *region; + + region = cxl_find_dc_region(ct3d, dpa, len); + if (!region) { + return; + } + + bitmap_set(region->blk_bitmap, (dpa - region->base) / region->block_size, + len / region->block_size); +} + +/* + * Check whether the DPA range [dpa, dpa + len - 1] is backed with DC extents. + * Used when validating read/write to dc regions + */ +bool ct3_test_region_block_backed(CXLType3Dev *ct3d, uint64_t dpa, + uint64_t len) +{ + CXLDCRegion *region; + uint64_t nbits; + long nr; + + region = cxl_find_dc_region(ct3d, dpa, len); + if (!region) { + return false; + } + + nr = (dpa - region->base) / region->block_size; + nbits = DIV_ROUND_UP(len, region->block_size); + /* + * if bits between [dpa, dpa + len) are all 1s, meaning the DPA range is + * backed with DC extents, return true; else return false. + */ + return find_next_zero_bit(region->blk_bitmap, nr + nbits, nr) == nr + nbits; +} + +/* + * Mark the DPA range [dpa, dap + len - 1] to be unbacked and inaccessible. + * This happens when a dc extent is released by the host. + */ +void ct3_clear_region_block_backed(CXLType3Dev *ct3d, uint64_t dpa, + uint64_t len) +{ + CXLDCRegion *region; + uint64_t nbits; + long nr; + + region = cxl_find_dc_region(ct3d, dpa, len); + if (!region) { + return; + } + + nr = (dpa - region->base) / region->block_size; + nbits = len / region->block_size; + bitmap_clear(region->blk_bitmap, nr, nbits); +} + static bool cxl_type3_dpa(CXLType3Dev *ct3d, hwaddr host_addr, uint64_t *dpa) { int hdm_inc = R_CXL_HDM_DECODER1_BASE_LO - R_CXL_HDM_DECODER0_BASE_LO; @@ -1030,6 +1102,10 @@ static int cxl_type3_hpa_to_as_and_dpa(CXLType3Dev *ct3d, *as = &ct3d->hostpmem_as; *dpa_offset -= vmr_size; } else { + if (!ct3_test_region_block_backed(ct3d, *dpa_offset, size)) { + return -ENODEV; + } + *as = &ct3d->dc.host_dc_as; *dpa_offset -= (vmr_size + pmr_size); } From patchwork Tue Jul 2 14:08:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719712 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 578F1C41513 for ; Tue, 2 Jul 2024 14:09:32 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeBP-0003aW-TJ; Tue, 02 Jul 2024 10:08: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 1sOeBO-0003OW-9t for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:34 -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 1sOeBM-0008Ae-Ht for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929311; 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=QuE+o0AC9wdLKXlzVTnODsdNe5/ti8zXK/7OKFfOYUM=; b=DiOFenw6p4NCmQ1ZXNmSBQ3DWjFuNA+Vv5fMbYUBkajuVFjXWD0ux7tTWclOyhnpitej5+ Qd+rlQ6gsxBWOmAy1AaDvfyeHr+jfGnrIYRbm364nqdy01ltm2pJmw9JeOicW25oIdq9wz rS9pxwoXAgJyJiBm0YzdGJtI6CmdEDM= 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-499-Bdfjy7BhO-KJCUZqdKaNdA-1; Tue, 02 Jul 2024 10:08:30 -0400 X-MC-Unique: Bdfjy7BhO-KJCUZqdKaNdA-1 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2ee45dea727so43498571fa.2 for ; Tue, 02 Jul 2024 07:08:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929308; x=1720534108; 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=QuE+o0AC9wdLKXlzVTnODsdNe5/ti8zXK/7OKFfOYUM=; b=g1h8iWs80kx+ZZ76gGxV95rgIn6Nu+q+E7ADvgZFTSJAXr6bSIchWGsyMSuEr+ul+O n0FDf3TWWeS5mq4bMMXuO+1k/pAxhebuk7SsoZKvDw+laNfOmRH2+90V+IPMQ58QKH0b XmZN85eLRQ9JRt5tuIfEuyMwjiW4T3+iS/be1Ey/oXcA/W/6xg4XT6xhtrFh5Jtud75+ /67nlI5xcktus2A3F2HmcuEJCNsuBXdy0vGu984E4Ve5TkemYEpcIdRwh0cCuMovO6tJ mMWjdMxrcH2TpYIxxoUszwN+MGqRm9+zeGimWB2tgisLKrSFIhYY0XBA2u8BccTCRH/l OFEg== X-Gm-Message-State: AOJu0Yw3xMFDu8+Q1Q8U6MWTtufZlAy+pn+XsmFk8z+rvgo+E/rvgmGC UPP2VxXYAx5Dkt/ZzyFPe5e3ZZNui7ofJr7JDiDJW+9O7sVz42OjLyKlkfprZnqAl7BiXazjkjw wRCeeZ9+8iPCxwBYFEpX1Y08PzJZNhRK7q6RTmqHr+r5W/nbuASrcazsZCFKikeLH4oTP9TAMYT ZTVavf/TKmNDJS4xbjDYoA3oDBN+FWIw== X-Received: by 2002:a2e:a80c:0:b0:2ee:6254:f9f1 with SMTP id 38308e7fff4ca-2ee6254fb37mr71784921fa.6.1719929308521; Tue, 02 Jul 2024 07:08:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEB7VMSAe5RZrg8sr1ujo7YRzCLDLvgQFHZNzW1YvKgmeNf6Z/zI39IVAcf8AOQDWz6P+uU5w== X-Received: by 2002:a2e:a80c:0:b0:2ee:6254:f9f1 with SMTP id 38308e7fff4ca-2ee6254fb37mr71783931fa.6.1719929306902; Tue, 02 Jul 2024 07:08:26 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af376f5sm200519545e9.6.2024.07.02.07.08.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:08:26 -0700 (PDT) Date: Tue, 2 Jul 2024 10:08:24 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Fan Ni , Svetly Todorov , Gregory Price , Jonathan Cameron Subject: [PULL 28/91] hw/cxl/cxl-mailbox-utils: Add superset extent release mailbox support Message-ID: <3083f018b59fd35b9ee993715694f967c49afeb1.1719929191.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Fan Ni With the change, we extend the extent release mailbox command processing to allow more flexible release. As long as the DPA range of the extent to release is covered by accepted extent(s) in the device, the release can be performed. Tested-by: Svetly Todorov Reviewed-by: Gregory Price Signed-off-by: Fan Ni Message-Id: <20240523174651.1089554-14-nifan.cxl@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/cxl/cxl-mailbox-utils.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index c4852112fe..74eeb6fde7 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -1704,6 +1704,13 @@ static CXLRetCode cxl_dc_extent_release_dry_run(CXLType3Dev *ct3d, dpa = in->updated_entries[i].start_dpa; len = in->updated_entries[i].len; + /* Check if the DPA range is not fully backed with valid extents */ + if (!ct3_test_region_block_backed(ct3d, dpa, len)) { + ret = CXL_MBOX_INVALID_PA; + goto free_and_exit; + } + + /* After this point, extent overflow is the only error can happen */ while (len > 0) { QTAILQ_FOREACH(ent, updated_list, node) { range_init_nofail(&range, ent->start_dpa, ent->len); @@ -1718,14 +1725,7 @@ static CXLRetCode cxl_dc_extent_release_dry_run(CXLType3Dev *ct3d, if (range_contains(&range, dpa + len - 1)) { len2 = ent_start_dpa + ent_len - dpa - len; } else { - /* - * TODO: we reject the attempt to remove an extent - * that overlaps with multiple extents in the device - * for now. We will allow it once superset release - * support is added. - */ - ret = CXL_MBOX_INVALID_PA; - goto free_and_exit; + dpa = ent_start_dpa + ent_len; } len_done = ent_len - len1 - len2; @@ -1752,14 +1752,9 @@ static CXLRetCode cxl_dc_extent_release_dry_run(CXLType3Dev *ct3d, } len -= len_done; - /* len == 0 here until superset release is added */ break; } } - if (len) { - ret = CXL_MBOX_INVALID_PA; - goto free_and_exit; - } } } free_and_exit: From patchwork Tue Jul 2 14:08:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719765 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A41D3C3064D for ; Tue, 2 Jul 2024 14:17:55 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeBU-0004CN-HB; Tue, 02 Jul 2024 10:08: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 1sOeBR-0003pj-U9 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08: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 1sOeBQ-0008Cf-2m for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929314; 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=WFUPapk07PnJ8CLhVhbjjsuC+NoP2UxN6SJb+Hfxl60=; b=BnxtlM91yj03wI9asrZvP0JwFIKHOuRaVmjS2HP6UbuYVWSJmjsI23rtMTekHGGvLJJ6D4 nRsYceCA1EQOJMCV04IJLagHWtlSj1Mq34nVFdpXRRjPHTjv+9yBnLJ5eQ6ZwV4AdxwMMW BpnlHsJxtGe3GBbMhoaS/f0z8UMNKH0= 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-yJWFgpvlP0e8Lp9KKyadrA-1; Tue, 02 Jul 2024 10:08:32 -0400 X-MC-Unique: yJWFgpvlP0e8Lp9KKyadrA-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4257a75193aso19222955e9.1 for ; Tue, 02 Jul 2024 07:08:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929311; x=1720534111; 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=WFUPapk07PnJ8CLhVhbjjsuC+NoP2UxN6SJb+Hfxl60=; b=IwJtvy7+x6VdX0ieXCBjpxK7YKtnAvKV+cXjVVy5x5eIQaWEiBVpaVzVZMYOt50mpi 6yB8iSSXNDDeNTDpkHND5Rw8YN3nJThGv8k6nWLVKCn23rtoIpRWGMM3mbniW7rTfbVb kURgSkF+ZZCvwU7CEnqwmNdBb3BXbJladScpyKA5aVZK4wfT34H0qXo4gkdL6gvPUpQ6 v5INpna9uyD+6nS5vNb+9AlvwzOHLaKAUEG3Y0Y54JHogN5qUaKiN8+Jy3ulBj+e4MxS FV5/FBPUgwFO7RsBrvQAdQyX3UeFrf+OR+1a251q/OOa0RtunYb+Bug7iPcXmwoGQmDM P+Cg== X-Gm-Message-State: AOJu0YzFPeJgRJpuighXRjxgNIGQ9DFTGNbpZMcWNNqOkxvsP6DbwE9N GYzhHcuFw24OdDcitqtzNGhuqZuu/716wjQU7A/CfGDJIiML7R4mWMwcVCzRiXBV47DnIo6Lfle xXBrDwV6X4QQF5dLBRL+E/iNfrD0vLgT4/RXnUk8QTqY7czJMLBX7GqRlasc4K+mxd2OsGNfRgH QVqno77ASEVTZMIHO4ZNyzS0nwPUsXxw== X-Received: by 2002:a7b:c458:0:b0:424:a655:c8b with SMTP id 5b1f17b1804b1-4257a010ab5mr58862765e9.19.1719929311402; Tue, 02 Jul 2024 07:08:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH8VuEGxyfX1E4eygZUT+D6B9/QgjkiBFNHFLZX/IlHRAeYyEiWkuA+aZweZmup7TL3k3Q7Hw== X-Received: by 2002:a7b:c458:0:b0:424:a655:c8b with SMTP id 5b1f17b1804b1-4257a010ab5mr58862525e9.19.1719929310849; Tue, 02 Jul 2024 07:08:30 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0d9b12sm13309086f8f.44.2024.07.02.07.08.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:08:30 -0700 (PDT) Date: Tue, 2 Jul 2024 10:08:28 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Fan Ni , Svetly Todorov , Gregory Price , Jonathan Cameron Subject: [PULL 29/91] hw/mem/cxl_type3: Allow to release extent superset in QMP interface 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Fan Ni Before the change, the QMP interface used for add/release DC extents only allows to release an extent whose DPA range is contained by a single accepted extent in the device. With the change, we relax the constraints. As long as the DPA range of the extent is covered by accepted extents, we allow the release. Tested-by: Svetly Todorov Reviewed-by: Gregory Price Reviewed-by: Jonathan Cameron Signed-off-by: Fan Ni Message-Id: <20240523174651.1089554-15-nifan.cxl@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/mem/cxl_type3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index 0d18259ec0..5d4a1276be 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -1947,7 +1947,7 @@ static void qmp_cxl_process_dynamic_capacity_prescriptive(const char *path, "cannot release extent with pending DPA range"); return; } - if (!cxl_extents_contains_dpa_range(&dcd->dc.extents, dpa, len)) { + if (!ct3_test_region_block_backed(dcd, dpa, len)) { error_setg(errp, "cannot release extent with non-existing DPA range"); return; From patchwork Tue Jul 2 14:08:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719805 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 552CEC3064D for ; Tue, 2 Jul 2024 14:26:44 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeDN-0004ir-QL; Tue, 02 Jul 2024 10:10: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 1sOeDG-0004Mn-7T for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10: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 1sOeDC-0000Jo-K1 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929425; 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=6YLYsco4l6cXmk5+8G0baLpqo+8dcgJ41Mj5z/Hl5Ws=; b=c2xzpyurY54HCj6ARL5SuZ+++OTW4GBXRELy659EP8sxuHeEE+rFsVA+FYCpvDDi/M/oU7 AlSIOuez7FIXIT/0hL44W7K9DZbx51Yd62BlDRAM8Lbai5Afeg9KG5XR6EF8KCINoXS8H5 3PNNVSg+lS/j4VMMK+wEgvONbPZIwCU= 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-99-3uKccF8lO5C0uZAauP3ZDg-1; Tue, 02 Jul 2024 10:08:39 -0400 X-MC-Unique: 3uKccF8lO5C0uZAauP3ZDg-1 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-52ce04ea31cso4691753e87.0 for ; Tue, 02 Jul 2024 07:08:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929315; x=1720534115; 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=6YLYsco4l6cXmk5+8G0baLpqo+8dcgJ41Mj5z/Hl5Ws=; b=iTi+lHAtmq7yiVqirwnVZSL4tA4S3Gkp/HncfotPhG5QgQX0XZbPw+tNB7VzMv3/Yc e0Z0B5tNPl3eoAZ0Yufbcgkad6MQiOMHlnLhw8LActjS+wWJkDX62xvBN5qEYWNwbLC7 Hu5LF6SLPv9IHh3Qri3ykK97ur6WMUIVeSreCOIjf/6CCwNxvsvMigL52xM8h/rJugSR MXEAexzblwhcxVN3NMeKYGB7HMWU/UTzA/MGDAgaK10Akq3T6WdczCXle3/9OwqNwyd6 AqmfjR0Yu798E89MGCYZJkCsr5dLU8+n/yoamOvMZDJdVLhvYvJr3VoCMvidza8HT4rv ovTg== X-Gm-Message-State: AOJu0Yw5nOMPmRhh/09AXilpTQsNvVsTEbgpqQSD0k2annktlmobXAOM LeB7r+7meacAkRResjONs5sURBCtcvBT5oOUM3K5RvI9RvVRGCJ4uEzyAR0tcqkCdeyOAZdT23J Q0MCrwyT+L0KIF03ismtwiRk14Qz0khhSNHbotJKC+kaG6SdgS1R2UBlPVEGIHq8fEH8FJCCkrd 2GSBWa9HsrBy9TCG6eu5zalWIzSF65Sg== X-Received: by 2002:ac2:4c41:0:b0:52b:bee3:dcc6 with SMTP id 2adb3069b0e04-52e826fa995mr6662895e87.51.1719929315200; Tue, 02 Jul 2024 07:08:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEbwFH33b1Jsqc9w+2I6kpCa3jZj1Z9oJetUyEKCoxMqIZPTzpSBHgco37mFr97NKoCtIobHg== X-Received: by 2002:ac2:4c41:0:b0:52b:bee3:dcc6 with SMTP id 2adb3069b0e04-52e826fa995mr6662836e87.51.1719929313657; Tue, 02 Jul 2024 07:08:33 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0d9b12sm13309194f8f.44.2024.07.02.07.08.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:08:33 -0700 (PDT) Date: Tue, 2 Jul 2024 10:08:31 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Thomas =?utf-8?q?Wei=C3=9Fschu?= =?utf-8?q?h?= , Cornelia Huck , Paolo Bonzini , kvm@vger.kernel.org Subject: [PULL 30/91] linux-headers: update to 6.10-rc1 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Thomas Weißschuh Signed-off-by: Thomas Weißschuh Message-Id: <20240527-pvpanic-shutdown-v8-2-5a28ec02558b@t-8ch.de> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/standard-headers/linux/ethtool.h | 55 ++++++++ include/standard-headers/linux/pci_regs.h | 6 + include/standard-headers/linux/virtio_bt.h | 1 - include/standard-headers/linux/virtio_mem.h | 2 + include/standard-headers/linux/virtio_net.h | 143 ++++++++++++++++++++ include/standard-headers/misc/pvpanic.h | 7 +- linux-headers/asm-generic/unistd.h | 5 +- linux-headers/asm-mips/unistd_n32.h | 1 + linux-headers/asm-mips/unistd_n64.h | 1 + linux-headers/asm-mips/unistd_o32.h | 1 + linux-headers/asm-powerpc/unistd_32.h | 1 + linux-headers/asm-powerpc/unistd_64.h | 1 + linux-headers/asm-s390/unistd_32.h | 1 + linux-headers/asm-s390/unistd_64.h | 1 + linux-headers/asm-x86/unistd_32.h | 1 + linux-headers/asm-x86/unistd_64.h | 1 + linux-headers/asm-x86/unistd_x32.h | 2 + linux-headers/linux/kvm.h | 4 +- linux-headers/linux/stddef.h | 8 ++ 19 files changed, 236 insertions(+), 6 deletions(-) diff --git a/include/standard-headers/linux/ethtool.h b/include/standard-headers/linux/ethtool.h index 01503784d2..b0b4b68410 100644 --- a/include/standard-headers/linux/ethtool.h +++ b/include/standard-headers/linux/ethtool.h @@ -752,6 +752,61 @@ enum ethtool_module_power_mode { ETHTOOL_MODULE_POWER_MODE_HIGH, }; +/** + * enum ethtool_pse_types - Types of PSE controller. + * @ETHTOOL_PSE_UNKNOWN: Type of PSE controller is unknown + * @ETHTOOL_PSE_PODL: PSE controller which support PoDL + * @ETHTOOL_PSE_C33: PSE controller which support Clause 33 (PoE) + */ +enum ethtool_pse_types { + ETHTOOL_PSE_UNKNOWN = 1 << 0, + ETHTOOL_PSE_PODL = 1 << 1, + ETHTOOL_PSE_C33 = 1 << 2, +}; + +/** + * enum ethtool_c33_pse_admin_state - operational state of the PoDL PSE + * functions. IEEE 802.3-2022 30.9.1.1.2 aPSEAdminState + * @ETHTOOL_C33_PSE_ADMIN_STATE_UNKNOWN: state of PSE functions is unknown + * @ETHTOOL_C33_PSE_ADMIN_STATE_DISABLED: PSE functions are disabled + * @ETHTOOL_C33_PSE_ADMIN_STATE_ENABLED: PSE functions are enabled + */ +enum ethtool_c33_pse_admin_state { + ETHTOOL_C33_PSE_ADMIN_STATE_UNKNOWN = 1, + ETHTOOL_C33_PSE_ADMIN_STATE_DISABLED, + ETHTOOL_C33_PSE_ADMIN_STATE_ENABLED, +}; + +/** + * enum ethtool_c33_pse_pw_d_status - power detection status of the PSE. + * IEEE 802.3-2022 30.9.1.1.3 aPoDLPSEPowerDetectionStatus: + * @ETHTOOL_C33_PSE_PW_D_STATUS_UNKNOWN: PSE status is unknown + * @ETHTOOL_C33_PSE_PW_D_STATUS_DISABLED: The enumeration "disabled" + * indicates that the PSE State diagram is in the state DISABLED. + * @ETHTOOL_C33_PSE_PW_D_STATUS_SEARCHING: The enumeration "searching" + * indicates the PSE State diagram is in a state other than those + * listed. + * @ETHTOOL_C33_PSE_PW_D_STATUS_DELIVERING: The enumeration + * "deliveringPower" indicates that the PSE State diagram is in the + * state POWER_ON. + * @ETHTOOL_C33_PSE_PW_D_STATUS_TEST: The enumeration "test" indicates that + * the PSE State diagram is in the state TEST_MODE. + * @ETHTOOL_C33_PSE_PW_D_STATUS_FAULT: The enumeration "fault" indicates that + * the PSE State diagram is in the state TEST_ERROR. + * @ETHTOOL_C33_PSE_PW_D_STATUS_OTHERFAULT: The enumeration "otherFault" + * indicates that the PSE State diagram is in the state IDLE due to + * the variable error_condition = true. + */ +enum ethtool_c33_pse_pw_d_status { + ETHTOOL_C33_PSE_PW_D_STATUS_UNKNOWN = 1, + ETHTOOL_C33_PSE_PW_D_STATUS_DISABLED, + ETHTOOL_C33_PSE_PW_D_STATUS_SEARCHING, + ETHTOOL_C33_PSE_PW_D_STATUS_DELIVERING, + ETHTOOL_C33_PSE_PW_D_STATUS_TEST, + ETHTOOL_C33_PSE_PW_D_STATUS_FAULT, + ETHTOOL_C33_PSE_PW_D_STATUS_OTHERFAULT, +}; + /** * enum ethtool_podl_pse_admin_state - operational state of the PoDL PSE * functions. IEEE 802.3-2018 30.15.1.1.2 aPoDLPSEAdminState diff --git a/include/standard-headers/linux/pci_regs.h b/include/standard-headers/linux/pci_regs.h index a39193213f..94c00996e6 100644 --- a/include/standard-headers/linux/pci_regs.h +++ b/include/standard-headers/linux/pci_regs.h @@ -1144,8 +1144,14 @@ #define PCI_DOE_DATA_OBJECT_HEADER_2_LENGTH 0x0003ffff #define PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDEX 0x000000ff +#define PCI_DOE_DATA_OBJECT_DISC_REQ_3_VER 0x0000ff00 #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_VID 0x0000ffff #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_PROTOCOL 0x00ff0000 #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_NEXT_INDEX 0xff000000 +/* Compute Express Link (CXL r3.1, sec 8.1.5) */ +#define PCI_DVSEC_CXL_PORT 3 +#define PCI_DVSEC_CXL_PORT_CTL 0x0c +#define PCI_DVSEC_CXL_PORT_CTL_UNMASK_SBR 0x00000001 + #endif /* LINUX_PCI_REGS_H */ diff --git a/include/standard-headers/linux/virtio_bt.h b/include/standard-headers/linux/virtio_bt.h index a11ecc3f92..6f0dee7e32 100644 --- a/include/standard-headers/linux/virtio_bt.h +++ b/include/standard-headers/linux/virtio_bt.h @@ -13,7 +13,6 @@ enum virtio_bt_config_type { VIRTIO_BT_CONFIG_TYPE_PRIMARY = 0, - VIRTIO_BT_CONFIG_TYPE_AMP = 1, }; enum virtio_bt_config_vendor { diff --git a/include/standard-headers/linux/virtio_mem.h b/include/standard-headers/linux/virtio_mem.h index 18c74c527c..6bfa41bd8b 100644 --- a/include/standard-headers/linux/virtio_mem.h +++ b/include/standard-headers/linux/virtio_mem.h @@ -90,6 +90,8 @@ #define VIRTIO_MEM_F_ACPI_PXM 0 /* unplugged memory must not be accessed */ #define VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE 1 +/* plugged memory will remain plugged when suspending+resuming */ +#define VIRTIO_MEM_F_PERSISTENT_SUSPEND 2 /* --- virtio-mem: guest -> host requests --- */ diff --git a/include/standard-headers/linux/virtio_net.h b/include/standard-headers/linux/virtio_net.h index 0f88417742..fc594fe5fc 100644 --- a/include/standard-headers/linux/virtio_net.h +++ b/include/standard-headers/linux/virtio_net.h @@ -56,6 +56,7 @@ #define VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow * Steering */ #define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */ +#define VIRTIO_NET_F_DEVICE_STATS 50 /* Device can provide device-level statistics. */ #define VIRTIO_NET_F_VQ_NOTF_COAL 52 /* Device supports virtqueue notification coalescing */ #define VIRTIO_NET_F_NOTF_COAL 53 /* Device supports notifications coalescing */ #define VIRTIO_NET_F_GUEST_USO4 54 /* Guest can handle USOv4 in. */ @@ -406,4 +407,146 @@ struct virtio_net_ctrl_coal_vq { struct virtio_net_ctrl_coal coal; }; +/* + * Device Statistics + */ +#define VIRTIO_NET_CTRL_STATS 8 +#define VIRTIO_NET_CTRL_STATS_QUERY 0 +#define VIRTIO_NET_CTRL_STATS_GET 1 + +struct virtio_net_stats_capabilities { + +#define VIRTIO_NET_STATS_TYPE_CVQ (1ULL << 32) + +#define VIRTIO_NET_STATS_TYPE_RX_BASIC (1ULL << 0) +#define VIRTIO_NET_STATS_TYPE_RX_CSUM (1ULL << 1) +#define VIRTIO_NET_STATS_TYPE_RX_GSO (1ULL << 2) +#define VIRTIO_NET_STATS_TYPE_RX_SPEED (1ULL << 3) + +#define VIRTIO_NET_STATS_TYPE_TX_BASIC (1ULL << 16) +#define VIRTIO_NET_STATS_TYPE_TX_CSUM (1ULL << 17) +#define VIRTIO_NET_STATS_TYPE_TX_GSO (1ULL << 18) +#define VIRTIO_NET_STATS_TYPE_TX_SPEED (1ULL << 19) + + uint64_t supported_stats_types[1]; +}; + +struct virtio_net_ctrl_queue_stats { + struct { + uint16_t vq_index; + uint16_t reserved[3]; + uint64_t types_bitmap[1]; + } stats[1]; +}; + +struct virtio_net_stats_reply_hdr { +#define VIRTIO_NET_STATS_TYPE_REPLY_CVQ 32 + +#define VIRTIO_NET_STATS_TYPE_REPLY_RX_BASIC 0 +#define VIRTIO_NET_STATS_TYPE_REPLY_RX_CSUM 1 +#define VIRTIO_NET_STATS_TYPE_REPLY_RX_GSO 2 +#define VIRTIO_NET_STATS_TYPE_REPLY_RX_SPEED 3 + +#define VIRTIO_NET_STATS_TYPE_REPLY_TX_BASIC 16 +#define VIRTIO_NET_STATS_TYPE_REPLY_TX_CSUM 17 +#define VIRTIO_NET_STATS_TYPE_REPLY_TX_GSO 18 +#define VIRTIO_NET_STATS_TYPE_REPLY_TX_SPEED 19 + uint8_t type; + uint8_t reserved; + uint16_t vq_index; + uint16_t reserved1; + uint16_t size; +}; + +struct virtio_net_stats_cvq { + struct virtio_net_stats_reply_hdr hdr; + + uint64_t command_num; + uint64_t ok_num; +}; + +struct virtio_net_stats_rx_basic { + struct virtio_net_stats_reply_hdr hdr; + + uint64_t rx_notifications; + + uint64_t rx_packets; + uint64_t rx_bytes; + + uint64_t rx_interrupts; + + uint64_t rx_drops; + uint64_t rx_drop_overruns; +}; + +struct virtio_net_stats_tx_basic { + struct virtio_net_stats_reply_hdr hdr; + + uint64_t tx_notifications; + + uint64_t tx_packets; + uint64_t tx_bytes; + + uint64_t tx_interrupts; + + uint64_t tx_drops; + uint64_t tx_drop_malformed; +}; + +struct virtio_net_stats_rx_csum { + struct virtio_net_stats_reply_hdr hdr; + + uint64_t rx_csum_valid; + uint64_t rx_needs_csum; + uint64_t rx_csum_none; + uint64_t rx_csum_bad; +}; + +struct virtio_net_stats_tx_csum { + struct virtio_net_stats_reply_hdr hdr; + + uint64_t tx_csum_none; + uint64_t tx_needs_csum; +}; + +struct virtio_net_stats_rx_gso { + struct virtio_net_stats_reply_hdr hdr; + + uint64_t rx_gso_packets; + uint64_t rx_gso_bytes; + uint64_t rx_gso_packets_coalesced; + uint64_t rx_gso_bytes_coalesced; +}; + +struct virtio_net_stats_tx_gso { + struct virtio_net_stats_reply_hdr hdr; + + uint64_t tx_gso_packets; + uint64_t tx_gso_bytes; + uint64_t tx_gso_segments; + uint64_t tx_gso_segments_bytes; + uint64_t tx_gso_packets_noseg; + uint64_t tx_gso_bytes_noseg; +}; + +struct virtio_net_stats_rx_speed { + struct virtio_net_stats_reply_hdr hdr; + + /* rx_{packets,bytes}_allowance_exceeded are too long. So rename to + * short name. + */ + uint64_t rx_ratelimit_packets; + uint64_t rx_ratelimit_bytes; +}; + +struct virtio_net_stats_tx_speed { + struct virtio_net_stats_reply_hdr hdr; + + /* tx_{packets,bytes}_allowance_exceeded are too long. So rename to + * short name. + */ + uint64_t tx_ratelimit_packets; + uint64_t tx_ratelimit_bytes; +}; + #endif /* _LINUX_VIRTIO_NET_H */ diff --git a/include/standard-headers/misc/pvpanic.h b/include/standard-headers/misc/pvpanic.h index 54b7485390..b115094431 100644 --- a/include/standard-headers/misc/pvpanic.h +++ b/include/standard-headers/misc/pvpanic.h @@ -3,7 +3,10 @@ #ifndef __PVPANIC_H__ #define __PVPANIC_H__ -#define PVPANIC_PANICKED (1 << 0) -#define PVPANIC_CRASH_LOADED (1 << 1) +#include "standard-headers/linux/const.h" + +#define PVPANIC_PANICKED _BITUL(0) +#define PVPANIC_CRASH_LOADED _BITUL(1) +#define PVPANIC_SHUTDOWN _BITUL(2) #endif /* __PVPANIC_H__ */ diff --git a/linux-headers/asm-generic/unistd.h b/linux-headers/asm-generic/unistd.h index 75f00965ab..d983c48a3b 100644 --- a/linux-headers/asm-generic/unistd.h +++ b/linux-headers/asm-generic/unistd.h @@ -842,8 +842,11 @@ __SYSCALL(__NR_lsm_set_self_attr, sys_lsm_set_self_attr) #define __NR_lsm_list_modules 461 __SYSCALL(__NR_lsm_list_modules, sys_lsm_list_modules) +#define __NR_mseal 462 +__SYSCALL(__NR_mseal, sys_mseal) + #undef __NR_syscalls -#define __NR_syscalls 462 +#define __NR_syscalls 463 /* * 32 bit systems traditionally used different diff --git a/linux-headers/asm-mips/unistd_n32.h b/linux-headers/asm-mips/unistd_n32.h index ce2e050a9b..fc93b3be30 100644 --- a/linux-headers/asm-mips/unistd_n32.h +++ b/linux-headers/asm-mips/unistd_n32.h @@ -390,5 +390,6 @@ #define __NR_lsm_get_self_attr (__NR_Linux + 459) #define __NR_lsm_set_self_attr (__NR_Linux + 460) #define __NR_lsm_list_modules (__NR_Linux + 461) +#define __NR_mseal (__NR_Linux + 462) #endif /* _ASM_UNISTD_N32_H */ diff --git a/linux-headers/asm-mips/unistd_n64.h b/linux-headers/asm-mips/unistd_n64.h index 5bfb3733ff..e72a3eb2c9 100644 --- a/linux-headers/asm-mips/unistd_n64.h +++ b/linux-headers/asm-mips/unistd_n64.h @@ -366,5 +366,6 @@ #define __NR_lsm_get_self_attr (__NR_Linux + 459) #define __NR_lsm_set_self_attr (__NR_Linux + 460) #define __NR_lsm_list_modules (__NR_Linux + 461) +#define __NR_mseal (__NR_Linux + 462) #endif /* _ASM_UNISTD_N64_H */ diff --git a/linux-headers/asm-mips/unistd_o32.h b/linux-headers/asm-mips/unistd_o32.h index 02eaecd020..b86eb0786c 100644 --- a/linux-headers/asm-mips/unistd_o32.h +++ b/linux-headers/asm-mips/unistd_o32.h @@ -436,5 +436,6 @@ #define __NR_lsm_get_self_attr (__NR_Linux + 459) #define __NR_lsm_set_self_attr (__NR_Linux + 460) #define __NR_lsm_list_modules (__NR_Linux + 461) +#define __NR_mseal (__NR_Linux + 462) #endif /* _ASM_UNISTD_O32_H */ diff --git a/linux-headers/asm-powerpc/unistd_32.h b/linux-headers/asm-powerpc/unistd_32.h index bbab08d6ec..28627b6546 100644 --- a/linux-headers/asm-powerpc/unistd_32.h +++ b/linux-headers/asm-powerpc/unistd_32.h @@ -443,6 +443,7 @@ #define __NR_lsm_get_self_attr 459 #define __NR_lsm_set_self_attr 460 #define __NR_lsm_list_modules 461 +#define __NR_mseal 462 #endif /* _ASM_UNISTD_32_H */ diff --git a/linux-headers/asm-powerpc/unistd_64.h b/linux-headers/asm-powerpc/unistd_64.h index af34cde70f..1fc42a8300 100644 --- a/linux-headers/asm-powerpc/unistd_64.h +++ b/linux-headers/asm-powerpc/unistd_64.h @@ -415,6 +415,7 @@ #define __NR_lsm_get_self_attr 459 #define __NR_lsm_set_self_attr 460 #define __NR_lsm_list_modules 461 +#define __NR_mseal 462 #endif /* _ASM_UNISTD_64_H */ diff --git a/linux-headers/asm-s390/unistd_32.h b/linux-headers/asm-s390/unistd_32.h index a3ece69d82..7706c21b87 100644 --- a/linux-headers/asm-s390/unistd_32.h +++ b/linux-headers/asm-s390/unistd_32.h @@ -434,5 +434,6 @@ #define __NR_lsm_get_self_attr 459 #define __NR_lsm_set_self_attr 460 #define __NR_lsm_list_modules 461 +#define __NR_mseal 462 #endif /* _ASM_S390_UNISTD_32_H */ diff --git a/linux-headers/asm-s390/unistd_64.h b/linux-headers/asm-s390/unistd_64.h index 8c5fd93495..62082d592d 100644 --- a/linux-headers/asm-s390/unistd_64.h +++ b/linux-headers/asm-s390/unistd_64.h @@ -382,5 +382,6 @@ #define __NR_lsm_get_self_attr 459 #define __NR_lsm_set_self_attr 460 #define __NR_lsm_list_modules 461 +#define __NR_mseal 462 #endif /* _ASM_S390_UNISTD_64_H */ diff --git a/linux-headers/asm-x86/unistd_32.h b/linux-headers/asm-x86/unistd_32.h index 5c9c329e93..fb7b8b169b 100644 --- a/linux-headers/asm-x86/unistd_32.h +++ b/linux-headers/asm-x86/unistd_32.h @@ -452,6 +452,7 @@ #define __NR_lsm_get_self_attr 459 #define __NR_lsm_set_self_attr 460 #define __NR_lsm_list_modules 461 +#define __NR_mseal 462 #endif /* _ASM_UNISTD_32_H */ diff --git a/linux-headers/asm-x86/unistd_64.h b/linux-headers/asm-x86/unistd_64.h index d9aab7ae87..da439afee1 100644 --- a/linux-headers/asm-x86/unistd_64.h +++ b/linux-headers/asm-x86/unistd_64.h @@ -374,6 +374,7 @@ #define __NR_lsm_get_self_attr 459 #define __NR_lsm_set_self_attr 460 #define __NR_lsm_list_modules 461 +#define __NR_mseal 462 #endif /* _ASM_UNISTD_64_H */ diff --git a/linux-headers/asm-x86/unistd_x32.h b/linux-headers/asm-x86/unistd_x32.h index 63cdd1ee43..4fcb607c72 100644 --- a/linux-headers/asm-x86/unistd_x32.h +++ b/linux-headers/asm-x86/unistd_x32.h @@ -318,6 +318,7 @@ #define __NR_set_mempolicy_home_node (__X32_SYSCALL_BIT + 450) #define __NR_cachestat (__X32_SYSCALL_BIT + 451) #define __NR_fchmodat2 (__X32_SYSCALL_BIT + 452) +#define __NR_map_shadow_stack (__X32_SYSCALL_BIT + 453) #define __NR_futex_wake (__X32_SYSCALL_BIT + 454) #define __NR_futex_wait (__X32_SYSCALL_BIT + 455) #define __NR_futex_requeue (__X32_SYSCALL_BIT + 456) @@ -326,6 +327,7 @@ #define __NR_lsm_get_self_attr (__X32_SYSCALL_BIT + 459) #define __NR_lsm_set_self_attr (__X32_SYSCALL_BIT + 460) #define __NR_lsm_list_modules (__X32_SYSCALL_BIT + 461) +#define __NR_mseal (__X32_SYSCALL_BIT + 462) #define __NR_rt_sigaction (__X32_SYSCALL_BIT + 512) #define __NR_rt_sigreturn (__X32_SYSCALL_BIT + 513) #define __NR_ioctl (__X32_SYSCALL_BIT + 514) diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h index 038731cdef..c93876ca0b 100644 --- a/linux-headers/linux/kvm.h +++ b/linux-headers/linux/kvm.h @@ -1217,9 +1217,9 @@ struct kvm_vfio_spapr_tce { /* Available with KVM_CAP_SPAPR_RESIZE_HPT */ #define KVM_PPC_RESIZE_HPT_PREPARE _IOR(KVMIO, 0xad, struct kvm_ppc_resize_hpt) #define KVM_PPC_RESIZE_HPT_COMMIT _IOR(KVMIO, 0xae, struct kvm_ppc_resize_hpt) -/* Available with KVM_CAP_PPC_RADIX_MMU or KVM_CAP_PPC_HASH_MMU_V3 */ +/* Available with KVM_CAP_PPC_MMU_RADIX or KVM_CAP_PPC_MMU_HASH_V3 */ #define KVM_PPC_CONFIGURE_V3_MMU _IOW(KVMIO, 0xaf, struct kvm_ppc_mmuv3_cfg) -/* Available with KVM_CAP_PPC_RADIX_MMU */ +/* Available with KVM_CAP_PPC_MMU_RADIX */ #define KVM_PPC_GET_RMMU_INFO _IOW(KVMIO, 0xb0, struct kvm_ppc_rmmu_info) /* Available with KVM_CAP_PPC_GET_CPU_CHAR */ #define KVM_PPC_GET_CPU_CHAR _IOR(KVMIO, 0xb1, struct kvm_ppc_cpu_char) diff --git a/linux-headers/linux/stddef.h b/linux-headers/linux/stddef.h index bf9749dd14..96aa341942 100644 --- a/linux-headers/linux/stddef.h +++ b/linux-headers/linux/stddef.h @@ -55,4 +55,12 @@ #define __counted_by(m) #endif +#ifndef __counted_by_le +#define __counted_by_le(m) +#endif + +#ifndef __counted_by_be +#define __counted_by_be(m) +#endif + #endif /* _LINUX_STDDEF_H */ From patchwork Tue Jul 2 14:08:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719736 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 10B62C3064D for ; Tue, 2 Jul 2024 14:12:20 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCB-00067N-7o; Tue, 02 Jul 2024 10:09: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 1sOeBn-0005Lj-Vg for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09: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 1sOeBZ-0008DW-7m for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929321; 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=j+up8MRKOgqTt/+B4PZNRXPDsgBlrNg7Q1TqZFnoDR0=; b=PUpYj2fhYx7NYY9itseC0fcrvYl7tGfdy6MTIt3ZRRDbmMVl14THjputCqnW7pRLV3hQeR VH56615nYzStmPM3cGLuOcmOmfCVZ2f175opUImV74/xniqDsOqjcpBQYDjyXlzgyMjCoM asO3KZoXzamr8Jozl3v1Drdf4l1rDWI= 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-73-pG6lwUWYMcuUg6cjIT-d_Q-1; Tue, 02 Jul 2024 10:08:40 -0400 X-MC-Unique: pG6lwUWYMcuUg6cjIT-d_Q-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-425739141c2so27411325e9.2 for ; Tue, 02 Jul 2024 07:08:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929317; x=1720534117; 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=j+up8MRKOgqTt/+B4PZNRXPDsgBlrNg7Q1TqZFnoDR0=; b=UfUDyDknLbZ6rmQTcA9MiVb8fRwZsVGn00Wh8ktSyJiAG12Rm+9slZtb9q4xS+0qIS pLKouJ98GO7mPbeY97gEk5TDCgO1DJy1Xn1QClQFkxCVTNwmQ/thSDYG39hqOTCYNHwm I+ADphpblm7IREip8LJgMvXfGbZ/pbyNdn5twykx708cqjVaNj4jbLgWb5S7ol3Q9DTB 75W0JsxqMtq/TK7M/KbjlRrS0ADDD4VoyWeRyt9gU5BaJiel1eOBZdG4ZTSNPad+Uv0K 0eDEPNkaJQXS+4vnKfJ9jmvbn72OUjU/TjGFTrQUXAxe7U4yYs/7hIqJuYHtkmepL5ao krCw== X-Gm-Message-State: AOJu0Yz3Rq3cOw1/HQV9uORuzEPxvTP6FlHkZ7fn0mIvLBjh5Hij9RTR 3sevHVWXcNaD8A56GNTZSPSb1Hb0CfN1tt7y0AHdnMIVJ/5LuGHKfte3kZ/cAUL96I0FqY6FXFb AtqYTpeze7y0l8wj9393ykFaVJdkBf/w6IOxh6f0rAzgXtEBIR4ERPR0uePGlU5zxW5pddM1k6C VUIivyVZuCtCich9Iw7ztZyyySSgdjrg== X-Received: by 2002:a05:600c:47d0:b0:425:7884:6b29 with SMTP id 5b1f17b1804b1-4257a03c070mr67701985e9.19.1719929317537; Tue, 02 Jul 2024 07:08:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHykH9+3shuMGW7806/cP9OPUCs9v8PTveOribz6PfGjmeEaQjWhAeNiK0O85WI2quMZoFjhA== X-Received: by 2002:a05:600c:47d0:b0:425:7884:6b29 with SMTP id 5b1f17b1804b1-4257a03c070mr67701645e9.19.1719929316976; Tue, 02 Jul 2024 07:08:36 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b09a32asm201996655e9.31.2024.07.02.07.08.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:08:36 -0700 (PDT) Date: Tue, 2 Jul 2024 10:08:34 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Thomas =?utf-8?q?Wei=C3=9Fschu?= =?utf-8?q?h?= , Thomas Huth , Cornelia Huck , Paolo Bonzini , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Anthony PERARD , Richard Henderson Subject: [PULL 31/91] hw/misc/pvpanic: centralize definition of supported events Message-ID: <9b13640da3f94c0fbacbae6d23bd91febfa44588.1719929191.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: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Thomas Weißschuh The different components of pvpanic duplicate the list of supported events. Move it to the shared header file to minimize changes when new events are added. MST: tweak: keep header included in pvpanic.c to avoid header dependency, rebase. Reviewed-by: Thomas Huth Reviewed-by: Cornelia Huck Signed-off-by: Thomas Weißschuh Message-Id: <20240527-pvpanic-shutdown-v8-3-5a28ec02558b@t-8ch.de> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/misc/pvpanic.h | 4 ++++ hw/misc/pvpanic-isa.c | 3 +-- hw/misc/pvpanic-pci.c | 2 +- hw/misc/pvpanic.c | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/hw/misc/pvpanic.h b/include/hw/misc/pvpanic.h index fab94165d0..1e5b20e4ed 100644 --- a/include/hw/misc/pvpanic.h +++ b/include/hw/misc/pvpanic.h @@ -18,6 +18,10 @@ #include "exec/memory.h" #include "qom/object.h" +#include "standard-headers/misc/pvpanic.h" + +#define PVPANIC_EVENTS (PVPANIC_PANICKED | PVPANIC_CRASH_LOADED) + #define TYPE_PVPANIC_ISA_DEVICE "pvpanic" #define TYPE_PVPANIC_PCI_DEVICE "pvpanic-pci" diff --git a/hw/misc/pvpanic-isa.c b/hw/misc/pvpanic-isa.c index b4f84c4110..9a923b7869 100644 --- a/hw/misc/pvpanic-isa.c +++ b/hw/misc/pvpanic-isa.c @@ -21,7 +21,6 @@ #include "hw/misc/pvpanic.h" #include "qom/object.h" #include "hw/isa/isa.h" -#include "standard-headers/misc/pvpanic.h" #include "hw/acpi/acpi_aml_interface.h" OBJECT_DECLARE_SIMPLE_TYPE(PVPanicISAState, PVPANIC_ISA_DEVICE) @@ -102,7 +101,7 @@ static void build_pvpanic_isa_aml(AcpiDevAmlIf *adev, Aml *scope) static Property pvpanic_isa_properties[] = { DEFINE_PROP_UINT16(PVPANIC_IOPORT_PROP, PVPanicISAState, ioport, 0x505), DEFINE_PROP_UINT8("events", PVPanicISAState, pvpanic.events, - PVPANIC_PANICKED | PVPANIC_CRASH_LOADED), + PVPANIC_EVENTS), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/misc/pvpanic-pci.c b/hw/misc/pvpanic-pci.c index 4d44a881da..106d03ccd6 100644 --- a/hw/misc/pvpanic-pci.c +++ b/hw/misc/pvpanic-pci.c @@ -55,7 +55,7 @@ static void pvpanic_pci_realizefn(PCIDevice *dev, Error **errp) static Property pvpanic_pci_properties[] = { DEFINE_PROP_UINT8("events", PVPanicPCIState, pvpanic.events, - PVPANIC_PANICKED | PVPANIC_CRASH_LOADED), + PVPANIC_EVENTS), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c index 80289ecf5f..4b2307d2c2 100644 --- a/hw/misc/pvpanic.c +++ b/hw/misc/pvpanic.c @@ -27,7 +27,7 @@ static void handle_event(int event) { static bool logged; - if (event & ~(PVPANIC_PANICKED | PVPANIC_CRASH_LOADED) && !logged) { + if (event & ~PVPANIC_EVENTS && !logged) { qemu_log_mask(LOG_GUEST_ERROR, "pvpanic: unknown event %#x.\n", event); logged = true; } From patchwork Tue Jul 2 14:08:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719735 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 85BF3C3064D for ; Tue, 2 Jul 2024 14:12:12 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeBf-00055j-Kc; Tue, 02 Jul 2024 10:08:52 -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 1sOeBd-00052G-P9 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:50 -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 1sOeBa-0008E3-KE for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929324; 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=3+zh1wfaSmmaGh+SRQcFGybC5BaSt211Udvwvhl5h14=; b=PluSL00/gLzNWD9tsLBh7dmEMqixlPcd8twL9SKBXeODiH3ewBsUGHgnwc/s89d1KM/hGS 74tE8bKAIol3qWz/rCgg0Z8cXxf/HIH60nVL5NpG8ms128CC9bW9OU6nDIx6BzWahwDZdo AbjOBJABsebT5C5MpGYTimGiSXgyTHs= 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-495-m_7bE9mqOPyzFPvkHrswqA-1; Tue, 02 Jul 2024 10:08:42 -0400 X-MC-Unique: m_7bE9mqOPyzFPvkHrswqA-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-363edcf12a3so2708920f8f.3 for ; Tue, 02 Jul 2024 07:08:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929320; x=1720534120; 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=3+zh1wfaSmmaGh+SRQcFGybC5BaSt211Udvwvhl5h14=; b=MXbirWJYONReoCX64TjEJ+8FkY00AdE2z/jxC5EaqWA2lhMRBb3qpD0PFdaBSNPGvl S7wTVwPo5V5BTcIsU33fyN6RcHfjt2UJSv61yQ2s83NOlovyErNn3IUissrHP0tWmd43 TLfeABq+wefimeS4gKVddyKUDCtDNTNVINK6TwgDOZV8bRUtJ/dVL7EjXQqRLzu/2Eg8 eCT11QDZq3hpvwEQVvTjpzlUw73T+IfDJ6IDPohFekf+QeVBuIJEmp56OXLzQTUvcOJC cV9kbxWoZsxH3AS2EaY825NHHNQVT0yJFFW4t3MeJqCaObUvEMFpxiyBgRJ4U1jFcdvU E3GA== X-Gm-Message-State: AOJu0YwK4FAfDXSx7Gx5EtUZQ/sZX2edeEVBJTMdOsJUs7+BtE5zuFgf 6GABd3lMZ0vIwSn54A1ewTT8EtbRMs/3dK6yIFbfcxp+zVTU6tXDwYZKSkAJWnzrGczz41bThFu ENn441ZULQKrrTBuFKDRTIWeWd1fR2Dna62zDIzkvMhlbegMMv7r+7J6A2zxn2Ha8IvFmY/qL5O 1BGEW/EojJdV5Ydnjx5xSt+D8je4Wz9Q== X-Received: by 2002:a05:6000:18ab:b0:363:69dd:ac3a with SMTP id ffacd0b85a97d-367756decc7mr6509253f8f.42.1719929320384; Tue, 02 Jul 2024 07:08:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEmKdL5bbkTE4feBAsbAL+yjsWCYxU9rIuuygPgjDJhdpvKrPtPSX8Y3IlPRyodvzDF6hXF/Q== X-Received: by 2002:a05:6000:18ab:b0:363:69dd:ac3a with SMTP id ffacd0b85a97d-367756decc7mr6509225f8f.42.1719929319866; Tue, 02 Jul 2024 07:08:39 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a103d62sm13290326f8f.105.2024.07.02.07.08.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:08:39 -0700 (PDT) Date: Tue, 2 Jul 2024 10:08:37 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Thomas =?utf-8?q?Wei=C3=9Fschu?= =?utf-8?q?h?= , Thomas Huth , Cornelia Huck , Laurent Vivier , Paolo Bonzini Subject: [PULL 32/91] tests/qtest/pvpanic: use centralized definition of supported events Message-ID: <462dc749c110fe8e41ae0fb554b9bc2f2671e973.1719929191.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Thomas Weißschuh Avoid the necessity to update all tests when new events are added to the device. Acked-by: Thomas Huth Reviewed-by: Cornelia Huck Signed-off-by: Thomas Weißschuh Message-Id: <20240527-pvpanic-shutdown-v8-4-5a28ec02558b@t-8ch.de> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/pvpanic-pci-test.c | 5 +++-- tests/qtest/pvpanic-test.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/qtest/pvpanic-pci-test.c b/tests/qtest/pvpanic-pci-test.c index 2c05b376ba..b372caf41d 100644 --- a/tests/qtest/pvpanic-pci-test.c +++ b/tests/qtest/pvpanic-pci-test.c @@ -16,6 +16,7 @@ #include "qapi/qmp/qdict.h" #include "libqos/pci.h" #include "libqos/pci-pc.h" +#include "hw/misc/pvpanic.h" #include "hw/pci/pci_regs.h" static void test_panic_nopause(void) @@ -34,7 +35,7 @@ static void test_panic_nopause(void) bar = qpci_iomap(dev, 0, NULL); qpci_memread(dev, bar, 0, &val, sizeof(val)); - g_assert_cmpuint(val, ==, 3); + g_assert_cmpuint(val, ==, PVPANIC_EVENTS); val = 1; qpci_memwrite(dev, bar, 0, &val, sizeof(val)); @@ -67,7 +68,7 @@ static void test_panic(void) bar = qpci_iomap(dev, 0, NULL); qpci_memread(dev, bar, 0, &val, sizeof(val)); - g_assert_cmpuint(val, ==, 3); + g_assert_cmpuint(val, ==, PVPANIC_EVENTS); val = 1; qpci_memwrite(dev, bar, 0, &val, sizeof(val)); diff --git a/tests/qtest/pvpanic-test.c b/tests/qtest/pvpanic-test.c index 78f1cf8186..ccc603472f 100644 --- a/tests/qtest/pvpanic-test.c +++ b/tests/qtest/pvpanic-test.c @@ -10,6 +10,7 @@ #include "qemu/osdep.h" #include "libqtest.h" #include "qapi/qmp/qdict.h" +#include "hw/misc/pvpanic.h" static void test_panic_nopause(void) { @@ -20,7 +21,7 @@ static void test_panic_nopause(void) qts = qtest_init("-device pvpanic -action panic=none"); val = qtest_inb(qts, 0x505); - g_assert_cmpuint(val, ==, 3); + g_assert_cmpuint(val, ==, PVPANIC_EVENTS); qtest_outb(qts, 0x505, 0x1); @@ -43,7 +44,7 @@ static void test_panic(void) qts = qtest_init("-device pvpanic -action panic=pause"); val = qtest_inb(qts, 0x505); - g_assert_cmpuint(val, ==, 3); + g_assert_cmpuint(val, ==, PVPANIC_EVENTS); qtest_outb(qts, 0x505, 0x1); From patchwork Tue Jul 2 14:08:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719756 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 825C6C3064D for ; Tue, 2 Jul 2024 14:14:42 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeBh-000575-EI; Tue, 02 Jul 2024 10:08: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 1sOeBf-00055D-8l for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:51 -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 1sOeBc-0008EQ-Tg for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:08:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929327; 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=kZkfnrsmrcpCA4paPRwjE2CzS2LM1h/03EC8/LUs/AI=; b=WZXMuYhBkGT3sbkZJvMXyGkT9tjDo9r0BwZL1nOwxO5ylAkLOu43ZATtopLNZFN0B08BZS du+0O0Tut+fsU2q0RnBfGyHEyNY2sOViv8Uv5KlbMHfKrpoNgp+8a2AkjXznWD7xhYQbc/ 0pjXk22N4FWpjRyzQbBijPaHaCmPt2A= 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-250-TNUpZdfsP4-TlMjRcVicoA-1; Tue, 02 Jul 2024 10:08:44 -0400 X-MC-Unique: TNUpZdfsP4-TlMjRcVicoA-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4256667ebf9so29778225e9.1 for ; Tue, 02 Jul 2024 07:08:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929323; x=1720534123; 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=kZkfnrsmrcpCA4paPRwjE2CzS2LM1h/03EC8/LUs/AI=; b=RhkXxDxfxwZ4CecIR7rqZowaS3VeZoWieKY/zFo762cdmbz4UDiW1alc3hS7Xv5F5j DNX4HrZWbYbH50whVO8TS+2Dizej5/3ji49/GJQZV/3N2vkWy4X1kLYUHRw2quEgBH6q LC6fZHPhs0REgff4ycFoRIe+YyNowiy63LLq7Q+DUlZ0JF6vwt8D4J+mr8HDVm3W9s92 tuLvhpev0/u2jp+q6AYKAq75hbYKwByDcGEuGWG2xzysEnmnsBnEJEZAnXGmgRb06SzW R9JNhwoH/OM51/2p4jc2CRUgGXFg2rN4/HQpxfsNTxUBLzuyK47XC9Om60uQKKT2ty8K wQwg== X-Gm-Message-State: AOJu0Yy/qx/kRvDKlbQdKZyMygUwmrAcdkw7SXLNNMRlZKiThI463mop sir8WuIHNSX3Y+ZNN1xXmKOvu3LAvRXSbzyH3Xj0LWRXmGN4TsSU8sMthL93CaHOjiaKPQVhVX/ J7DuqR2xwqgFiQIrGPZzBHUWhdstnvqbU6E1g6EZCaVIdQV0tKEBWQafLXz2FEQqGefxdsys39V hOAQq7VNfl9tvydrUIKpv+y9QggcjGZA== X-Received: by 2002:a05:600c:480f:b0:425:7ca2:68bc with SMTP id 5b1f17b1804b1-4257ca26afamr61510435e9.34.1719929323129; Tue, 02 Jul 2024 07:08:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFwEwdqqCIGB/U31YgBC3pW0iSqSJSSCcieC0L/ueIKRAE23+V08HPF1gLd8tQ065sP4jEahg== X-Received: by 2002:a05:600c:480f:b0:425:7ca2:68bc with SMTP id 5b1f17b1804b1-4257ca26afamr61510085e9.34.1719929322460; Tue, 02 Jul 2024 07:08:42 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0d8df0sm13422689f8f.29.2024.07.02.07.08.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:08:42 -0700 (PDT) Date: Tue, 2 Jul 2024 10:08:40 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Thomas =?utf-8?q?Wei=C3=9Fschu?= =?utf-8?q?h?= , Cornelia Huck , Paolo Bonzini Subject: [PULL 33/91] hw/misc/pvpanic: add support for normal shutdowns Message-ID: <6269086b0179e3d70750672174ed7fbd29ac7eaa.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Thomas Weißschuh Shutdown requests are normally hardware dependent. By extending pvpanic to also handle shutdown requests, guests can submit such requests with an easily implementable and cross-platform mechanism. Acked-by: Cornelia Huck Signed-off-by: Thomas Weißschuh Message-Id: <20240527-pvpanic-shutdown-v8-5-5a28ec02558b@t-8ch.de> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/misc/pvpanic.h | 4 +++- include/sysemu/runstate.h | 1 + hw/misc/pvpanic.c | 5 +++++ system/runstate.c | 5 +++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/hw/misc/pvpanic.h b/include/hw/misc/pvpanic.h index 1e5b20e4ed..9a71a5ad0d 100644 --- a/include/hw/misc/pvpanic.h +++ b/include/hw/misc/pvpanic.h @@ -20,7 +20,9 @@ #include "standard-headers/misc/pvpanic.h" -#define PVPANIC_EVENTS (PVPANIC_PANICKED | PVPANIC_CRASH_LOADED) +#define PVPANIC_EVENTS (PVPANIC_PANICKED | \ + PVPANIC_CRASH_LOADED | \ + PVPANIC_SHUTDOWN) #define TYPE_PVPANIC_ISA_DEVICE "pvpanic" #define TYPE_PVPANIC_PCI_DEVICE "pvpanic-pci" diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h index 0117d243c4..e210a37abf 100644 --- a/include/sysemu/runstate.h +++ b/include/sysemu/runstate.h @@ -104,6 +104,7 @@ void qemu_system_killed(int signal, pid_t pid); void qemu_system_reset(ShutdownCause reason); void qemu_system_guest_panicked(GuestPanicInformation *info); void qemu_system_guest_crashloaded(GuestPanicInformation *info); +void qemu_system_guest_pvshutdown(void); bool qemu_system_dump_in_progress(void); #endif diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c index 4b2307d2c2..3b893340c0 100644 --- a/hw/misc/pvpanic.c +++ b/hw/misc/pvpanic.c @@ -41,6 +41,11 @@ static void handle_event(int event) qemu_system_guest_crashloaded(NULL); return; } + + if (event & PVPANIC_SHUTDOWN) { + qemu_system_guest_pvshutdown(); + return; + } } /* return supported events on read */ diff --git a/system/runstate.c b/system/runstate.c index ec32e270cb..fc49fd3e61 100644 --- a/system/runstate.c +++ b/system/runstate.c @@ -584,6 +584,11 @@ void qemu_system_guest_crashloaded(GuestPanicInformation *info) qapi_free_GuestPanicInformation(info); } +void qemu_system_guest_pvshutdown(void) +{ + qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN); +} + void qemu_system_reset_request(ShutdownCause reason) { if (reboot_action == REBOOT_ACTION_SHUTDOWN && From patchwork Tue Jul 2 14:08:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719793 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8310DC3064D for ; Tue, 2 Jul 2024 14:22:35 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCL-0007NH-2i; Tue, 02 Jul 2024 10:09: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 1sOeBu-0005Tf-5T for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:06 -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 1sOeBi-0008F3-1Z for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929329; 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=YhLUD4bgFXykNLby5YqUbG3vAr/0cDl4XOSKHnOq4eQ=; b=SWNkcraKwU+33j8Fgk90fQ1vdE7xjwVKNwuqn4TIaDBeLLLFrIjw4folk3SDHnnGcgRzTQ /R3eiFUab5jhuoqIFbKl4Jhvdu97mt14LZO3v52qES2IEwH3iP5cF5TWEJnkAlVMYP82Ba Vt0Pp0Wj91PrSBM+YjKtQACh6SdIDJc= 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-434-xFZh1DHaNxec_NAuDZacHQ-1; Tue, 02 Jul 2024 10:08:47 -0400 X-MC-Unique: xFZh1DHaNxec_NAuDZacHQ-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-36248c176c4so2741921f8f.1 for ; Tue, 02 Jul 2024 07:08:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929326; x=1720534126; 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=YhLUD4bgFXykNLby5YqUbG3vAr/0cDl4XOSKHnOq4eQ=; b=F5GsLF8QGVgqUX/z/FTAdu7BR/km9MPJo00M4wNB2CSNwJoCc9da9oBcy1sgJIumDd okBESnRZsoTSPAeJtsxECoNwtG/pdYKc3cIobRJ6TaLZfNYWTBzw/3AlKKQFiGt7EENy sku/ex0mD5YELGrQnyx3r4W1DVSSoVEEINWQlrtvbLTZtycECcN8j1Z4ICZ/5n4jl3pF iRDyhyqckNsyripYYQFWDSKd/AArjb2xvzarLdOcEaiSvDTrw+lZMPIo/mX4hjIcFWTI kT3cET/x4eiFsc7yfgLLqt/v4hulkf93BUsa6VSNA16vezcvtz1uIJSywGkXhispic2s dWag== X-Gm-Message-State: AOJu0YwHlH7W/NjBqpALgGGQ84PpCE6rvja5DPciPsqLZ4wbzXHO0rG7 lDIWO9rCOrGSasvCQGVWkiMROiSdDUuNWVa6LVdmIWt6BRV0hCIBTMVeZ/GjhL0r2lv20QFvGFd 2TVtPPzfVnpgMEolAi0Fhabm1OEBFY51BrNwjAcpjizjEofPJ2pHIJ1Fv6fwTaDfFTzQ3LAhtgx FU+y3Sbu/cSfk/n84443elaU2QoLFNYA== X-Received: by 2002:a05:6000:400d:b0:366:e685:d0cb with SMTP id ffacd0b85a97d-3677569762bmr5969476f8f.6.1719929325921; Tue, 02 Jul 2024 07:08:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFlI1QbSiDmh8c9mM8CHdiAhR8Qlw9actoZSffLipZLpZ5KSZcQDn3VxWE9L5My8VJlIfJPFw== X-Received: by 2002:a05:6000:400d:b0:366:e685:d0cb with SMTP id ffacd0b85a97d-3677569762bmr5969447f8f.6.1719929325317; Tue, 02 Jul 2024 07:08:45 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36789fd7a0esm1532692f8f.104.2024.07.02.07.08.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:08:44 -0700 (PDT) Date: Tue, 2 Jul 2024 10:08:42 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Alejandro Jimenez , Eric Blake , Markus Armbruster , Paolo Bonzini Subject: [PULL 34/91] pvpanic: Emit GUEST_PVSHUTDOWN QMP event on pvpanic shutdown signal Message-ID: <8db1f7be788b23f8eca189fe4546298ed387e9cb.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Alejandro Jimenez Emit a QMP event on receiving a PVPANIC_SHUTDOWN event. Even though a typical SHUTDOWN event will be sent, it will be indistinguishable from a shutdown originating from other cases (e.g. KVM exit due to KVM_SYSTEM_EVENT_SHUTDOWN) that also issue the guest-shutdown cause. A management layer application can detect the new GUEST_PVSHUTDOWN event to determine if the guest is using the pvpanic interface to request shutdowns. Signed-off-by: Alejandro Jimenez Message-Id: <20240527-pvpanic-shutdown-v8-6-5a28ec02558b@t-8ch.de> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- qapi/run-state.json | 14 ++++++++++++++ system/runstate.c | 1 + 2 files changed, 15 insertions(+) diff --git a/qapi/run-state.json b/qapi/run-state.json index f8773f23b2..5ac0fec852 100644 --- a/qapi/run-state.json +++ b/qapi/run-state.json @@ -462,6 +462,20 @@ { 'event': 'GUEST_CRASHLOADED', 'data': { 'action': 'GuestPanicAction', '*info': 'GuestPanicInformation' } } +## +# @GUEST_PVSHUTDOWN: +# +# Emitted when guest submits a shutdown request via pvpanic interface +# +# Since: 9.1 +# +# Example: +# +# <- { "event": "GUEST_PVSHUTDOWN", +# "timestamp": { "seconds": 1648245259, "microseconds": 893771 } } +## +{ 'event': 'GUEST_PVSHUTDOWN' } + ## # @GuestPanicAction: # diff --git a/system/runstate.c b/system/runstate.c index fc49fd3e61..c833316f6d 100644 --- a/system/runstate.c +++ b/system/runstate.c @@ -586,6 +586,7 @@ void qemu_system_guest_crashloaded(GuestPanicInformation *info) void qemu_system_guest_pvshutdown(void) { + qapi_event_send_guest_pvshutdown(); qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN); } From patchwork Tue Jul 2 14:08:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719795 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C572DC30658 for ; Tue, 2 Jul 2024 14:23:48 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCE-0006VM-Mj; Tue, 02 Jul 2024 10:09: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 1sOeBz-0005lg-Dk for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09: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 1sOeBi-0008FK-KY for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929331; 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=qGhmwqguo7pIYQaZC7WOHDuKcF1Cau7swIzTfVk8co4=; b=PBZZMdY0BYeeZY1gWlehomRY9h0rUfr83DId0S9pz8s2fj2cNhQHo6ovqhhgMtCl+rW91q Xdt7IrRyQoSyfKi+UagWIrxDctyHe7petyPJml8bb+eoCCw8m8ZcyD+ACtPV78a7kWePSr GdwCYGrKfmoxeMjoUlwAMT7HcYeKjk0= 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-41-FnxhrcMlMKG-lH96vinZSw-1; Tue, 02 Jul 2024 10:08:50 -0400 X-MC-Unique: FnxhrcMlMKG-lH96vinZSw-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-3678ff75122so9500f8f.0 for ; Tue, 02 Jul 2024 07:08:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929329; x=1720534129; 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=qGhmwqguo7pIYQaZC7WOHDuKcF1Cau7swIzTfVk8co4=; b=jU65TzSTVkd9PEY2IbY7D2YuRw+xOCeDe+B3bNfWtgk8QP2vh7X7y3SicyB6dr2DwD +w8PYJXOoGfpp/hLfqlif+bRRbK2EGB8OE9ajsWwcd+3q/HyNiMrbUbnqOdOAqizDqfi ehtI9rJZ7dwqHRNC/tBY3Bqavh2pE0Aj0GFOzYfgs68IPM4HhKwX1VpqnbwVDrCxBpgE sziycUv2SmdO6H/wLZDutFhLwXLPBAQIZHBkLQ55OJ7wc69ZeekzurAm/Ds/Hf94iXKb bG5OEhGRV3HWGdZNnLRiqUw0f7xq9HbfiF1uKD645lrp0pvERPMcIZR0PO/dyS9HWHfG bI2Q== X-Gm-Message-State: AOJu0YwwD1ozO6dSrfc4qBRzHDX6nJd/HPULIPvNVZlS5CS2PiHZLpTe xjFIoOjKCQxbxooIc+kSy4HLHkkAPl5QatCAjYJGVbY9h+dnWfAmRv7IFMUNVrie2KlGH38LpAl 58716bbIHJe8+i00DBRCfoTuOtisMNVewrqu6ptuKvab31vGFcLE7m3kxfw+CMmMSvcC+/pJxgA jvQ+EQvbeE6yt6F2oK5/EJG1JZKT4S7Q== X-Received: by 2002:adf:e8c9:0:b0:367:8811:5e3c with SMTP id ffacd0b85a97d-36788115f10mr1291206f8f.20.1719929328816; Tue, 02 Jul 2024 07:08:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGdHQHfR1BBbKX7Z8/pliAgvf2nr8yI2EjSUJvUXkTQV3Sssrr5SKo2yq/u0V/3Hzxoy40F7w== X-Received: by 2002:adf:e8c9:0:b0:367:8811:5e3c with SMTP id ffacd0b85a97d-36788115f10mr1291172f8f.20.1719929328215; Tue, 02 Jul 2024 07:08:48 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3678877f19dsm1886874f8f.43.2024.07.02.07.08.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:08:47 -0700 (PDT) Date: Tue, 2 Jul 2024 10:08:45 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Thomas =?utf-8?q?Wei=C3=9Fschu?= =?utf-8?q?h?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PULL 35/91] tests/qtest/pvpanic: add tests for pvshutdown event 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, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Thomas Weißschuh Validate that a shutdown via the pvpanic device emits the correct QMP events. Signed-off-by: Thomas Weißschuh Reviewed-by: Thomas Huth Message-Id: <20240527-pvpanic-shutdown-v8-7-5a28ec02558b@t-8ch.de> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/pvpanic-pci-test.c | 39 ++++++++++++++++++++++++++++++++++ tests/qtest/pvpanic-test.c | 29 +++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/tests/qtest/pvpanic-pci-test.c b/tests/qtest/pvpanic-pci-test.c index b372caf41d..dc021c2fdf 100644 --- a/tests/qtest/pvpanic-pci-test.c +++ b/tests/qtest/pvpanic-pci-test.c @@ -85,11 +85,50 @@ static void test_panic(void) qtest_quit(qts); } +static void test_pvshutdown(void) +{ + uint8_t val; + QDict *response, *data; + QTestState *qts; + QPCIBus *pcibus; + QPCIDevice *dev; + QPCIBar bar; + + qts = qtest_init("-device pvpanic-pci,addr=04.0"); + pcibus = qpci_new_pc(qts, NULL); + dev = qpci_device_find(pcibus, QPCI_DEVFN(0x4, 0x0)); + qpci_device_enable(dev); + bar = qpci_iomap(dev, 0, NULL); + + qpci_memread(dev, bar, 0, &val, sizeof(val)); + g_assert_cmpuint(val, ==, PVPANIC_EVENTS); + + val = PVPANIC_SHUTDOWN; + qpci_memwrite(dev, bar, 0, &val, sizeof(val)); + + response = qtest_qmp_eventwait_ref(qts, "GUEST_PVSHUTDOWN"); + qobject_unref(response); + + response = qtest_qmp_eventwait_ref(qts, "SHUTDOWN"); + g_assert(qdict_haskey(response, "data")); + data = qdict_get_qdict(response, "data"); + g_assert(qdict_haskey(data, "guest")); + g_assert(qdict_get_bool(data, "guest")); + g_assert(qdict_haskey(data, "reason")); + g_assert_cmpstr(qdict_get_str(data, "reason"), ==, "guest-shutdown"); + qobject_unref(response); + + g_free(dev); + qpci_free_pc(pcibus); + qtest_quit(qts); +} + int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); qtest_add_func("/pvpanic-pci/panic", test_panic); qtest_add_func("/pvpanic-pci/panic-nopause", test_panic_nopause); + qtest_add_func("/pvpanic-pci/pvshutdown", test_pvshutdown); return g_test_run(); } diff --git a/tests/qtest/pvpanic-test.c b/tests/qtest/pvpanic-test.c index ccc603472f..d49d2ba931 100644 --- a/tests/qtest/pvpanic-test.c +++ b/tests/qtest/pvpanic-test.c @@ -58,11 +58,40 @@ static void test_panic(void) qtest_quit(qts); } +static void test_pvshutdown(void) +{ + uint8_t val; + QDict *response, *data; + QTestState *qts; + + qts = qtest_init("-device pvpanic"); + + val = qtest_inb(qts, 0x505); + g_assert_cmpuint(val, ==, PVPANIC_EVENTS); + + qtest_outb(qts, 0x505, PVPANIC_SHUTDOWN); + + response = qtest_qmp_eventwait_ref(qts, "GUEST_PVSHUTDOWN"); + qobject_unref(response); + + response = qtest_qmp_eventwait_ref(qts, "SHUTDOWN"); + g_assert(qdict_haskey(response, "data")); + data = qdict_get_qdict(response, "data"); + g_assert(qdict_haskey(data, "guest")); + g_assert(qdict_get_bool(data, "guest")); + g_assert(qdict_haskey(data, "reason")); + g_assert_cmpstr(qdict_get_str(data, "reason"), ==, "guest-shutdown"); + qobject_unref(response); + + qtest_quit(qts); +} + int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); qtest_add_func("/pvpanic/panic", test_panic); qtest_add_func("/pvpanic/panic-nopause", test_panic_nopause); + qtest_add_func("/pvpanic/pvshutdown", test_pvshutdown); return g_test_run(); } From patchwork Tue Jul 2 14:08:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719781 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EF0FDC30658 for ; Tue, 2 Jul 2024 14:20:25 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCD-0006Ie-2l; Tue, 02 Jul 2024 10:09: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 1sOeC1-0005mz-LY for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09: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 1sOeBp-0008GL-ND for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929335; 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=g4UiaVaJHqFRMzcgj8Lsoa2O3CKB9KU5Hs0p0vn09PA=; b=L2QZwgdckfuL4YiVA+uHMpDnu5sjoNXgHtcGe8rR/a2Hj14jCHCPcgCMzxHjv1Bl8ZR/sA huuYhK8fXpxBw5yu+9oiyLsif1DPjlcTFVN2VczmbvugJ+qyelBuzYkPsZGMcvxskQn8mZ d2SkZW9qARsrc9ZyM66G/Oggct3WeJA= 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-375-Z3lPNtdkNJSmjaRw-mX6vg-1; Tue, 02 Jul 2024 10:08:54 -0400 X-MC-Unique: Z3lPNtdkNJSmjaRw-mX6vg-1 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-52cdaae5b3dso4121925e87.1 for ; Tue, 02 Jul 2024 07:08:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929332; x=1720534132; 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=g4UiaVaJHqFRMzcgj8Lsoa2O3CKB9KU5Hs0p0vn09PA=; b=KbEzMeOXUyO0vw7iUSRk1wUnv1fS068oHbpLpfD+aHBIXVjjIAtOB9zn34xtkSMN7H qOVBCFY/SnaKxXrkcOk0TaJXtCU6/R7rqiX25rumdCmkHj0uFnLYgHDVeKF4Hd1+Jbhj z2qzaebGMyt5hS5ZH/7BLHfOXRrjgnzV94zbQqsQ/vYHXEcc4qAEzDi+//Yiv3n4d0ip CMtXE6y0oC4a6NADjyide/CBKzAbGGEYtbbomcKAno9maWTc3y5wyO/e2t7KJ/jrW3Lq ASV/XMQuI09mdd8aS9qWQUeE+5irbbODePOAz/Kxejb93hsRPNOB9lk69B/gB1GhnVw2 JrOA== X-Gm-Message-State: AOJu0YxKLulPqVbpN0GeTGlwZlWKHBDaS1IQxApPAzSDOFPdO966MAD6 Cez0ONcuqjZ7tBrk6rdj07lhoVxra5oUg90QiAW+SUFLusRrcb1EB4dv7p0btGtMREAEYnuHEyJ 9ELDjEQNo6ULT0q2nZH3Av5ArX/EcjBZap7b34v7n8egPk4iUS6GErx/R72PKrQfhp6k6a7zktl jSnMJncjgmV71OGLVYdZfJwJ1nzMnkZw== X-Received: by 2002:a05:6512:acc:b0:52c:e180:4eac with SMTP id 2adb3069b0e04-52e8264bbd4mr6138112e87.9.1719929331771; Tue, 02 Jul 2024 07:08:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHuX90VK8ksXbSxePclulwPa6zXZIh2on3nP5rDXVK+qd4OEkkGV/CINRLPnRVfcg2VU7SIFw== X-Received: by 2002:a05:6512:acc:b0:52c:e180:4eac with SMTP id 2adb3069b0e04-52e8264bbd4mr6138087e87.9.1719929331216; Tue, 02 Jul 2024 07:08:51 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af59732sm200523615e9.11.2024.07.02.07.08.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:08:50 -0700 (PDT) Date: Tue, 2 Jul 2024 10:08:48 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Thomas =?utf-8?q?Wei=C3=9Fschu?= =?utf-8?q?h?= , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= Subject: [PULL 36/91] Revert "docs/specs/pvpanic: mark shutdown event as not implemented" Message-ID: <0c0cc13d319cf7b876f327fa1c5cc1866ad868cc.1719929191.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Thomas Weißschuh The missing functionality has been implemented now. This reverts commit e739d1935c461d0668057e9dbba9d06f728d29ec. Signed-off-by: Thomas Weißschuh Message-Id: <20240527-pvpanic-shutdown-v8-8-5a28ec02558b@t-8ch.de> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- docs/specs/pvpanic.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/specs/pvpanic.rst b/docs/specs/pvpanic.rst index b0f27860ec..61a80480ed 100644 --- a/docs/specs/pvpanic.rst +++ b/docs/specs/pvpanic.rst @@ -29,7 +29,7 @@ bit 1 a guest panic has happened and will be handled by the guest; the host should record it or report it, but should not affect the execution of the guest. -bit 2 (to be implemented) +bit 2 a regular guest shutdown has happened and should be processed by the host PCI Interface From patchwork Tue Jul 2 14:08:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719839 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 75A26C30658 for ; Tue, 2 Jul 2024 14:27:10 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCH-0006t7-GI; Tue, 02 Jul 2024 10:09:29 -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 1sOeBz-0005lf-D1 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:13 -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 1sOeBn-0008HF-2w for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929337; 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=PMqT3UA862JsOGcigX9iEr1iG7UpaUmQpd1D/p7t/1Y=; b=W7ibxmugXVzJAcWIPDaeM/t5YWaYG9oUrfWuqxMBQd4IZQ9vbQ4m10/klFFGXAaYVlvuX/ AocKvlhtxY4iXshonEp/hTISvJN62MoH9BDEV1CTDFHPamLq160fXH7gFdIOPlw9yn65wM OuCmFGFHxacylIphIJGJx1bZ7Bb7gvs= 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-572-GcTU_QiQMn6R0DxDfx49BQ-1; Tue, 02 Jul 2024 10:08:55 -0400 X-MC-Unique: GcTU_QiQMn6R0DxDfx49BQ-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-36740a84ad8so3692937f8f.0 for ; Tue, 02 Jul 2024 07:08:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929334; x=1720534134; 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=PMqT3UA862JsOGcigX9iEr1iG7UpaUmQpd1D/p7t/1Y=; b=JlvFtzTPgJrzqcrgJsmd3WGQDG9X86R/PYirCZjjotgWS0NSPeMQs3s8y234v0KH4T xrVJ+wON4xgXyJH5FWnVAiTrJSlPZ6VaidZ66FO23M4Fp1qL+HBQVTiab4BLSjeXXWOL nORmHfyFmntf4iKGu4KyH9Xc5rchLyMX/QlvBq29scULGFzfvR10JIpfe96uSke7/HYZ gn5SaS10/yo+/dMkm1q651odrDt1fjtA3z84yZVo6XblCCHaNPKk8fPfewiyVmA94gVc uSvHeplfHkEVIOose1MGGJRvoaa3ALsmRFwUUkF+EOPvXPBs/TZUkwrr0kIwv30Ir4It TWnQ== X-Gm-Message-State: AOJu0YzDiNVMuOHtKCCE0SahmxU2NF1MYRBXA+SzSHQQ40r//CG1Mf1X pTIsfeiR/mLfUZn/tbv3KMYgOv9zW08Xh4yxlAZLg8LWEfCqS7+xHo3bjldAcu00cog8zhJ2uqL JDhLd1Afcmf8olLnUgZYBbQNQIjDOO3XYQJCvFkDj4FmCeJpcEmuXPgOei7DY7cXrz3tYJ9y7xe I+vBWP3g1Hsd2Fp44oD+Pki7rGAjGedA== X-Received: by 2002:a5d:4812:0:b0:366:ddb6:a067 with SMTP id ffacd0b85a97d-367756a92efmr7199706f8f.20.1719929334536; Tue, 02 Jul 2024 07:08:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhfQgZ1HD53Tukhpl5XcGNnRmDkFpjkxtjI1d2SF07ww3vJyqLanxE0YBJo9+Q/WyID6CdUQ== X-Received: by 2002:a5d:4812:0:b0:366:ddb6:a067 with SMTP id ffacd0b85a97d-367756a92efmr7199673f8f.20.1719929334038; Tue, 02 Jul 2024 07:08:54 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a10307bsm13320562f8f.94.2024.07.02.07.08.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:08:53 -0700 (PDT) Date: Tue, 2 Jul 2024 10:08:51 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Cindy Lu , qemu-stable@nongnu.org Subject: [PULL 37/91] virtio-pci: Fix the failure process in kvm_virtio_pci_vector_use_one() 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Cindy Lu In function kvm_virtio_pci_vector_use_one(), the function will only use the irqfd/vector for itself. Therefore, in the undo label, the failing process is incorrect. To fix this, we can just remove this label. Fixes: f9a09ca3ea ("vhost: add support for configure interrupt") Cc: qemu-stable@nongnu.org Signed-off-by: Cindy Lu Message-Id: <20240528084840.194538-1-lulu@redhat.com> Reviewed-by: Peter Maydell Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-pci.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 7d62e92365..5941f1a94d 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -898,7 +898,7 @@ static int kvm_virtio_pci_vector_use_one(VirtIOPCIProxy *proxy, int queue_no) } ret = kvm_virtio_pci_vq_vector_use(proxy, vector); if (ret < 0) { - goto undo; + return ret; } /* * If guest supports masking, set up irqfd now. @@ -908,25 +908,11 @@ static int kvm_virtio_pci_vector_use_one(VirtIOPCIProxy *proxy, int queue_no) ret = kvm_virtio_pci_irqfd_use(proxy, n, vector); if (ret < 0) { kvm_virtio_pci_vq_vector_release(proxy, vector); - goto undo; + return ret; } } return 0; -undo: - - vector = virtio_queue_vector(vdev, queue_no); - if (vector >= msix_nr_vectors_allocated(dev)) { - return ret; - } - if (vdev->use_guest_notifier_mask && k->guest_notifier_mask) { - ret = virtio_pci_get_notifier(proxy, queue_no, &n, &vector); - if (ret < 0) { - return ret; - } - kvm_virtio_pci_irqfd_release(proxy, n, vector); - } - return ret; } static int kvm_virtio_pci_vector_vq_use(VirtIOPCIProxy *proxy, int nvqs) { From patchwork Tue Jul 2 14:08:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DF86BC30658 for ; Tue, 2 Jul 2024 14:13:06 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCB-00068F-8T; Tue, 02 Jul 2024 10:09: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 1sOeC1-0005mx-M1 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:15 -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 1sOeBr-0008Hc-60 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929340; 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=3jl4Qu4kLpM2wQ0qiu2Lf05x2qWhSbW1JbTTyjioPSc=; b=frYa4CVFI5fnQlLV2OVw44NuCCoxt7Lt/C9/eobhjkTNtSejViVx1IoWop2xHlTwQqXSY8 2CHHT60p5NtFpmDEtvHW7hNtEckvbtLQiuOjLK3I+A6jm0CY/8d4C2blnuHUJ4umDafQqm 9jpI6Hf8s8q0d/S56TjlxT/ioEA1Z5I= 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-526-mw1746NoN3C7ljilo0PyVw-1; Tue, 02 Jul 2024 10:08:59 -0400 X-MC-Unique: mw1746NoN3C7ljilo0PyVw-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-367380659a3so2470615f8f.2 for ; Tue, 02 Jul 2024 07:08:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929337; x=1720534137; 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=3jl4Qu4kLpM2wQ0qiu2Lf05x2qWhSbW1JbTTyjioPSc=; b=v0vEZ3zU2Y6/N0rHO6B9Kcz/uokWs9JRRatvUU2nR7G8IEUEf0uo7ge3yJWX1I6B4D kq99iJLon1m497olwkeUPJKaI8lnY0whG1+ym5ioVM+ZaR2VT8QpZHX3vCTGkHBZfjRg XLTixjvniMthCphclmc2kbUxYPfdyGtjm7HRpNBP8jtxmWyJhuVaWW/iaZnMOdbLOJji Gi5NdOpDSusFxc2vM5JFS09Uz0L1l/Wjo5Pki8EqsWssR4WV0KjoUKMAQVixZeNvXtar IXqcy6dIcjlKOh5PwX5Z5pmDwz3I9LY+H/BIDxj/3lklwCPYEL2JdlatiDeA6l8/FeBt vh+A== X-Gm-Message-State: AOJu0Yy11SJNtBWvbEQ19709Gj1pJAJI6Jk2joMnjpy9EQjcWsH2LevO bVs6DBk48oEQxGFtkhAbBONRjREbuzr+i6h2KalGQAhQDpOyvpliLZX2jJOOBIh+mevpL4vrIKg GBKn55UxOg2Vw1NtdR9SdFv65fwtWrrMg03N5P+uHODiyqWLpC93IPhwj90Pib3wD5dZ1WbXtzF iYDuH8ZpC25Tex28x+FPo/cHi/aj9w4w== X-Received: by 2002:a5d:5f8e:0:b0:362:3358:48d5 with SMTP id ffacd0b85a97d-3677571ff14mr6915146f8f.47.1719929337667; Tue, 02 Jul 2024 07:08:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHx50W2NcEmwsranAe333pShGJhavD7gnPj7EytvYxmwEaqZznkbekdbl6F/hJQkumxCY9vUQ== X-Received: by 2002:a5d:5f8e:0:b0:362:3358:48d5 with SMTP id ffacd0b85a97d-3677571ff14mr6915116f8f.47.1719929337086; Tue, 02 Jul 2024 07:08:57 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0e1430sm13379560f8f.52.2024.07.02.07.08.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:08:56 -0700 (PDT) Date: Tue, 2 Jul 2024 10:08:54 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Ira Weiny , Jonathan Cameron , Fan Ni Subject: [PULL 38/91] hw/cxl: Fix read from bogus memory 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Ira Weiny Peter and coverity report: We've passed '&data' to address_space_write(), which means "read from the address on the stack where the function argument 'data' lives", so instead of writing 64 bytes of data to the guest , we'll write 64 bytes which start with a host pointer value and then continue with whatever happens to be on the host stack after that. Indeed the intention was to write 64 bytes of data at the address given. Fix the parameter to address_space_write(). Reported-by: Peter Maydell Link: https://lore.kernel.org/all/CAFEAcA-u4sytGwTKsb__Y+_+0O2-WwARntm3x8WNhvL1WfHOBg@mail.gmail.com/ Fixes: 6bda41a69bdc ("hw/cxl: Add clear poison mailbox command support.") Cc: Jonathan Cameron Signed-off-by: Ira Weiny Message-Id: <20240531-fix-poison-set-cacheline-v1-1-e3bc7e8f1158@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Jonathan Cameron --- hw/mem/cxl_type3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index 5d4a1276be..3274e5dcbb 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -1292,7 +1292,7 @@ static bool set_cacheline(CXLType3Dev *ct3d, uint64_t dpa_offset, uint8_t *data) dpa_offset -= (vmr_size + pmr_size); } - address_space_write(as, dpa_offset, MEMTXATTRS_UNSPECIFIED, &data, + address_space_write(as, dpa_offset, MEMTXATTRS_UNSPECIFIED, data, CXL_CACHE_LINE_SIZE); return true; } From patchwork Tue Jul 2 14:08:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719726 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0CA19C3064D for ; Tue, 2 Jul 2024 14:11:41 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCN-0007i9-8P; Tue, 02 Jul 2024 10:09: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 1sOeC4-0005oG-D3 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09: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 1sOeBv-0008IO-Sa for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929345; 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=KfDnOZZL3lNpO7yBVqmvfyK4tBARWzqdyh5lLLcyyUM=; b=E1W/nnz+3kttYcLNF9/yp4nvvqE/HUcUe5h5uEMJGmA3VUxIUNjbrOqiM9xISIppEpLojD O4k1lnhXjtMqC50/bS0g6wI3Zm34jmb92OhBHzk2AEWSU8qVa69yoVsYB4BVGg4/dHX8KV fi8Fxwc6xxwWbq+bve+TPmgfYtMSOgU= 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-346-OhSw-WNBONiO6wG7VEiaQg-1; Tue, 02 Jul 2024 10:09:03 -0400 X-MC-Unique: OhSw-WNBONiO6wG7VEiaQg-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-362a0c1041dso2338960f8f.1 for ; Tue, 02 Jul 2024 07:09:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929340; x=1720534140; 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=KfDnOZZL3lNpO7yBVqmvfyK4tBARWzqdyh5lLLcyyUM=; b=OU6Ge4e4+sUoK3jaYguUD3YxqiTnqkcibALcGawGCNWZJkukwMr2XLkzn73S0vBIuZ lOL56a4flnWT7OD5wMK0M1ubJuNHVr+6iOwfd0q6IsWOj7ar36zioM8tmSzkuUiltgWV aOwckVb6kPegbu/6WbyQjzEcH0wtOzEYtF2VbQwDH+2zpVHfp3O6Z0UBBESrsph+o8do UUtkcmf2n51vSls6uhYK71gqZu0pLlVEtBWt1q/NT2Ax0+Y5PT9P1fjBq1lbgFTFYuDO FxuDbJnBUvpnfR3e2yktUW1Dm0FNcVPWTxS0NJLhn7CVLCF0Ac1Ez2pI0mEYQH/EVwUo C77Q== X-Gm-Message-State: AOJu0YzbPbm0aOMaKuApvlUUkxiT6y6O0KxjKQC58RS2Zk9DvGPbwOoE S+0Px2TXOt48gjvt/T6IKHYk6hIMwWuzh3u1ycdco1K8B8LFGXqhaMzZKXH6o4Q9xJynceGtuQT ges9A0ukPwERc7rO8RhLEaFcwMguBPwFAa9yJYdEqCi0D4H/N/iQtFNwVAo8OpfLZ4lu2jYP4Kd bzQxgT+0QW/QjnRjrB49gAY0rN2KFwCw== X-Received: by 2002:a05:6000:234:b0:362:8749:9639 with SMTP id ffacd0b85a97d-367756bc8demr4859055f8f.35.1719929340618; Tue, 02 Jul 2024 07:09:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGO02rM1hBFYg6EYT/Jdc+yGp4nt4ds6H99z14/p9F8/p0HN6JoytdrYvA8axaGKbuFql8Ang== X-Received: by 2002:a05:6000:234:b0:362:8749:9639 with SMTP id ffacd0b85a97d-367756bc8demr4859028f8f.35.1719929340059; Tue, 02 Jul 2024 07:09:00 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0e12e2sm13311036f8f.50.2024.07.02.07.08.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:08:59 -0700 (PDT) Date: Tue, 2 Jul 2024 10:08:57 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jiqian Chen , Eduardo Habkost , Marcel Apfelbaum , Philippe =?utf-8?q?Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Yanan Wang Subject: [PULL 39/91] virtio-pci: implement No_Soft_Reset bit Message-ID: <5d98e18823af6d5230fca8098a7ee966aaedeb29.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Jiqian Chen In current code, when guest does S3, virtio-gpu are reset due to the bit No_Soft_Reset is not set. After resetting, the display resources of virtio-gpu are destroyed, then the display can't come back and only show blank after resuming. Implement No_Soft_Reset bit of PCI_PM_CTRL register, then guest can check this bit, if this bit is set, the devices resetting will not be done, and then the display can work after resuming. No_Soft_Reset bit is implemented for all virtio devices, and was tested only on virtio-gpu device. Set it false by default for safety. Signed-off-by: Jiqian Chen Message-Id: <20240606102205.114671-3-Jiqian.Chen@amd.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/virtio-pci.h | 5 +++++ hw/core/machine.c | 1 + hw/virtio/virtio-pci.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/include/hw/virtio/virtio-pci.h b/include/hw/virtio/virtio-pci.h index 59d88018c1..9e67ba38c7 100644 --- a/include/hw/virtio/virtio-pci.h +++ b/include/hw/virtio/virtio-pci.h @@ -43,6 +43,7 @@ enum { VIRTIO_PCI_FLAG_INIT_FLR_BIT, VIRTIO_PCI_FLAG_AER_BIT, VIRTIO_PCI_FLAG_ATS_PAGE_ALIGNED_BIT, + VIRTIO_PCI_FLAG_PM_NO_SOFT_RESET_BIT, }; /* Need to activate work-arounds for buggy guests at vmstate load. */ @@ -79,6 +80,10 @@ enum { /* Init Power Management */ #define VIRTIO_PCI_FLAG_INIT_PM (1 << VIRTIO_PCI_FLAG_INIT_PM_BIT) +/* Init The No_Soft_Reset bit of Power Management */ +#define VIRTIO_PCI_FLAG_PM_NO_SOFT_RESET \ + (1 << VIRTIO_PCI_FLAG_PM_NO_SOFT_RESET_BIT) + /* Init Function Level Reset capability */ #define VIRTIO_PCI_FLAG_INIT_FLR (1 << VIRTIO_PCI_FLAG_INIT_FLR_BIT) diff --git a/hw/core/machine.c b/hw/core/machine.c index 655d75c21f..f4cba6496c 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -38,6 +38,7 @@ GlobalProperty hw_compat_9_0[] = { {"arm-cpu", "backcompat-cntfrq", "true" }, {"scsi-disk-base", "migrate-emulated-scsi-request", "false" }, {"vfio-pci", "skip-vsc-check", "false" }, + { "virtio-pci", "x-pcie-pm-no-soft-reset", "off" }, }; const size_t hw_compat_9_0_len = G_N_ELEMENTS(hw_compat_9_0); diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 5941f1a94d..9534730bba 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -2222,6 +2222,11 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp) pcie_cap_lnkctl_init(pci_dev); } + if (proxy->flags & VIRTIO_PCI_FLAG_PM_NO_SOFT_RESET) { + pci_set_word(pci_dev->config + pos + PCI_PM_CTRL, + PCI_PM_CTRL_NO_SOFT_RESET); + } + if (proxy->flags & VIRTIO_PCI_FLAG_INIT_PM) { /* Init Power Management Control Register */ pci_set_word(pci_dev->wmask + pos + PCI_PM_CTRL, @@ -2284,11 +2289,33 @@ static void virtio_pci_reset(DeviceState *qdev) } } +static bool virtio_pci_no_soft_reset(PCIDevice *dev) +{ + uint16_t pmcsr; + + if (!pci_is_express(dev) || !dev->exp.pm_cap) { + return false; + } + + pmcsr = pci_get_word(dev->config + dev->exp.pm_cap + PCI_PM_CTRL); + + /* + * When No_Soft_Reset bit is set and the device + * is in D3hot state, don't reset device + */ + return (pmcsr & PCI_PM_CTRL_NO_SOFT_RESET) && + (pmcsr & PCI_PM_CTRL_STATE_MASK) == 3; +} + static void virtio_pci_bus_reset_hold(Object *obj, ResetType type) { PCIDevice *dev = PCI_DEVICE(obj); DeviceState *qdev = DEVICE(obj); + if (virtio_pci_no_soft_reset(dev)) { + return; + } + virtio_pci_reset(qdev); if (pci_is_express(dev)) { @@ -2328,6 +2355,8 @@ static Property virtio_pci_properties[] = { VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT, true), DEFINE_PROP_BIT("x-pcie-pm-init", VirtIOPCIProxy, flags, VIRTIO_PCI_FLAG_INIT_PM_BIT, true), + DEFINE_PROP_BIT("x-pcie-pm-no-soft-reset", VirtIOPCIProxy, flags, + VIRTIO_PCI_FLAG_PM_NO_SOFT_RESET_BIT, false), DEFINE_PROP_BIT("x-pcie-flr-init", VirtIOPCIProxy, flags, VIRTIO_PCI_FLAG_INIT_FLR_BIT, true), DEFINE_PROP_BIT("aer", VirtIOPCIProxy, flags, From patchwork Tue Jul 2 14:09:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719742 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A9D2BC3065C for ; Tue, 2 Jul 2024 14:13:06 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCI-0006vv-0Q; Tue, 02 Jul 2024 10:09: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 1sOeC3-0005nn-CW for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:16 -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 1sOeBv-0008IT-Sd for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929346; 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=HcSJQ8GU27nlWtSZNyFUAnn1DCnRj6gVV+Uj4seSbXY=; b=hH1UCe65TlUQITJf/ZEKJtCBw9FXm7P9uR/2Jm+z0SCdNeunBl2qLI2/RuxuyqUsbsm4lr Hvk2XL9WGvonUc9CzXGOMzd4Z513bN50EOLJmkHhNEYW+NZc3vZKMLEv537gS1H6WkmWOs eCP1T8H0aCZN2zaWax6fM+Vf/DEsA8k= 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-353-yfzBQWZiPA2HH_j3hSrTNg-1; Tue, 02 Jul 2024 10:09:05 -0400 X-MC-Unique: yfzBQWZiPA2HH_j3hSrTNg-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-364be6c2468so2623145f8f.3 for ; Tue, 02 Jul 2024 07:09:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929343; x=1720534143; 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=HcSJQ8GU27nlWtSZNyFUAnn1DCnRj6gVV+Uj4seSbXY=; b=c+C/HRocXp4IkUnLhypHRT8DnxHH6jLBsbtpf3s4kpeNwUub51iHVs1zFywUWlcvA0 9fBKn8RjJ6CkX8LmOlgnmM2rmMSCiRKD8tPYz+MSSAoCxBQg+sQ1DsfBFoniblaSTmWs 5B1s5dtQO9N2uTcbNdZZG7Xbd/fQiCK2lUq3MmJ/tbTlEczy+n+TzBxpo0JzIVuCvjyx jtzAndkxGNMQRGuQTeK6Q67QWIH5xlUuN9XH14rq1Elz15MIEWPMoBTBhyW1D+gZuNCN rli8r5Bt/XojEEZS7dLp8KVwf146egSwwy35Atw34dSoLMP+2uWDQjQibDqFA9OcKSHV XRYw== X-Gm-Message-State: AOJu0Yy//aSf+rvPZFnTWwq3L3FvyaEkM815Cg+d+1e8jTJ/jGNPAMaO 9S9AMLrvfXNKKXPVEXH1X2q+7cKT4PEHZFocpBeXK/Cs8z8r06FysxmVKE2RCuJSt+HMNRQpAG3 1plhF594MwqBN2U3kyKpUJaYg4lTCgO3o1Ac0OsCS0mRYO4P+Z3xftt8Cl2vB8iOM4BmrSVL+dd QEggBRz3XEyqBxqDy/8i+hKPz1sSacuw== X-Received: by 2002:adf:e38d:0:b0:367:4165:ad4 with SMTP id ffacd0b85a97d-367756ad1d0mr5423025f8f.16.1719929343604; Tue, 02 Jul 2024 07:09:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE/1JOF+EwSHbKGgI79n7mu21RapdB+qLpqFC0t4t2/B9gFRYamEMqEOEfBJOi8tGG79dihHA== X-Received: by 2002:adf:e38d:0:b0:367:4165:ad4 with SMTP id ffacd0b85a97d-367756ad1d0mr5422999f8f.16.1719929342905; Tue, 02 Jul 2024 07:09:02 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3678e06eba4sm899282f8f.90.2024.07.02.07.09.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:09:02 -0700 (PDT) Date: Tue, 2 Jul 2024 10:09:00 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Yuxue Liu , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PULL 40/91] vhost-user-test: don't set call fd -1 non-blocking 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Yuxue Liu In the scenario where vhost-user sets eventfd to -1, qemu_chr_fe_get_msgfds retrieves fd as -1. When vhost_user_read receives, it does not perform blocking operations on the descriptor with fd=-1, so non-blocking operations should not be performed here either. This is a normal use case. Calling g_unix_set_fd_nonblocking at this point will cause the test to fail with an assert. When vhost_user_write sets the call fd to -1, it sets the number of fds to 0, so the fds obtained by qemu_chr_fe_get_msgfds will also be 0. Signed-off-by: Yuxue Liu Message-Id: <20240411073555.1357-1-yuxue.liu@jaguarmicro.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/vhost-user-test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index d4e437265f..255bde54ab 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -458,7 +458,10 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) case VHOST_USER_SET_VRING_KICK: case VHOST_USER_SET_VRING_CALL: /* consume the fd */ - qemu_chr_fe_get_msgfds(chr, &fd, 1); + if (!qemu_chr_fe_get_msgfds(chr, &fd, 1) && fd < 0) { + qos_printf("call fd: %d, do not set non-blocking\n", fd); + break; + } /* * This is a non-blocking eventfd. * The receive function forces it to be blocking, From patchwork Tue Jul 2 14:09:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719740 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 38ADAC30658 for ; Tue, 2 Jul 2024 14:13:01 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCN-0007gJ-2R; Tue, 02 Jul 2024 10:09: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 1sOeCK-0007RP-TT for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09: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 1sOeC0-0008Is-3l for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929350; 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=TisxAqM9JFoRTBzvBR2/yPIkvvWOj6XGjDsm9k9s/20=; b=RGfQvvgmHrfWQPxc53+GV/X9meQCN43c4FI/y1e1cKOxw+920dKLy3kmtfmUeyW02it2BP L8sNNAuCTWTbbnjNwXjP9n8Nd6sPse3mo4PcD6O9YyKPycA1/6YUcEOoQsT3fGiPokoNLf iABwi+y6BslLaX697Q1yqbyTioLXj3Y= 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-208-LtdjTcIgNFWxGcaq5Ux9uw-1; Tue, 02 Jul 2024 10:09:09 -0400 X-MC-Unique: LtdjTcIgNFWxGcaq5Ux9uw-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-424a775ee7fso29863525e9.0 for ; Tue, 02 Jul 2024 07:09:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929347; x=1720534147; 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=TisxAqM9JFoRTBzvBR2/yPIkvvWOj6XGjDsm9k9s/20=; b=V+S4fz5/U7mV/AaZr4QDxyGNE4NZRxLQ1rPpPSbgjt03oUwZFWQfJePbdBznmox4Jr iyJgDeB2WONdRlq3HwJUBdpwD+GCIMKQtMcEN82v7EaURMumFP5XHYi5hRCS941H6oTd jEa2WRG/Vb2nGA9bDc5ENNrLB7PGbUW+YQt4Ie9/AoBhZWU5tf77xj6P8NDFL0ntECwX RuLL3wM2Fskrt42YVQsFAUSdVDOhuWU5Ep7fnsdr/BAn06bDSXZg1dfcATc/UUhXb+j8 vU0UpUFpsIRYMy1GBFFX2YhT5eW7Thrr9GbR6rbBVw2+AMnVztNw9dwl9bimJyQvvgw9 9/lw== X-Gm-Message-State: AOJu0YxZcPMfFu45FEG9VkpH1klWGMjqs8iROXRiCK/gAhUz19//HbFe Q+V6XTM46PNSVA/6HzoMwSs53eNCXZL+qWvDJKBBlCOzRr6f0/vhZjCcMbXsT3fUucuVeGKWhqe J5DNR/Ahyt2Si2mHdXEU/BIeb0xn8SUZWpZr4r0D32/krGMHoZHPLC8+j36ss3u376s3/3qqdJ0 391jqWyhKFqiPzJe/fex8EcIStqoitKQ== X-Received: by 2002:a05:600c:68b:b0:424:a7e7:e443 with SMTP id 5b1f17b1804b1-4257a02b8d2mr60203965e9.12.1719929347571; Tue, 02 Jul 2024 07:09:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFpARjIxgEDOnSoOk/9sIqxKCk+3dibiA8TewD7x6DubYxlnlnJHkFaxZXObdOr8+7P2/ingQ== X-Received: by 2002:a05:600c:68b:b0:424:a7e7:e443 with SMTP id 5b1f17b1804b1-4257a02b8d2mr60203675e9.12.1719929346999; Tue, 02 Jul 2024 07:09:06 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af5b8e2sm199033255e9.16.2024.07.02.07.09.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:09:05 -0700 (PDT) Date: Tue, 2 Jul 2024 10:09:03 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhao Liu , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Paolo Bonzini Subject: [PULL 41/91] i386/apic: Add hint on boot failure because of disabling x2APIC Message-ID: <7801fa5054e0eac7a169b32bf630cb237d2652ec.1719929191.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, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhao Liu Currently, the Q35 supports up to 4096 vCPUs (since v9.0), but for TCG cases, if x2APIC is not actively enabled to boot more than 255 vCPUs ( e.g., qemu-system-i386 -M pc-q35-9.0 -smp 666), the following error is reported: Unexpected error in apic_common_set_id() at ../hw/intc/apic_common.c:449: qemu-system-i386: APIC ID 255 requires x2APIC feature in CPU Aborted (core dumped) This error can be resolved by setting x2apic=on in -cpu. In order to better help users deal with this scenario, add the error hint to instruct users on how to enable the x2apic feature. Then, the error report becomes the following: Unexpected error in apic_common_set_id() at ../hw/intc/apic_common.c:448: qemu-system-i386: APIC ID 255 requires x2APIC feature in CPU Try x2apic=on in -cpu. Aborted (core dumped) Note since @errp is &error_abort, error_append_hint() can't be applied on @errp. And in order to separate the exact error message from the (perhaps effectively) hint, adding a hint via error_append_hint() is also necessary. Therefore, introduce @local_error in apic_common_set_id() to handle both the error message and the error hint. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Zhao Liu Message-Id: <20240606140858.2157106-1-zhao1.liu@intel.com> Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/intc/apic_common.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c index d8fc1e2815..c13cdd7994 100644 --- a/hw/intc/apic_common.c +++ b/hw/intc/apic_common.c @@ -433,6 +433,7 @@ static void apic_common_set_id(Object *obj, Visitor *v, const char *name, APICCommonState *s = APIC_COMMON(obj); DeviceState *dev = DEVICE(obj); uint32_t value; + Error *local_err = NULL; if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); @@ -444,7 +445,11 @@ static void apic_common_set_id(Object *obj, Visitor *v, const char *name, } if (value >= 255 && !cpu_has_x2apic_feature(&s->cpu->env)) { - error_setg(errp, "APIC ID %d requires x2APIC feature in CPU", value); + error_setg(&local_err, + "APIC ID %d requires x2APIC feature in CPU", + value); + error_append_hint(&local_err, "Try x2apic=on in -cpu.\n"); + error_propagate(errp, local_err); return; } From patchwork Tue Jul 2 14:09:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719800 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2AEEDC3064D for ; Tue, 2 Jul 2024 14:25:41 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCO-0007wM-Ug; Tue, 02 Jul 2024 10:09:37 -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 1sOeCG-0006ke-Dw for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:28 -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 1sOeC1-0008JS-Ib for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929352; 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=y6iaejVuyK6cotgddPWIYQA8dIBm4KoXB6zsOD2vQwU=; b=J+S7SgmtQJWd4qMHFANjrby1/ALwbuShzvktBStCBoW/I76WtJ6GzBtxylvZv/wJb1nHiO J1LlY93Vfeecx54YrgmrrmFgDEkAcDVMRTgy6eK++1tW/bNGdogGWxQeamwhdFRUHGEc08 IlzUvnT+LfxsuW5Hh9jm0CWlVnF6sR0= 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-426-R-0IazY5MgKuPUr-5o8noA-1; Tue, 02 Jul 2024 10:09:11 -0400 X-MC-Unique: R-0IazY5MgKuPUr-5o8noA-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-425897358f0so6717715e9.2 for ; Tue, 02 Jul 2024 07:09:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929350; x=1720534150; 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=y6iaejVuyK6cotgddPWIYQA8dIBm4KoXB6zsOD2vQwU=; b=m2reEi/bB47PRfjlZbM/XwLuvLLNiPH8cbS8eqdpuCiO3OSTYjRkBqGnpgjK5SG4HY sGIQ4tualRZXXAqkNkiA+eJcf38Xfbi+fliiHNSzuqZYk9weLUaRYBa/iDkBXObVxAqP wp+8QRFTdzcb7Qym68J736QkHJKJuz5jRISP+bA9TjkdOMLQiJak2l+NQKG7FpKh7V93 htCI64Pa1OOB+2MsqANS34EO899D6n1Bq2Rt6NS/RFK/QhghQ/C2/XOFyUZ7TGlf/m8C pr3yHAtUf6lgXTgA33y+90xm6AJkXMGGx3SwSTrydviIz3Jtc/J1eL3ua6/t5rFdYbwD FS0g== X-Gm-Message-State: AOJu0YymPGLe9b8mneGJ9yRDN7XPYS60tpyUuZckyY+c2osEh4MO5617 t+Wd/O9K6cGStvjcflPbxrApRdMNS0SwbViM4Kv8SmqIkLZsKR+p1KTv2LYo6kJ0zs8rtBs4Db5 L/OhBkEQrVaizBsawI7c1yaD8wJ4zklS90IuNVU2fmt9H3CB1AVjBCV8rRE2G/GfrlCyHe9ylyo agrFuQ/YsqoUnXbOhvpDsYV09dznUEAw== X-Received: by 2002:adf:ea84:0:b0:356:48f5:4383 with SMTP id ffacd0b85a97d-3677572979bmr5367434f8f.61.1719929350138; Tue, 02 Jul 2024 07:09:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFpzMafSGeFZz/jd4b6+Erq9rMCn23IsDQ8j+ILYv5DxSJc8Ds1N2V1VBKsaRZbIz64oLf3Bg== X-Received: by 2002:adf:ea84:0:b0:356:48f5:4383 with SMTP id ffacd0b85a97d-3677572979bmr5367410f8f.61.1719929349536; Tue, 02 Jul 2024 07:09:09 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-367892a4817sm1766231f8f.10.2024.07.02.07.09.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:09:09 -0700 (PDT) Date: Tue, 2 Jul 2024 10:09:07 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Akihiko Odaki , Alex =?utf-8?q?Benn=C3=A9e?= Subject: [PULL 42/91] hw/virtio: Free vqs after vhost_dev_cleanup() Message-ID: <577682151b14ae79560eb709ba06f1bbb7c4a414.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Akihiko Odaki This fixes LeakSanitizer warnings. Signed-off-by: Akihiko Odaki Message-Id: <20240627-san-v2-7-750bb0946dbd@daynix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-user-base.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/virtio/vhost-user-base.c b/hw/virtio/vhost-user-base.c index 11e72b1e3b..2bc3423326 100644 --- a/hw/virtio/vhost-user-base.c +++ b/hw/virtio/vhost-user-base.c @@ -223,6 +223,7 @@ static void vub_disconnect(DeviceState *dev) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VHostUserBase *vub = VHOST_USER_BASE(vdev); + struct vhost_virtqueue *vhost_vqs = vub->vhost_dev.vqs; if (!vub->connected) { goto done; @@ -231,6 +232,7 @@ static void vub_disconnect(DeviceState *dev) vub_stop(vdev); vhost_dev_cleanup(&vub->vhost_dev); + g_free(vhost_vqs); done: /* Re-instate the event handler for new connections */ From patchwork Tue Jul 2 14:09:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719767 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DC341C3064D for ; Tue, 2 Jul 2024 14:18:23 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCa-0000fb-K6; Tue, 02 Jul 2024 10:09:48 -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 1sOeCV-0000Ce-3u for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09: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 1sOeC6-0008Kx-PQ for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929357; 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=f1RnRBcwUZd5byR6UedM+mwZMcF5dchy820Keg4IB1o=; b=EbiJ3FTu6M8+eFTjyy0vVW2KMPwJ2s9JXO4u6G3plwgF/NAgf4t7Q7yvJkblWkU77kErrc /p8KG2oaxiOyHlOR39KrL44wHbcoN+AXpjC3u5fb1X+bg5++WfiRwxPk0U+Sy2JPZmhqjc CmKJoSbqagKcbDiN7wEopRN1NsnCsZc= 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-127-q9NP0rkMNluXhCsn1Dn_nQ-1; Tue, 02 Jul 2024 10:09:14 -0400 X-MC-Unique: q9NP0rkMNluXhCsn1Dn_nQ-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-3678fbf4aa7so48881f8f.2 for ; Tue, 02 Jul 2024 07:09:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929353; x=1720534153; 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=f1RnRBcwUZd5byR6UedM+mwZMcF5dchy820Keg4IB1o=; b=Rin2ojMa4vQsdYBqy0NgaMYJcr4SlXxIxR0UQwuq0aQ3wpK/lpztf7k1nj7uuT6fpE MCssSlOraTfDm9RZ1gQeCB7f+AjKyGutnNNRuaY0rfEExqiC5ovUcAEDEJqOxlZUdBM5 YCEroqd5wYq3IPIEY6w6YaqA1KToRvvby01o0+k8mLWBt5D9hTXlngJG5q8hWTqUhTi7 TBOzYy2putry7zgtToa2SALYysaNuIzrhY96c4zPuNKW8XYCWUzjyf0O1uVgZizpXOU6 ZqPBuTolr7LHYW890+7fsZuQfIOmI8hGEbMS8OhxFXXllq0sMkwef/zsI/PRlhuao78D vwSQ== X-Gm-Message-State: AOJu0Yx+6gLdOqdSfmV5s/d1xARe6I7QNx2x3UtuI0Ksar1gR6Mws6hD Roa/zQ6M4u+iZhj0SWheyme4V2w9ARqkQyTPTyUdCNVc3OVvOCWpjDWODXkDaf8TTHPga/VWhal dDVULop+Qw1BNdO0K0yYH0uYOXnxFe54XrHkz0ng9T+sWac2E7Exsk4OeTGYrNFZAbpUQ2cuvjW 4AAyJh/bDxXe2IVgPij5mxbtIOKL2mdg== X-Received: by 2002:a05:6000:1242:b0:362:8201:fa3 with SMTP id ffacd0b85a97d-367756bb8b5mr5773617f8f.34.1719929353020; Tue, 02 Jul 2024 07:09:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFNOsRMRow1mbeJN1JphwQJP7coOkL8+Xe13B1y5Ll8fccjqMayR9n0bhZDw43Gr2lcC/Rwsw== X-Received: by 2002:a05:6000:1242:b0:362:8201:fa3 with SMTP id ffacd0b85a97d-367756bb8b5mr5773593f8f.34.1719929352484; Tue, 02 Jul 2024 07:09:12 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0d8ed0sm13377356f8f.28.2024.07.02.07.09.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:09:12 -0700 (PDT) Date: Tue, 2 Jul 2024 10:09:09 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Manos Pitsidianakis , Zheyu Ma , Eric Auger Subject: [PULL 43/91] virtio-iommu: add error check before assert 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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Manos Pitsidianakis A fuzzer case discovered by Zheyu Ma causes an assert failure. Add a check before the assert, and respond with an error before moving on to the next queue element. To reproduce the failure: cat << EOF | \ qemu-system-x86_64 \ -display none -machine accel=qtest -m 512M -machine q35 -nodefaults \ -device virtio-iommu -qtest stdio outl 0xcf8 0x80000804 outw 0xcfc 0x06 outl 0xcf8 0x80000820 outl 0xcfc 0xe0004000 write 0x10000e 0x1 0x01 write 0xe0004020 0x4 0x00001000 write 0xe0004028 0x4 0x00101000 write 0xe000401c 0x1 0x01 write 0x106000 0x1 0x05 write 0x100001 0x1 0x60 write 0x100002 0x1 0x10 write 0x100009 0x1 0x04 write 0x10000c 0x1 0x01 write 0x100018 0x1 0x04 write 0x10001c 0x1 0x02 write 0x101003 0x1 0x01 write 0xe0007001 0x1 0x00 EOF Reported-by: Zheyu Ma Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2359 Signed-off-by: Manos Pitsidianakis Message-Id: <20240613-fuzz-2359-fix-v2-manos.pitsidianakis@linaro.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-iommu.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c index b9a7ddcd14..ed7426afc7 100644 --- a/hw/virtio/virtio-iommu.c +++ b/hw/virtio/virtio-iommu.c @@ -974,6 +974,9 @@ static void virtio_iommu_handle_command(VirtIODevice *vdev, VirtQueue *vq) iov = elem->out_sg; sz = iov_to_buf(iov, iov_cnt, 0, &head, sizeof(head)); if (unlikely(sz != sizeof(head))) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: read %zu bytes from command head" + "but expected %zu\n", __func__, sz, sizeof(head)); tail.status = VIRTIO_IOMMU_S_DEVERR; goto out; } @@ -1010,6 +1013,25 @@ static void virtio_iommu_handle_command(VirtIODevice *vdev, VirtQueue *vq) out: sz = iov_from_buf(elem->in_sg, elem->in_num, 0, buf ? buf : &tail, output_size); + if (unlikely(sz != output_size)) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: wrote %zu bytes to command response" + "but response size is %zu\n", + __func__, sz, output_size); + tail.status = VIRTIO_IOMMU_S_DEVERR; + /* + * We checked that sizeof(tail) can fit to elem->in_sg at the + * beginning of the loop + */ + output_size = sizeof(tail); + g_free(buf); + buf = NULL; + sz = iov_from_buf(elem->in_sg, + elem->in_num, + 0, + &tail, + output_size); + } assert(sz == output_size); virtqueue_push(vq, elem, sz); From patchwork Tue Jul 2 14:09:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719746 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8F1F8C3064D for ; Tue, 2 Jul 2024 14:13:13 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCa-0000fg-M8; Tue, 02 Jul 2024 10:09:48 -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 1sOeCS-0008Vr-B1 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:41 -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 1sOeCA-0008Lc-5h for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929361; 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=iKFeowSJAGhilDZfxfLdJ5fHZQGvWfI2BMoyWfTY0Wo=; b=DHK7awJUuTkReY/KFSV08GmDRQMZujf/Jyis2rhp/8aNCON2/nwXy71jpIoMcAyXQo+i5H bPGSHO0PByCoDb9mzdOfGIxq+gxzAaSEMZDx8UFKTAh5R//sFKdLLbdUoTzlVZJvlJDvXO Ek++HYpQUWlymELREBgeEEiYRPG0wKg= 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-232-S6WE9z1OPcWLDDU0trQP2A-1; Tue, 02 Jul 2024 10:09:18 -0400 X-MC-Unique: S6WE9z1OPcWLDDU0trQP2A-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4256809ae27so27882905e9.1 for ; Tue, 02 Jul 2024 07:09:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929356; x=1720534156; 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=iKFeowSJAGhilDZfxfLdJ5fHZQGvWfI2BMoyWfTY0Wo=; b=Cfgivc6UgTHqAXJ2ENaaS3zIaSOQTO+PlhPN3AWwrUbt9R+EkhgKBkk6EPlhf/MqmO uVokh+Qyk2w23Gh7ONSnwbg2u+5AILCpN3Mk58Rk+YaSzR0S9eRaVcgrqPA9+SJookbT 6Lq5qfvVF3sjsczhhoD8lmig9wAEioxFV7Dc90rtyJGS6kyKTsETmXAHg8i/Fe4i8S2o Ow7j+6rkYubqEc5BUNuDKnyWgcOU86JAzGJR3RZnlZF02bR6XUPaiobdPBthqmULZG1U /hPB3HDoiza0noIbNttKhGpC9O+uiV2YFfEOywNHCOYUgGIvMkfHYfefb3EZ9I5lIj+u kCXQ== X-Gm-Message-State: AOJu0Ywx1sCJQ2VU4qgxMPeWCkKQEeIXu5v/KWmT4cO7R0ufA2nyQT+t TdM2IthJW7/FC3vlA8xsxdFs4yaGJvx3Mbpq1tezRiQwW3BNOHG5xemHcRWNf1wsqgAczykHvVI r6Gdix9MMwxdoA2HbVtz/HsnczncYuKdAZeH2pKUOd8EouOr3tFmXqAj7W17lK2i+wGUrTNMb8v bn4WZ8LLphJ1vRqg1WvR8BZ4mxeECJlA== X-Received: by 2002:a05:600c:3089:b0:425:7835:4382 with SMTP id 5b1f17b1804b1-4257a06da46mr69368105e9.34.1719929355854; Tue, 02 Jul 2024 07:09:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYhhUxgOUBoVeoPojhGnoBsde97DcBQEjbJucX4F1iYVRgfogJwjvGPENSsEJ+Wjx7ap5bjQ== X-Received: by 2002:a05:600c:3089:b0:425:7835:4382 with SMTP id 5b1f17b1804b1-4257a06da46mr69367865e9.34.1719929355305; Tue, 02 Jul 2024 07:09:15 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a103371sm13375112f8f.101.2024.07.02.07.09.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:09:14 -0700 (PDT) Date: Tue, 2 Jul 2024 10:09:12 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , BillXiang Subject: [PULL 44/91] vhost-user: Skip unnecessary duplicated VHOST_USER_SET_LOG_BASE requests 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: BillXiang The VHOST_USER_SET_LOG_BASE requests should be categorized into non-vring specific messages, and should be sent only once. If send more than once, dpdk will munmap old log_addr which may has been used and cause segmentation fault. Signed-off-by: BillXiang Message-Id: <20240613065150.3100-1-xiangwencheng@dayudpu.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-user.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index c407ea8939..00561daa06 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -371,6 +371,7 @@ static bool vhost_user_per_device_request(VhostUserRequest request) case VHOST_USER_RESET_DEVICE: case VHOST_USER_ADD_MEM_REG: case VHOST_USER_REM_MEM_REG: + case VHOST_USER_SET_LOG_BASE: return true; default: return false; From patchwork Tue Jul 2 14:09:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719769 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3DD70C3065C for ; Tue, 2 Jul 2024 14:18:24 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCZ-0000WU-8n; Tue, 02 Jul 2024 10:09: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 1sOeCR-0008Ho-4y for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:39 -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 1sOeCB-0008Li-1l for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929362; 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=pgJQy7t094Dms9DBv10pUkz+7onKHwqzjJeEHsSRcQk=; b=b9Jp9lo0hUm++0MuFRzpSoThxRT3VvuxtUSb9sL+bSLKragceM9FT+dvcSrp371Ya8+git 9riNXrJk+LsF0YqS/c6dr6/k+BENyCyUwO8r0hj6UPTzgkvrQYSgDHugAIGgpJSRAdmomW AiG1Msasuh6vH1XjLQUuUhfGxOAbUaU= 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-604-TZL2ob9zNeONuqC2p20Osw-1; Tue, 02 Jul 2024 10:09:20 -0400 X-MC-Unique: TZL2ob9zNeONuqC2p20Osw-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4256569a4faso27263465e9.1 for ; Tue, 02 Jul 2024 07:09:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929358; x=1720534158; 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=pgJQy7t094Dms9DBv10pUkz+7onKHwqzjJeEHsSRcQk=; b=KR/Qjt8xLNJGys1fEb0TepYHZp0NmqAqH7dDHppmjr6E2UUopHUBunX16sZtrRADef Y7agemK80ceMk8rVVVpzwL5c+jxIAUhujSIpSNTMsjfYlC6HtuZ7QbJ8NylH1QIDdFE+ MRrqgVs07wIvVV5jZG7FgbR04cuo9NmArisDYhz1ENu7D/ftExtO4aQWwhHJaaa0XVL1 hq10bemClISBRDDc5cZ2XmSYdQ6T5cWFermywxCP2BVb2tN7FOO8a6pw85Vy/ehhH1JT i58zKZ2/92ZmAKQkFEhp/jx6D6pwuCop7t6MPorkB/Mg/5EqG/YNiuq2bYEcG92Xyrgq +X+w== X-Gm-Message-State: AOJu0YxJcdbl0jtqFFeLHTque/SUBkK6t7qivUNNg0U8py4YNVJOxMIg hYidhKZPObF6N5V48+eCZFVQ4yyvdEWDTrfgcIfgOhlWy7DOkYRr4H0ogGyYkEcTMbYshVKCsOe JP1kzL3sDsy0CYy+To2j3Pj3zB/Pb/iYyFtULkSd35n/pydStsLS4NOtykCl+4u8oROVil5bTBl 8UFNTMalAjVjBrRxwP95ai3M1CoOxNiQ== X-Received: by 2002:a05:600c:4f13:b0:425:6290:b11b with SMTP id 5b1f17b1804b1-4256d58dc93mr107235165e9.18.1719929358538; Tue, 02 Jul 2024 07:09:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFHbFq1qkUi1fZdglcJIPPyGd1pO8r2TtH/fMhcS06wamh8zkt0pz65ViGTQJUh9rWesjxoPg== X-Received: by 2002:a05:600c:4f13:b0:425:6290:b11b with SMTP id 5b1f17b1804b1-4256d58dc93mr107234875e9.18.1719929357982; Tue, 02 Jul 2024 07:09:17 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4257bc89832sm128332435e9.42.2024.07.02.07.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:09:17 -0700 (PDT) Date: Tue, 2 Jul 2024 10:09:15 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Dmitry Frolov , Jason Wang Subject: [PULL 45/91] hw/net/virtio-net.c: fix crash in iov_copy() Message-ID: <7bc77e8972cb30f5278ab1746ea962684b92f4ca.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Dmitry Frolov A crash found while fuzzing device virtio-net-socket-check-used. Assertion "offset == 0" in iov_copy() fails if less than guest_hdr_len bytes were transmited. Signed-off-by: Dmitry Frolov Message-Id: <20240613143529.602591-2-frolov@swemel.ru> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/net/virtio-net.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 9c7e85caea..8f30972708 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -2735,6 +2735,10 @@ static int32_t virtio_net_flush_tx(VirtIONetQueue *q) */ assert(n->host_hdr_len <= n->guest_hdr_len); if (n->host_hdr_len != n->guest_hdr_len) { + if (iov_size(out_sg, out_num) < n->guest_hdr_len) { + virtio_error(vdev, "virtio-net header is invalid"); + goto detach; + } unsigned sg_num = iov_copy(sg, ARRAY_SIZE(sg), out_sg, out_num, 0, n->host_hdr_len); From patchwork Tue Jul 2 14:09:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719719 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 60705C30658 for ; Tue, 2 Jul 2024 14:10:09 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCc-0000uV-4y; Tue, 02 Jul 2024 10:09:50 -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 1sOeCV-0000Cd-3Z for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09: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 1sOeCF-0008Lq-QQ for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929365; 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=UGyASDiFbODYa7hIKIzPzDlV0Bv9TAjx5HfpD5vtANQ=; b=T5GdU7I+E8GLgwAFyb9XIqzWzBZKaHncT7TnVct0QbBWNZj78y1nzdChvTy7VXM/o3XOcz 695ZxNTiFcTKtKceTz+HS0boQZduqFskNZr4VoOFpBib2r3HF31sSv+YfiBukr2yofcG13 acue4bPLjxi2SQXJVJj+j2UV+zxsTbU= 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-678-tLwoAdioO7GXfv1yNxfJWQ-1; Tue, 02 Jul 2024 10:09:24 -0400 X-MC-Unique: tLwoAdioO7GXfv1yNxfJWQ-1 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-52e9345073aso273512e87.3 for ; Tue, 02 Jul 2024 07:09:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929362; x=1720534162; 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=UGyASDiFbODYa7hIKIzPzDlV0Bv9TAjx5HfpD5vtANQ=; b=uYvAGKHCIysHPJpr75DHlwgaM5pKILUgpssHcKc9lWErowDhEmrXq57pm1t8ob3lSG t0GGxU+5okjY73g92tmIgoWtv4rVMaGgM5VhD5IG9Uvu1JmttiYd5oCvXJNNM8tOj7LR GBkVtbqoxcMydpXeamIGHRkque8I9YV7zjuwaozhIexciX65BuHP3/F6YmjCTI8kDYp4 gPassM1nfw4/+DtgYucLGjwSR3t+wtZy0HM+T7Z4Zg9I6qaXSKgmncAukt+NOKDbEJix W31Xd3Xm9nq+xglr+cy9PCg3VzaU5VA5r/9/WGZPALf/kFKFkiYnIQauQg8tWegU+HAP +9Wg== X-Gm-Message-State: AOJu0YzdJ2T821Ym+uUkMiP51NfMrObI19H43sjzdsZMG5nkMsDsJKum IQalrW9wE6xYw7MgYY5PIUnRFjh2AmvDkWEGapaLHo7rUY2tptqXieAWS4d8gjzmMPrZ/rzYUpb MbZI2vch/VTxL9EteSOW5PWmxKovmWvK7DXwuXuIGV5Y8tinFKU9SuZDcO5b96DKD6d4DpljTK3 h0UE0jZjUfEchblUpQUkGrvHZwQK63qg== X-Received: by 2002:a05:6512:ba3:b0:52c:1298:7304 with SMTP id 2adb3069b0e04-52e82661f17mr6206213e87.26.1719929362168; Tue, 02 Jul 2024 07:09:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHuH7WatXxtPZfjW5xJxKrk48fmN4oGK5WxTFxJ6DEO8RZjI2cZLcsdJoubAbV4txUNqXstWw== X-Received: by 2002:a05:6512:ba3:b0:52c:1298:7304 with SMTP id 2adb3069b0e04-52e82661f17mr6206177e87.26.1719929361388; Tue, 02 Jul 2024 07:09:21 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b097bcbsm200181985e9.35.2024.07.02.07.09.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:09:21 -0700 (PDT) Date: Tue, 2 Jul 2024 10:09:18 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefano Garzarella , David Hildenbrand , Markus Armbruster , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Eric Blake , Paolo Bonzini , Daniel =?utf-8?b?UC4gQmVycmFuZ8Op?= , Eduardo Habkost Subject: [PULL 46/91] qapi: clarify that the default is backend dependent Message-ID: <34921eba4321d5a62fcabf1b57c79571cc68ac82.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Stefano Garzarella The default value of the @share option of the @MemoryBackendProperties really depends on the backend type, so let's document the default values in the same place where we define the option to avoid dispersing the information. Cc: David Hildenbrand Suggested-by: Markus Armbruster Reviewed-by: Markus Armbruster Signed-off-by: Stefano Garzarella Message-Id: <20240618100043.144657-2-sgarzare@redhat.com> Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- qapi/qom.json | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/qapi/qom.json b/qapi/qom.json index 8bd299265e..9b8f6a7ab5 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -600,7 +600,9 @@ # preallocation threads (default: none) (since 7.2) # # @share: if false, the memory is private to QEMU; if true, it is -# shared (default: false) +# shared (default false for backends memory-backend-file and +# memory-backend-ram, true for backends memory-backend-epc and +# memory-backend-memfd) # # @reserve: if true, reserve swap space (or huge pages) if applicable # (default: true) (since 6.1) @@ -700,8 +702,6 @@ # # Properties for memory-backend-memfd objects. # -# The @share boolean option is true by default with memfd. -# # @hugetlb: if true, the file to be created resides in the hugetlbfs # filesystem (default: false) # @@ -726,8 +726,6 @@ # # Properties for memory-backend-epc objects. # -# The @share boolean option is true by default with epc -# # The @merge boolean option is false by default with epc # # The @dump boolean option is false by default with epc From patchwork Tue Jul 2 14:09:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719723 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 77B80C3064D for ; Tue, 2 Jul 2024 14:11:35 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCc-0000uA-2G; Tue, 02 Jul 2024 10:09:50 -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 1sOeCV-0000Cf-3Z for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09: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 1sOeCI-0008MY-2H for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929369; 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=9Yh+r83dQTqjKVESuK/txPttml/pXNBlxCl8GGxw4h4=; b=StIVAVb6e95DBzsJ4iIYjxLmVKyxr74KtIsnebjGOIbjgoHSppoQ9xyGefJAa3o+iAHxjV /APMCmF/xCrVTMXPojlvjq3t7D7s3CSShyaeP+tVz8N06eV/JeWGL0ZEdW/v2m/SexDs7x EQIsj+F/MeFjs7JSXVIR7+mBgnXNayo= 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-673-Nz5FI3E2OR-FESRZXlexiA-1; Tue, 02 Jul 2024 10:09:26 -0400 X-MC-Unique: Nz5FI3E2OR-FESRZXlexiA-1 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-52cda76173dso3718661e87.2 for ; Tue, 02 Jul 2024 07:09:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929364; x=1720534164; 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=9Yh+r83dQTqjKVESuK/txPttml/pXNBlxCl8GGxw4h4=; b=tytyxJuIlQFPCzzY1t8rKdnhEOWTE5NatniYNizlEoUqjmzmFvtIYdlEiAQy67xxJv /pHsQ8VHJqOUZJ4Ux0MS1oYxHZ/+hF7XfRS1YcZUr+Gt9Pecw8RfBM7OHn76su9x16/h +FVZ0tfBw/2mQu72c535xdoAee3syIFTJs1k6apuTwnYDnY9W9NEvJAm6EEdV2WLn8lz FM9LcIWzg/1AQyM6ArctNd1FUPLhMfmacndCFnjSs8uW73EiyfrdNZu7lde8y+aZQyJJ sLSvSMgHBh2ACWWgPotaC6pCp9aVeCBz3c0xQb+IV4+C9Jtp+UudlXmw+Aool0Ak+dsX kgNw== X-Gm-Message-State: AOJu0Yy+niL/zT1/s0yKQ2IZf1l3Cb1Ew6v4R1rtrHc8/Jdfr9cm+69y Ab66MXf/joOMKmVhudFcUKUwyIiaK6KbqDjrSORJDC3013NfWHSIvJGKla5VSDSOMAIeIdzEbWB 9K0mcXw6gHwJgotQVYdAwIA/n7Pu6+HlVFtiAMbOXCBN+XkvSqmtkUH2H1SgRPJb8CfXDV2VF6v n294zz721FxRRl2i2MxCiUcSENvtMmRw== X-Received: by 2002:ac2:5487:0:b0:52e:934f:bda5 with SMTP id 2adb3069b0e04-52e934fbdf5mr295007e87.21.1719929364764; Tue, 02 Jul 2024 07:09:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFjLCZB0TTmwTxPaTT7oZELPvIz9ZnN4D8cv5pnsdsIn/4sJ4ao74zoCZstcalRZYnOT6lbnw== X-Received: by 2002:ac2:5487:0:b0:52e:934f:bda5 with SMTP id 2adb3069b0e04-52e934fbdf5mr294980e87.21.1719929364190; Tue, 02 Jul 2024 07:09:24 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b09a2bcsm197928645e9.36.2024.07.02.07.09.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:09:23 -0700 (PDT) Date: Tue, 2 Jul 2024 10:09:21 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefano Garzarella , Eric Blake , David Hildenbrand , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Stefan Hajnoczi Subject: [PULL 47/91] libvhost-user: set msg.msg_control to NULL when it is empty 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Stefano Garzarella On some OS (e.g. macOS) sendmsg() returns -1 (errno EINVAL) if the `struct msghdr` has the field `msg_controllen` set to 0, but `msg_control` is not NULL. Reviewed-by: Eric Blake Reviewed-by: David Hildenbrand Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Acked-by: Stefan Hajnoczi Signed-off-by: Stefano Garzarella Message-Id: <20240618100043.144657-3-sgarzare@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- subprojects/libvhost-user/libvhost-user.c | 1 + 1 file changed, 1 insertion(+) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index 8adb277d54..53bf1adda6 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -632,6 +632,7 @@ vu_message_write(VuDev *dev, int conn_fd, VhostUserMsg *vmsg) memcpy(CMSG_DATA(cmsg), vmsg->fds, fdsize); } else { msg.msg_controllen = 0; + msg.msg_control = NULL; } do { From patchwork Tue Jul 2 14:09:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719775 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 64349C3064D for ; Tue, 2 Jul 2024 14:19:25 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCb-0000u4-UJ; Tue, 02 Jul 2024 10:09:50 -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 1sOeCX-0000LP-9M for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09: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 1sOeCJ-0008Mw-77 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929370; 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=scNChYFZ1BVuw6o3t83CBrfTE58zls/yBMV5gH+83JU=; b=WppUF3NWkZLO39LZb7ZjpkOm2d47I2kWvSAk9WiWrnvNusqOCxMcRMp3dUwpCRhYnoc/I3 6Ew3sO9fCLtpaaYhsnxQ+bjd0HrXOnvRBFV7V29Maoln5XBizz8AM9tAv4WStdQo/I/XTb D0Enzg1m9NWK0x8iT48O48B8QBROojs= 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-446-S6acrnn1Ofezw2_9JGVRPw-1; Tue, 02 Jul 2024 10:09:29 -0400 X-MC-Unique: S6acrnn1Ofezw2_9JGVRPw-1 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-52ce8969cf1so4160820e87.1 for ; Tue, 02 Jul 2024 07:09:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929367; x=1720534167; 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=scNChYFZ1BVuw6o3t83CBrfTE58zls/yBMV5gH+83JU=; b=BQnkxwN9PpyK/fC/9ULaMDQlmAz5S6fTT+u7Z3L+lQUYYtYt1YruMddjEvxryFOSRl +MlXcyhBFC5T2qijss6Cv9BMnY+MdYLQtbRNvUa+5PxfNq+MCeZv49sykZJ6u4AEJKTe aWZRNZKnRaswgwf4mB2ElzfqYxqeUZ16iNyJhLa88XR5vXNIBq2LZb7y8xbueSqJ3KjM Nw7G7UcqA5G3C9l2kZvw4HURMUTBRwLJCSKmoe7OQL5p8oOZh2YEMF4DvTM6OxMLXafT dq+mSSYW4lhE2TZPptAtJamKKDLMyoZKWhI0lKdCb2TAwtRwg2f++irUFpE4P2tlsKCU DEjA== X-Gm-Message-State: AOJu0YyVm9895PL/xMKutDaCy+yNsglmuPDRz3LEKrpX1DzT5j0EMhA3 /zBnq0h0y77H6sdir+9ZW2OX3TBgv6jXbNZqULm3dEnNljrvhW0y8dYI+rc+O2RHqvdIdaPJQ4A zihFoXv6Udr6NyZmceuEml2X3+Mp52ahSPu+wsOQebmFtQia+s3YmM1X8dzDrjSw87FB6MRvoCy CZqh0nKU7F6bxU4T2hKs0SwLhfcnlboA== X-Received: by 2002:ac2:5df5:0:b0:52e:6fe8:f0f with SMTP id 2adb3069b0e04-52e82672582mr4932280e87.28.1719929367303; Tue, 02 Jul 2024 07:09:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFfZnHNeH4IoN8JQ5dcX1pjgpcdMDb2pFE+QlN8mPQSx9HPLECOCmM51jkKkjmljLmxpg7Ecg== X-Received: by 2002:ac2:5df5:0:b0:52e:6fe8:f0f with SMTP id 2adb3069b0e04-52e82672582mr4932258e87.28.1719929366739; Tue, 02 Jul 2024 07:09:26 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b097b82sm203172225e9.34.2024.07.02.07.09.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:09:26 -0700 (PDT) Date: Tue, 2 Jul 2024 10:09:24 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefano Garzarella , Daniel P =?utf-8?b?LiBCZXJyYW5n?= =?utf-8?b?w6k=?= , Philippe =?utf-8?q?Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Stefan Hajnoczi , David Hildenbrand Subject: [PULL 48/91] libvhost-user: fail vu_message_write() if sendmsg() is failing 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Stefano Garzarella In vu_message_write() we use sendmsg() to send the message header, then a write() to send the payload. If sendmsg() fails we should avoid sending the payload, since we were unable to send the header. Discovered before fixing the issue with the previous patch, where sendmsg() failed on macOS due to wrong parameters, but the frontend still sent the payload which the backend incorrectly interpreted as a wrong header. Reviewed-by: Daniel P. Berrangé Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Acked-by: Stefan Hajnoczi Reviewed-by: David Hildenbrand Signed-off-by: Stefano Garzarella Message-Id: <20240618100043.144657-4-sgarzare@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- subprojects/libvhost-user/libvhost-user.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index 53bf1adda6..ea27683dac 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -639,6 +639,11 @@ vu_message_write(VuDev *dev, int conn_fd, VhostUserMsg *vmsg) rc = sendmsg(conn_fd, &msg, 0); } while (rc < 0 && (errno == EINTR || errno == EAGAIN)); + if (rc <= 0) { + vu_panic(dev, "Error while writing: %s", strerror(errno)); + return false; + } + if (vmsg->size) { do { if (vmsg->data) { From patchwork Tue Jul 2 14:09:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719801 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 47D0BC3064D for ; Tue, 2 Jul 2024 14:25:54 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCd-00018Y-Fl; Tue, 02 Jul 2024 10:09:52 -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 1sOeCa-0000aE-1F for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09: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 1sOeCS-0008Pc-VH for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929373; 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=QrTyYgO+P/l4LBdE4jQm9EUMOljixFZgw03WGI4si6s=; b=X+DNTLi4huI7O93NSnkM5d+A+t8eKgeCaYUFIY9x6hbdzBCtOxUixWE24/qwgqBV7V8iGm O+XCM7XTrIYNli/e2+kJqKOGYVpy4ZWh/Fp5aVMHnFNQynifdFCT92eskieNzoUienlGmx pL/4DsiDWvomWgz8kab/nCBw+iDW2ug= 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-113-uV7Kkrv1M76gqMa6dUA0SA-1; Tue, 02 Jul 2024 10:09:31 -0400 X-MC-Unique: uV7Kkrv1M76gqMa6dUA0SA-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-42565672e0aso27276195e9.0 for ; Tue, 02 Jul 2024 07:09:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929370; x=1720534170; 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=QrTyYgO+P/l4LBdE4jQm9EUMOljixFZgw03WGI4si6s=; b=nT5RXS2aGGWXV92GmA1UGUvDfGxLeACy8KS4mUYMHepyhnN1WU6xXK6fougVUQOHrJ qIq+NAY3+HmeoA8HPyz5WdU3nXtsKMWieGQS1BOXCdrOL9B3TQ1Bs36c3jdo5cC81RyH CQ3jAYxFktebABeiO8NnMyvM5XF6FERkhesZ50hfX1Uj7Zq7iTs+bJMT3fp1hy3r5EZh 3/B8BUSUbz2WGbrvOiUXi4zsBQ5N8ZYFBlxQ/7OIy5gRHHqmPylHhj5sgW6c6ff2KjjP z00UhcuVeLTUHVmz5knJpe1DSaBjgKxeb7DhAQxsTFaApXybHRhtcGM1tOExM6CfvE9J cHOA== X-Gm-Message-State: AOJu0YxIH+60BNEdMf0WVhVb68xfuW1I7cUCtk8sPAp8THrFPDAU7xyB +F2NFK+FoviQ3tKMuFaAQfX2zHBT/eJ8Z4k6orRrPGjYofSpUd/INr504on2zxYrNKieAEKku/p tg7l2Z8aCVTzGrnIfBG0UfbGBhj/O6vJxsRTfi/zqZjFC5zHviwoCoBy3qLIcXF7gMv3+r9t/+O LeoSxLh0kjnnxrTm5vZ3PTzPVR1IXtDQ== X-Received: by 2002:a05:600c:1c96:b0:421:811b:b83e with SMTP id 5b1f17b1804b1-4256d56407amr111523105e9.13.1719929370072; Tue, 02 Jul 2024 07:09:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG4OPgvZVZcIYo27rd3bS8ZNHLEpXs7Hy/Raqo8Ne6lR2A5Fh10UcZjZSzAX8jCNCinDWET4w== X-Received: by 2002:a05:600c:1c96:b0:421:811b:b83e with SMTP id 5b1f17b1804b1-4256d56407amr111522735e9.13.1719929369506; Tue, 02 Jul 2024 07:09:29 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0fba2dsm13358613f8f.73.2024.07.02.07.09.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:09:29 -0700 (PDT) Date: Tue, 2 Jul 2024 10:09:26 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefano Garzarella , Philippe =?utf-8?q?Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Stefan Hajnoczi , David Hildenbrand Subject: [PULL 49/91] libvhost-user: mask F_INFLIGHT_SHMFD if memfd is not supported 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Stefano Garzarella libvhost-user will panic when receiving VHOST_USER_GET_INFLIGHT_FD message if MFD_ALLOW_SEALING is not defined, since it's not able to create a memfd. VHOST_USER_GET_INFLIGHT_FD is used only if VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD is negotiated. So, let's mask that feature if the backend is not able to properly handle these messages. Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Acked-by: Stefan Hajnoczi Reviewed-by: David Hildenbrand Signed-off-by: Stefano Garzarella Message-Id: <20240618100043.144657-5-sgarzare@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- subprojects/libvhost-user/libvhost-user.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index ea27683dac..9c630c2170 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -1674,6 +1674,17 @@ vu_get_protocol_features_exec(VuDev *dev, VhostUserMsg *vmsg) features |= dev->iface->get_protocol_features(dev); } +#ifndef MFD_ALLOW_SEALING + /* + * If MFD_ALLOW_SEALING is not defined, we are not able to handle + * VHOST_USER_GET_INFLIGHT_FD messages, since we can't create a memfd. + * Those messages are used only if VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD + * is negotiated. A device implementation can enable it, so let's mask + * it to avoid a runtime panic. + */ + features &= ~(1ULL << VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD); +#endif + vmsg_set_reply_u64(vmsg, features); return true; } From patchwork Tue Jul 2 14:09:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719786 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E83CBC30658 for ; Tue, 2 Jul 2024 14:21:59 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCe-00019e-Kp; Tue, 02 Jul 2024 10:09:52 -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 1sOeCY-0000TI-Go for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09: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 1sOeCP-0008Oz-KP for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929375; 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=SxEb4qxo9i3miZ1US5mo9RXgQJuGwUKVIRe5VRPOVeg=; b=hcOhzFQNRhF2rgYXTNPrtnMVWonoB/jzLBrg9r3+/3pN7mQ5XZsoNnq05qFJ7YeEH5v7mc VDLeICTCkHbXcv+ioOjOhUXrL6wMbFRp5zD0K1cgzJ2PoIAuLCH3dHfDMTVKHaVT/jQQrP AkHJNbHwhNP/+s8TGjaLT25frusMffI= 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-479-r9FVh6T6OYy47_jFDd2xtQ-1; Tue, 02 Jul 2024 10:09:34 -0400 X-MC-Unique: r9FVh6T6OYy47_jFDd2xtQ-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-42566c4aa0fso34065055e9.1 for ; Tue, 02 Jul 2024 07:09:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929373; x=1720534173; 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=SxEb4qxo9i3miZ1US5mo9RXgQJuGwUKVIRe5VRPOVeg=; b=mlJ0nK+feVyAJp00vFpK4AjGghLNyLl5DxARWi01UC+B1ULUeTfKxSQc3w1S2n+8cc B/gItovICwXJ2VHV+882lsLc6wFeUeSoNJVUJWlauAKPb9QeRCMsQjYBhktx/XJngJgv ygKC0rCfPWiNWdd6B9+IKNL0SQ6Tq/PvJTBR3bxgD4eUrbNxncpdZLvcVXtDlQAYWaPB c8RI3W1qifSjNX3Zu8Hd9/8Sl2wntNzr3ANe6ZHDEAB6nIOSSn0DhYELmek9jKj2pyPB PoogbAsRivUFI/UF5ixdMblrCv7CTl0FVpm7BiJDWeAdjxZ+hXDDxDCWFVYGTapK2psp vRiQ== X-Gm-Message-State: AOJu0YyfL0YOMm8NlsmfPpAu1ze3KxW/auj/e6Fs/TJuGG3wKcTAVx7H 0G/g+8Gwd53+e7SAWFs6hzOcl/Ki98+tETs3ja4SuXsjuQl2OY14/kXlW4Pu5a89JBREK6TG3g6 GHb+Xtk99Bm5tvSUjj2h2kd5RIWErxQ3+hYrgqq7wT8YdUDHm6KOfcgJtYQH/h6oMZSzHSWIPEi QkFsbi0nhLksIkegVLCloLAIThfqmZ6g== X-Received: by 2002:a05:600c:314b:b0:425:622e:32f4 with SMTP id 5b1f17b1804b1-4257a05fa23mr66589825e9.26.1719929372794; Tue, 02 Jul 2024 07:09:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH1BtGHx3eNidc0n5ZSfOsQIaaK9K4v2v4fFuEDFetv/xuQfLhwK0nLWkgOLFCx7Dxgp5XUzg== X-Received: by 2002:a05:600c:314b:b0:425:622e:32f4 with SMTP id 5b1f17b1804b1-4257a05fa23mr66589545e9.26.1719929372219; Tue, 02 Jul 2024 07:09:32 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af376f5sm200551945e9.6.2024.07.02.07.09.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:09:31 -0700 (PDT) Date: Tue, 2 Jul 2024 10:09:29 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefano Garzarella , Daniel P =?utf-8?b?LiBCZXJyYW5n?= =?utf-8?b?w6k=?= , Stefan Hajnoczi , David Hildenbrand , Coiby Xu Subject: [PULL 50/91] vhost-user-server: do not set memory fd non-blocking Message-ID: <8b525353aee211cfc049f54c3a4b2788efc5cb9f.1719929191.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Stefano Garzarella In vhost-user-server we set all fd received from the other peer in non-blocking mode. For some of them (e.g. memfd, shm_open, etc.) it's not really needed, because we don't use these fd with blocking operations, but only to map memory. In addition, in some systems this operation can fail (e.g. in macOS setting an fd returned by shm_open() non-blocking fails with errno = ENOTTY). So, let's avoid setting fd non-blocking for those messages that we know carry memory fd (e.g. VHOST_USER_ADD_MEM_REG, VHOST_USER_SET_MEM_TABLE). Reviewed-by: Daniel P. Berrangé Acked-by: Stefan Hajnoczi Reviewed-by: David Hildenbrand Signed-off-by: Stefano Garzarella Message-Id: <20240618100043.144657-6-sgarzare@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- util/vhost-user-server.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/util/vhost-user-server.c b/util/vhost-user-server.c index 3bfb1ad3ec..b19229074a 100644 --- a/util/vhost-user-server.c +++ b/util/vhost-user-server.c @@ -65,6 +65,18 @@ static void vmsg_close_fds(VhostUserMsg *vmsg) static void vmsg_unblock_fds(VhostUserMsg *vmsg) { int i; + + /* + * These messages carry fd used to map memory, not to send/receive messages, + * so this operation is useless. In addition, in some systems this + * operation can fail (e.g. in macOS setting an fd returned by shm_open() + * non-blocking fails with errno = ENOTTY) + */ + if (vmsg->request == VHOST_USER_ADD_MEM_REG || + vmsg->request == VHOST_USER_SET_MEM_TABLE) { + return; + } + for (i = 0; i < vmsg->fd_num; i++) { qemu_socket_set_nonblock(vmsg->fds[i]); } From patchwork Tue Jul 2 14:09:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719798 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 384BDC3064D for ; Tue, 2 Jul 2024 14:24:39 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCi-0001oI-Gb; Tue, 02 Jul 2024 10:09: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 1sOeCb-0000rg-J0 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09: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 1sOeCW-0008Q7-4A for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929382; 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=hyIX+6gMMv2zX4UnJSMWLVmYqSE0wXcA/BACsQ8Un/M=; b=OYOKjyRAPTtSeqUKoXuFaFRpPYwD4G3Pj7qzdqpoHJ3bFagVOP8CbZVNrKK3IXHJFB8WeE Ulev7elPpALOJaDBMhSyu4CaLcUZYcvZd/PxI5+0QF4RWesWFwsjVuDp2ftlxIjLu3BvJM XkFUxaJ/50LQoYkM40xcBREW4ViRfVw= 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-63-XH3OD9E7M3edTRJ8jg-vdQ-1; Tue, 02 Jul 2024 10:09:37 -0400 X-MC-Unique: XH3OD9E7M3edTRJ8jg-vdQ-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-36743ab5fb3so2631494f8f.1 for ; Tue, 02 Jul 2024 07:09:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929375; x=1720534175; 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=hyIX+6gMMv2zX4UnJSMWLVmYqSE0wXcA/BACsQ8Un/M=; b=MXdnR0ELlm+G2z3IDLK4evfbiQ4onYDUkKCn4u+Y7aVGTnoJTcXAvy3mpcFZRNbeSn 8allZ+Vrqcd9LJkgvg4bTRYXK6nUEc6j5q2AOGvcflXmPH9t4mUNOVIb0tFDxqFi+Isg GmgrAW/OvIowyQeEw3hVkcIiWtRMeNcYp0kpC9cntg9lPW6rt+Zbfn0Jvz10RkHmaGWF nPt6Gvm0YnT1siLo4WOlqGsvt9MpfbM+sZu+3VDgrv8OcZ6cgv82ppq/gKCYjuXoiOCI VzIfIuoPO9r30XLdU0LSVg75xrzkEARY1qZ44lefBmj4IHBJJrVgZcoomvmwcg6DzS0t BSBA== X-Gm-Message-State: AOJu0YwdwKTn3c/0LvdlMVcJg8Rc+VSwF4Hxhpx0Un62fSO2bMznA4Dw zXtMMRTC8dzBu1tq/ezy/3+NhJDraxBQA53UJhJal7lVlc0T4bebcGSBFnSEe0sBEAG3D77F22X cUXkPbQfUbQJJVlRpmHjqJGUVLyACVtd4y2sQCqJHOhEQhow3gAA6WS9SxJdnQyvD1rmixvUsxF UQ0Ia+v/BZlTpzf7YbX1I77e9EQzyOIw== X-Received: by 2002:a05:600c:3089:b0:424:ab8c:a24e with SMTP id 5b1f17b1804b1-4257986256bmr76503945e9.11.1719929375473; Tue, 02 Jul 2024 07:09:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFbmq/VKXGOolJIsaGFW/Ph9dgGPejQhQd6cTLWIFBNxtohAqRTAk08vXxhV72OoQatigxOiA== X-Received: by 2002:a05:600c:3089:b0:424:ab8c:a24e with SMTP id 5b1f17b1804b1-4257986256bmr76503545e9.11.1719929374866; Tue, 02 Jul 2024 07:09:34 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af3cf9bsm203206195e9.8.2024.07.02.07.09.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:09:34 -0700 (PDT) Date: Tue, 2 Jul 2024 10:09:32 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefano Garzarella , Philippe =?utf-8?q?Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Stefan Hajnoczi , David Hildenbrand , Raphael Norwitz Subject: [PULL 51/91] contrib/vhost-user-blk: fix bind() using the right size of the address 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Stefano Garzarella On macOS passing `-s /tmp/vhost.socket` parameter to the vhost-user-blk application, the bind was done on `/tmp/vhost.socke` pathname, missing the last character. This sounds like one of the portability problems described in the unix(7) manpage: Pathname sockets When binding a socket to a pathname, a few rules should be observed for maximum portability and ease of coding: • The pathname in sun_path should be null-terminated. • The length of the pathname, including the terminating null byte, should not exceed the size of sun_path. • The addrlen argument that describes the enclosing sockaddr_un structure should have a value of at least: offsetof(struct sockaddr_un, sun_path) + strlen(addr.sun_path)+1 or, more simply, addrlen can be specified as sizeof(struct sockaddr_un). So let's follow the last advice and simplify the code as well. Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Acked-by: Stefan Hajnoczi Reviewed-by: David Hildenbrand Signed-off-by: Stefano Garzarella Message-Id: <20240618100440.145664-1-sgarzare@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- contrib/vhost-user-blk/vhost-user-blk.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk/vhost-user-blk.c index 89e5f11a64..a8ab9269a2 100644 --- a/contrib/vhost-user-blk/vhost-user-blk.c +++ b/contrib/vhost-user-blk/vhost-user-blk.c @@ -469,7 +469,6 @@ static int unix_sock_new(char *unix_fn) { int sock; struct sockaddr_un un; - size_t len; assert(unix_fn); @@ -481,10 +480,9 @@ static int unix_sock_new(char *unix_fn) un.sun_family = AF_UNIX; (void)snprintf(un.sun_path, sizeof(un.sun_path), "%s", unix_fn); - len = sizeof(un.sun_family) + strlen(un.sun_path); (void)unlink(unix_fn); - if (bind(sock, (struct sockaddr *)&un, len) < 0) { + if (bind(sock, (struct sockaddr *)&un, sizeof(un)) < 0) { perror("bind"); goto fail; } From patchwork Tue Jul 2 14:09:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719759 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8E0D8C30658 for ; Tue, 2 Jul 2024 14:14:56 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCh-0001Yc-NR; Tue, 02 Jul 2024 10:09: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 1sOeCd-0001DB-Sl for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:51 -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 1sOeCV-0008Q3-0u for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929382; 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=Xz1NfthBeUYnFyP8G3rI1icjzqQ87e2k5Q1ZCQ4OJGs=; b=iesPMSZOZ448A7LwL8kkCpHTuLkFpOn9fehi9Lhgk2u8hKsv5FomO4ywIe1Vtx8ma0je/h tAcLCuWzDiNsAL11upucVk6PF7L/RQF2jsG1qRBkW1i/QIUAYO83718aHnh8GxSiZIsevn qvwY2YJ0w+EvGqa2D/ZAETNSx29MnSQ= 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-544-CK9KUdqUOmmgrM5FA4Jp1g-1; Tue, 02 Jul 2024 10:09:41 -0400 X-MC-Unique: CK9KUdqUOmmgrM5FA4Jp1g-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-3634a634f8aso2402458f8f.2 for ; Tue, 02 Jul 2024 07:09:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929378; x=1720534178; 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=Xz1NfthBeUYnFyP8G3rI1icjzqQ87e2k5Q1ZCQ4OJGs=; b=SJI6LuOxnLuXHUxZZPp+ePo3p5g+jIH88fplIzxfqJqg4UOrgvYRwuHd/NKFxgLAxu VlwoU0oG1krcWy5mhWvTVedxa2j+lwqAd1s6Y5fwNDwlnBfvtICGs8G1nG9sf0rawswA uU14lBUyA3Wwflw3qsue3tU7nNVTg1JikYAehKDuqSL+MGRvSB5b763guD1qILUoAa9E Xhk4dU8fue1Wnmrw06wqo+xCl9xOA51b4E95jXDLCzDmAfXmiT9BIV+S5B2jayW6OnfE baFbPdoJUE7nrj621vQbtQ4lP0QzLpILqno7kZpxaEX94KWboOva/OZibFvEcDKpvbym y+1A== X-Gm-Message-State: AOJu0YyuyphfDkgjymOopNOknywhLlhf1SRQC9VZQK1hpL6yTyJtwCvV tiupRigZ7rtlCGF2qQpxz+yLh0KjpnuMOZPsyklFUtXELZc9A52OOZ9/YHYbZceq5XATRrtLtLp lS+jaoZk9V1vtc7dGqvuQSYj8UGR5K38JWCeQXTI11kxEtJSm1FAo8RKZuJ9MvBk7z+JB/gsR8u ywwJhvDhZq1id8l/60uzJ6GUKSGmZnOQ== X-Received: by 2002:a05:6000:4582:b0:35f:159e:5ec2 with SMTP id ffacd0b85a97d-367756c73aamr4163386f8f.39.1719929378247; Tue, 02 Jul 2024 07:09:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG18+wNbjXzPcHYme9fmFSpAsLrQL4G8+P/wjcq4DrMt+mI+Y9O1ECFeECgs1yZOHPWbSER1Q== X-Received: by 2002:a05:6000:4582:b0:35f:159e:5ec2 with SMTP id ffacd0b85a97d-367756c73aamr4163363f8f.39.1719929377622; Tue, 02 Jul 2024 07:09:37 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3678aa3caccsm1095845f8f.35.2024.07.02.07.09.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:09:37 -0700 (PDT) Date: Tue, 2 Jul 2024 10:09:35 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefano Garzarella , Philippe =?utf-8?q?Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Stefan Hajnoczi , David Hildenbrand , Raphael Norwitz , Gerd Hoffmann Subject: [PULL 52/91] contrib/vhost-user-*: use QEMU bswap helper functions Message-ID: <0e951d36e4852e161438a27eddecf62db0a302e7.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Stefano Garzarella Let's replace the calls to le*toh() and htole*() with qemu/bswap.h helpers to make the code more portable. Suggested-by: Philippe Mathieu-Daudé Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Acked-by: Stefan Hajnoczi Reviewed-by: David Hildenbrand Signed-off-by: Stefano Garzarella Message-Id: <20240618100447.145697-1-sgarzare@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- contrib/vhost-user-blk/vhost-user-blk.c | 9 +++++---- contrib/vhost-user-input/main.c | 16 ++++++++-------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk/vhost-user-blk.c index a8ab9269a2..9492146855 100644 --- a/contrib/vhost-user-blk/vhost-user-blk.c +++ b/contrib/vhost-user-blk/vhost-user-blk.c @@ -16,6 +16,7 @@ */ #include "qemu/osdep.h" +#include "qemu/bswap.h" #include "standard-headers/linux/virtio_blk.h" #include "libvhost-user-glib.h" @@ -194,8 +195,8 @@ vub_discard_write_zeroes(VubReq *req, struct iovec *iov, uint32_t iovcnt, #if defined(__linux__) && defined(BLKDISCARD) && defined(BLKZEROOUT) VubDev *vdev_blk = req->vdev_blk; desc = buf; - uint64_t range[2] = { le64toh(desc->sector) << 9, - le32toh(desc->num_sectors) << 9 }; + uint64_t range[2] = { le64_to_cpu(desc->sector) << 9, + le32_to_cpu(desc->num_sectors) << 9 }; if (type == VIRTIO_BLK_T_DISCARD) { if (ioctl(vdev_blk->blk_fd, BLKDISCARD, range) == 0) { g_free(buf); @@ -267,13 +268,13 @@ static int vub_virtio_process_req(VubDev *vdev_blk, req->in = (struct virtio_blk_inhdr *)elem->in_sg[in_num - 1].iov_base; in_num--; - type = le32toh(req->out->type); + type = le32_to_cpu(req->out->type); switch (type & ~VIRTIO_BLK_T_BARRIER) { case VIRTIO_BLK_T_IN: case VIRTIO_BLK_T_OUT: { ssize_t ret = 0; bool is_write = type & VIRTIO_BLK_T_OUT; - req->sector_num = le64toh(req->out->sector); + req->sector_num = le64_to_cpu(req->out->sector); if (is_write) { ret = vub_writev(req, &elem->out_sg[1], out_num); } else { diff --git a/contrib/vhost-user-input/main.c b/contrib/vhost-user-input/main.c index 081230da54..f3362d41ac 100644 --- a/contrib/vhost-user-input/main.c +++ b/contrib/vhost-user-input/main.c @@ -51,8 +51,8 @@ static void vi_input_send(VuInput *vi, struct virtio_input_event *event) vi->queue[vi->qindex++].event = *event; /* ... until we see a report sync ... */ - if (event->type != htole16(EV_SYN) || - event->code != htole16(SYN_REPORT)) { + if (event->type != cpu_to_le16(EV_SYN) || + event->code != cpu_to_le16(SYN_REPORT)) { return; } @@ -103,9 +103,9 @@ vi_evdev_watch(VuDev *dev, int condition, void *data) g_debug("input %d %d %d", evdev.type, evdev.code, evdev.value); - virtio.type = htole16(evdev.type); - virtio.code = htole16(evdev.code); - virtio.value = htole32(evdev.value); + virtio.type = cpu_to_le16(evdev.type); + virtio.code = cpu_to_le16(evdev.code); + virtio.value = cpu_to_le32(evdev.value); vi_input_send(vi, &virtio); } } @@ -124,9 +124,9 @@ static void vi_handle_status(VuInput *vi, virtio_input_event *event) evdev.input_event_sec = tval.tv_sec; evdev.input_event_usec = tval.tv_usec; - evdev.type = le16toh(event->type); - evdev.code = le16toh(event->code); - evdev.value = le32toh(event->value); + evdev.type = le16_to_cpu(event->type); + evdev.code = le16_to_cpu(event->code); + evdev.value = le32_to_cpu(event->value); rc = write(vi->evdevfd, &evdev, sizeof(evdev)); if (rc == -1) { From patchwork Tue Jul 2 14:09:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719772 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1A894C3064D for ; Tue, 2 Jul 2024 14:18:59 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCs-0002YX-Rh; Tue, 02 Jul 2024 10:10: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 1sOeCh-0001fR-4d for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:55 -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 1sOeCY-0008R8-Ng for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929385; 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=2AGZP+nspE3HlB5tjeGIUHiwMrs8aGiCZ0Y1FdNl3gU=; b=cuDWcMhvu5qgMs2FhYSkJDYNWVxWMm3GUQFHd11jCwmgUSK0X21DekS7zY4w2ROg0y92jr RrtYx6U5UHuqwrithWFeteDGdXUh2odwEHnPiW1xrQ+YL5JX2AFyfTBkF+MJonCU/eHk5b FL9dojMZziMDsmQIuHbkxHzR+1V0drA= 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-505-FqzP7xG2NgWL7HdHs4tyEg-1; Tue, 02 Jul 2024 10:09:43 -0400 X-MC-Unique: FqzP7xG2NgWL7HdHs4tyEg-1 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2ee4a63e95cso42568101fa.1 for ; Tue, 02 Jul 2024 07:09:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929381; x=1720534181; 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=2AGZP+nspE3HlB5tjeGIUHiwMrs8aGiCZ0Y1FdNl3gU=; b=J+4vgGiom+PZ4gZgBzz4wVrVPbrNM1JJKVrtZ9CkjfeI9Vb47fJ3UP/9JC6VrGbWut /b4h4jRWm9KOvU8k9cMQligGC+MfAFnuXTpIuAbDqKmvWQa/jgCVyrNJ4AQWTUj5hPJM bgvYVfKYfybmWjNA1Fo2M8Xo2DhGQCzXTSACIlJsyDbXUL4mLG6dgh6AOVrKJvtQuB8e hreZPDLIlSV6+ZfBIjHl8onYnBdcF9T6ISA6Lpz+qZDi/fcGkLUFhSNBss8q09TBFnAH 08vAz5MtzPOL+WNj1PLkCybp+nEmEbATpbzLytx0Ee2pOYFM4MMvGp03KPWPmLqHEID9 q4ig== X-Gm-Message-State: AOJu0Yxb7Z87Hui02lJDpEVTPbz3lHxefsF11SogDabHdaF8ZCHkEkO0 kzfA+9EnrRL4JXlYsTHmFxV4X3w7rxf4QpkMcpbtNJaxbDFBX4latSSkG0idQAAohUYLoLfxZ8J e+DswLbIh1L4lCBuJsrMzZShmqDxZ5fRkFdYYReok74qlz4nJQQfoWee5HsW+Kr01VCZE4Njddm F6DWvV8NPKrHjJT77x3SWUvXxjisTEHA== X-Received: by 2002:a2e:a910:0:b0:2ee:7b88:7f3 with SMTP id 38308e7fff4ca-2ee7b880869mr253701fa.12.1719929381695; Tue, 02 Jul 2024 07:09:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEh5T6tlzwkVF81E+h4m6CYc6nyeXRZ3lFkO2Q0xNdE+EoVmKRQcH68EtN3LkWAR4NKoSxqNQ== X-Received: by 2002:a2e:a910:0:b0:2ee:7b88:7f3 with SMTP id 38308e7fff4ca-2ee7b880869mr253331fa.12.1719929381084; Tue, 02 Jul 2024 07:09:41 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4258014f8b7sm105297925e9.41.2024.07.02.07.09.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:09:40 -0700 (PDT) Date: Tue, 2 Jul 2024 10:09:37 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefano Garzarella , Philippe =?utf-8?q?Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Stefan Hajnoczi , David Hildenbrand , Paolo Bonzini , Kevin Wolf , Hanna Reitz , Jason Wang , =?utf-8?q?Marc-Andr=C3=A9?= Lureau , Daniel =?utf-8?b?UC4gQmVycmFuZ8Op?= , Thomas Huth , qemu-block@nongnu.org Subject: [PULL 53/91] vhost-user: enable frontends on any POSIX system Message-ID: <7f2a913552148d1f553a67a6f9f92585d150b21c.1719929191.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Stefano Garzarella The vhost-user protocol is not really Linux-specific so let's enable vhost-user frontends for any POSIX system. In vhost_net.c we use VHOST_FILE_UNBIND which is defined in a Linux specific header, let's define it for other systems as well. Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Acked-by: Stefan Hajnoczi Reviewed-by: David Hildenbrand Signed-off-by: Stefano Garzarella Message-Id: <20240618100455.145733-1-sgarzare@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/net/vhost_net.c | 5 +++++ hw/block/Kconfig | 2 +- meson.build | 1 - 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 18898afe81..d25b1bc839 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -34,8 +34,13 @@ #include "standard-headers/linux/virtio_ring.h" #include "hw/virtio/vhost.h" #include "hw/virtio/virtio-bus.h" +#if defined(__linux__) #include "linux-headers/linux/vhost.h" +#endif +#ifndef VHOST_FILE_UNBIND +#define VHOST_FILE_UNBIND -1 +#endif /* Features supported by host kernel. */ static const int kernel_feature_bits[] = { diff --git a/hw/block/Kconfig b/hw/block/Kconfig index 9e8f28f982..29ee09e434 100644 --- a/hw/block/Kconfig +++ b/hw/block/Kconfig @@ -40,7 +40,7 @@ config VHOST_USER_BLK bool # Only PCI devices are provided for now default y if VIRTIO_PCI - depends on VIRTIO && VHOST_USER && LINUX + depends on VIRTIO && VHOST_USER config SWIM bool diff --git a/meson.build b/meson.build index 54e6b09f4f..98db5ea322 100644 --- a/meson.build +++ b/meson.build @@ -151,7 +151,6 @@ have_tpm = get_option('tpm') \ # vhost have_vhost_user = get_option('vhost_user') \ - .disable_auto_if(host_os != 'linux') \ .require(host_os != 'windows', error_message: 'vhost-user is not available on Windows').allowed() have_vhost_vdpa = get_option('vhost_vdpa') \ From patchwork Tue Jul 2 14:09:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719764 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B5CE1C3065D for ; Tue, 2 Jul 2024 14:17:54 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCl-00027L-4t; Tue, 02 Jul 2024 10:09:59 -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 1sOeCh-0001fZ-5J for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09: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 1sOeCa-0008Rt-CI for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929387; 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=f88EXx30zef+oxtKxh27fnm0osRHGKUTzZYejeCgKxU=; b=MfX7qCsXcWjDwC+ck1rd/6g0MII722hB+RKejnfdFHb0O/PWh0CCveZy94DDla8Zs8rw7W BFZ0qC0NdkC/DKZXdMsVBsw4X043P4SAsQbgWZTzIDwK2c4sgBKjWr3LE4oqyxX8hjZOpq rNIUV6hvrIBcBe+107OZ+x/zs3SGxFg= 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-674-oqbmgllFNqCJddRDmQiIiQ-1; Tue, 02 Jul 2024 10:09:46 -0400 X-MC-Unique: oqbmgllFNqCJddRDmQiIiQ-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-36248c176c4so2742569f8f.1 for ; Tue, 02 Jul 2024 07:09:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929385; x=1720534185; 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=f88EXx30zef+oxtKxh27fnm0osRHGKUTzZYejeCgKxU=; b=LK3QKVSqn+LowiDUSIb45noZsDS/d0JDDzvQUnMP3fyf7JrDEKqEpPgLOy6xpWwHea spTfFjj4vhZdaA17acmzporiyUnTGGNzVXaSBDS7YNs/ozWy7ogK8VCmBalEwUnc/p1U kZn9iVuKRhtWd/MQbbT/g+eMH8WPrHYO5zvCukDwoaaPLFt2uPizAEjECmAY4PmFGcPu mEtD6QIgFFnAdGpB+N5a7EsUc84WwZ9k0WjVq+1w25j4rapP7NqmVWI5vtayVXS9Ijwn xoJQeiDS86PTAXp3FwOKjPxOsZ+8f9gv7pu+ogGVUabhg0r+ZJ+hfJ06fMqCJwn9/EkK /a5g== X-Gm-Message-State: AOJu0YwmBMb6yf3CuaXnXle1KeNAy/uLVl31WdwhE7ApdkArUGCfU64Z r+oSjbZ09qXXw4mIk1QZP08ebqX0UfIT4txkDlHW9ICl86NZb6OpuXlF9ftl6EyEQEB+thpFwQJ i8Bsz+OHQ7yzCqIzK+rdFMTYDT8p8lRu/WInHDlAIuI5KS43Ajg8pzW73nZQDIsyP2SaytlROZG UqTDvCeN+dQ5LjaQvZcV47VNbr2pXiUA== X-Received: by 2002:adf:e261:0:b0:367:33b1:e82b with SMTP id ffacd0b85a97d-36775728540mr4990850f8f.68.1719929384867; Tue, 02 Jul 2024 07:09:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGmAC/nE5wyzN9z6ae0wLWWzKBphmOM/ONNUT1z55m3rXTfGZNnDDqoTzKQn5XQlNJ6FTTbSw== X-Received: by 2002:adf:e261:0:b0:367:33b1:e82b with SMTP id ffacd0b85a97d-36775728540mr4990824f8f.68.1719929384256; Tue, 02 Jul 2024 07:09:44 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0cd778sm13563686f8f.5.2024.07.02.07.09.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:09:43 -0700 (PDT) Date: Tue, 2 Jul 2024 10:09:41 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefano Garzarella , Philippe =?utf-8?q?Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Stefan Hajnoczi , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9?= Lureau , Daniel =?utf-8?b?UC4gQmVycmFuZ8Op?= , Thomas Huth Subject: [PULL 54/91] libvhost-user: enable it on any POSIX system Message-ID: <800a3dfe84bb922f27156451007ed3e2e3b8abdb.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Stefano Garzarella The vhost-user protocol is not really Linux-specific so let's enable libvhost-user for any POSIX system. Compiling it on macOS and FreeBSD some problems came up: - avoid to include linux/vhost.h which is available only on Linux (vhost_types.h contains many of the things we need) - macOS doesn't provide sys/endian.h, so let's define them (note: libvhost-user doesn't include QEMU's headers, so we can't use use "qemu/bswap.h") - define eventfd_[write|read] as write/read wrapper when system doesn't provide those (e.g. macOS) - copy SEAL defines from include/qemu/memfd.h to make the code works on FreeBSD where MFD_ALLOW_SEALING is defined - define MAP_NORESERVE if it's not defined (e.g. on FreeBSD) Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Acked-by: Stefan Hajnoczi Signed-off-by: Stefano Garzarella Message-Id: <20240618100503.145768-1-sgarzare@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- subprojects/libvhost-user/libvhost-user.h | 2 +- subprojects/libvhost-user/libvhost-user.c | 60 +++++++++++++++++++++-- meson.build | 2 +- 3 files changed, 59 insertions(+), 5 deletions(-) diff --git a/subprojects/libvhost-user/libvhost-user.h b/subprojects/libvhost-user/libvhost-user.h index deb40e77b3..e13e1d3931 100644 --- a/subprojects/libvhost-user/libvhost-user.h +++ b/subprojects/libvhost-user/libvhost-user.h @@ -18,9 +18,9 @@ #include #include #include -#include #include #include "standard-headers/linux/virtio_ring.h" +#include "standard-headers/linux/vhost_types.h" /* Based on qemu/hw/virtio/vhost-user.c */ #define VHOST_USER_F_PROTOCOL_FEATURES 30 diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index 9c630c2170..d855a97a4c 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -28,9 +28,7 @@ #include #include #include -#include #include -#include /* Necessary to provide VIRTIO_F_VERSION_1 on system * with older linux headers. Must appear before @@ -39,8 +37,8 @@ #include "standard-headers/linux/virtio_config.h" #if defined(__linux__) +#include #include -#include #include #include #include @@ -52,6 +50,62 @@ #endif +#if defined(__APPLE__) && (__MACH__) +#include +#define htobe16(x) OSSwapHostToBigInt16(x) +#define htole16(x) OSSwapHostToLittleInt16(x) +#define be16toh(x) OSSwapBigToHostInt16(x) +#define le16toh(x) OSSwapLittleToHostInt16(x) + +#define htobe32(x) OSSwapHostToBigInt32(x) +#define htole32(x) OSSwapHostToLittleInt32(x) +#define be32toh(x) OSSwapBigToHostInt32(x) +#define le32toh(x) OSSwapLittleToHostInt32(x) + +#define htobe64(x) OSSwapHostToBigInt64(x) +#define htole64(x) OSSwapHostToLittleInt64(x) +#define be64toh(x) OSSwapBigToHostInt64(x) +#define le64toh(x) OSSwapLittleToHostInt64(x) +#endif + +#ifdef CONFIG_EVENTFD +#include +#else +#define eventfd_t uint64_t + +int eventfd_write(int fd, eventfd_t value) +{ + return (write(fd, &value, sizeof(value)) == sizeof(value)) ? 0 : -1; +} + +int eventfd_read(int fd, eventfd_t *value) +{ + return (read(fd, value, sizeof(*value)) == sizeof(*value)) ? 0 : -1; +} +#endif + +#ifdef MFD_ALLOW_SEALING +#include + +#ifndef F_LINUX_SPECIFIC_BASE +#define F_LINUX_SPECIFIC_BASE 1024 +#endif + +#ifndef F_ADD_SEALS +#define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9) +#define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10) + +#define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */ +#define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */ +#define F_SEAL_GROW 0x0004 /* prevent file from growing */ +#define F_SEAL_WRITE 0x0008 /* prevent writes */ +#endif +#endif + +#ifndef MAP_NORESERVE +#define MAP_NORESERVE 0 +#endif + #include "include/atomic.h" #include "libvhost-user.h" diff --git a/meson.build b/meson.build index 98db5ea322..6c1a489cc0 100644 --- a/meson.build +++ b/meson.build @@ -3203,7 +3203,7 @@ if have_system and vfio_user_server_allowed endif vhost_user = not_found -if host_os == 'linux' and have_vhost_user +if have_vhost_user libvhost_user = subproject('libvhost-user') vhost_user = libvhost_user.get_variable('vhost_user_dep') endif From patchwork Tue Jul 2 14:09:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719766 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6EF79C30658 for ; Tue, 2 Jul 2024 14:18:22 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCs-0002XR-PY; Tue, 02 Jul 2024 10:10: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 1sOeCh-0001gR-CN for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:55 -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 1sOeCf-0008Sd-91 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:09:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929392; 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=8Eny4dc4u4alXpsHdU13CSR0Mm+jD6T0BjGB+X7tlZ0=; b=fQWRZXcZnva2L+oPQ8pjleSn7hBOy+yT0DVKS0i0lf9Iuibo1B1VelgQSJywB2tm2mOBaP +JZ8wXu973wTbk++fJfztre2Z1Jlx0ZL88Q1W1TCcKxsUq7086Sf0A5pQNPLtFcDGVVQVx OyJoW97WkizEC2V+uhSS4EpzG4CoNW8= 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-675-bNzlGk0fOpKInVAYEdFiYA-1; Tue, 02 Jul 2024 10:09:51 -0400 X-MC-Unique: bNzlGk0fOpKInVAYEdFiYA-1 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-52ce42bb0efso5111878e87.2 for ; Tue, 02 Jul 2024 07:09:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929388; x=1720534188; 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=8Eny4dc4u4alXpsHdU13CSR0Mm+jD6T0BjGB+X7tlZ0=; b=Eoo/MPnBkUTg2ysn7Pp1U2o4mIKO9VoX0Dhx8kezKjXZSiCc3mR02Acjs6g0T8gB9R oourAjML7v7PBOqrIXN2cF35mw0In53z63MzlIzIbbncZREermYH6qAHVkYDRbzSJPKd Hy0WAKwx3Exw6HDlcnvAQUYJHo8VIeccnrlicyOCkeMIXoofdJLQwsmiUzCh85S6VZyK h5ORvOk1fCMA2RiqACh0/pszCTj/Jm4nPp+wtYqABqfNZWYZgGCWZZaV5R8yWs9xGKIt 1Di/qganw5uD6lwU0RWdvmQQ2LHoo9YbNvUfojVTTOp6X/3YebDHOGaZr0irQPZ3zMJF a9Cg== X-Gm-Message-State: AOJu0YyjHHiQ4lUSPjApNkTWrkDcVL8zIhJ6mDBtOleajYenGbsTKdfc wJ48/t/Mc77Ousb2JCBwQPO71wIisX3ZCjOzr5WSQG0szOqPuFAa+AWAjr7RtMC4jrt0d6TRXsB 4ZBdPoPwNmDDSqllkEObgRQKhiJ2aL20Xrj0TEeEUCAp4kHFGkz+IRx7sk56jEPeDf1sJs8KMNK VjfhaiUSsZFq4oabNvMI0NeIDNInLleQ== X-Received: by 2002:a05:6512:3da5:b0:52c:df90:203b with SMTP id 2adb3069b0e04-52e8273e669mr5852531e87.56.1719929388425; Tue, 02 Jul 2024 07:09:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFXONuDfLUANbrzzfsYmYnA+QeWn/WMW01jd7UcA5zugQxaKon72Ntzb1J0LNZRUJYROTI4hQ== X-Received: by 2002:a05:6512:3da5:b0:52c:df90:203b with SMTP id 2adb3069b0e04-52e8273e669mr5852500e87.56.1719929387720; Tue, 02 Jul 2024 07:09:47 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3678eb6593bsm618931f8f.93.2024.07.02.07.09.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:09:47 -0700 (PDT) Date: Tue, 2 Jul 2024 10:09:44 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefano Garzarella , Stefan Hajnoczi , Philippe =?utf-8?q?Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Raphael Norwitz , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9?= Lureau , Daniel =?utf-8?b?UC4gQmVycmFuZ8Op?= , Thomas Huth Subject: [PULL 55/91] contrib/vhost-user-blk: enable it on any POSIX system Message-ID: <9c85f39cc547441c38f58469f9a4579ba131e348.1719929191.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Stefano Garzarella Let's make the code more portable by adding defines from block/file-posix.c to support O_DIRECT in other systems (e.g. macOS). vhost-user-server.c is a dependency, let's enable it for any POSIX system. Acked-by: Stefan Hajnoczi Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Signed-off-by: Stefano Garzarella Message-Id: <20240618100511.145789-1-sgarzare@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- contrib/vhost-user-blk/vhost-user-blk.c | 14 ++++++++++++++ meson.build | 2 -- util/meson.build | 4 +++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk/vhost-user-blk.c index 9492146855..a450337685 100644 --- a/contrib/vhost-user-blk/vhost-user-blk.c +++ b/contrib/vhost-user-blk/vhost-user-blk.c @@ -25,6 +25,20 @@ #include #endif +/* OS X does not have O_DSYNC */ +#ifndef O_DSYNC +#ifdef O_SYNC +#define O_DSYNC O_SYNC +#elif defined(O_FSYNC) +#define O_DSYNC O_FSYNC +#endif +#endif + +/* Approximate O_DIRECT with O_DSYNC if O_DIRECT isn't available */ +#ifndef O_DIRECT +#define O_DIRECT O_DSYNC +#endif + enum { VHOST_USER_BLK_MAX_QUEUES = 8, }; diff --git a/meson.build b/meson.build index 6c1a489cc0..a947b83c3f 100644 --- a/meson.build +++ b/meson.build @@ -2026,8 +2026,6 @@ has_statx = cc.has_header_symbol('sys/stat.h', 'STATX_BASIC_STATS', prefix: gnu_ has_statx_mnt_id = cc.has_header_symbol('sys/stat.h', 'STATX_MNT_ID', prefix: gnu_source_prefix) have_vhost_user_blk_server = get_option('vhost_user_blk_server') \ - .require(host_os == 'linux', - error_message: 'vhost_user_blk_server requires linux') \ .require(have_vhost_user, error_message: 'vhost_user_blk_server requires vhost-user support') \ .disable_auto_if(not have_tools and not have_system) \ diff --git a/util/meson.build b/util/meson.build index 72b505df11..c414178ace 100644 --- a/util/meson.build +++ b/util/meson.build @@ -112,10 +112,12 @@ if have_block util_ss.add(files('filemonitor-stub.c')) endif if host_os == 'linux' - util_ss.add(files('vhost-user-server.c'), vhost_user) util_ss.add(files('vfio-helpers.c')) util_ss.add(files('chardev_open.c')) endif + if host_os != 'windows' + util_ss.add(files('vhost-user-server.c'), vhost_user) + endif util_ss.add(files('yank.c')) endif From patchwork Tue Jul 2 14:09:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719725 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1796AC30658 for ; Tue, 2 Jul 2024 14:11:36 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeCw-0002tE-Mz; Tue, 02 Jul 2024 10:10: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 1sOeCn-0002PY-C5 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10: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 1sOeCj-0008Tg-ND for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929397; 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=nT/3bEAHv/ccVmumWuUDEQosc383NR5xwSBkJ1pU+nE=; b=bgr8LZwJBDc37o3tYJtAlQ+89oyllngAAiN9f3JkOErNkfKubwypqLw1KL8Xr2jACmiscH rDVfjIspKvjMrXTN0KM+zmbun5A4QgIeGbs/s7ieugVIc1NZghZ3WN+7jthUI6fz0eRIDp 5QHvvVZJqPRoD8L95WpL6Tie+cx0WKc= 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-210-9Hs4qyHnOZ6o9gY66VlXxg-1; Tue, 02 Jul 2024 10:09:55 -0400 X-MC-Unique: 9Hs4qyHnOZ6o9gY66VlXxg-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4257a75193aso19235545e9.1 for ; Tue, 02 Jul 2024 07:09:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929394; x=1720534194; 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=nT/3bEAHv/ccVmumWuUDEQosc383NR5xwSBkJ1pU+nE=; b=MFuqKpTgFytgX2Z7/T2mIlQaDMg5lWSAsuRxPzktX8EdN0GSplwujoJTUXRLQl2n9m 2UZFbSwc1i56hqzeEs/7plJpb445UYZCJBaNjJRRY2ZhKC66jLPq487YqtB1DoVSLHf/ xujtCSKD/KVI9awhleKulYs4co2v1jyqD5KBtWf0wa/QD/rQUhdzpqG8F7f8hPE/V2gV h31NTzYd0fvqT2aVNCWUiAc6kHZvqqTRKjKvHRT6HeMfY7Vta3qjCQHyz/+dUU46XU+D tIVt2xaRA7Lgc3wvTPr+spy1wbMACq93L7tQMXwPTG9CFGVF33DoDqK72ub/2c0b8g/M +z9w== X-Gm-Message-State: AOJu0YxjeYbAIfw5fxLXNxfndCkn3GQmzRMU5DmTv3gcKMSYwJVHzX0Q moK/3zJQljm3sEs1GNc6+aPXtnE/WSoWwJu8ScGLYIwUNlw1P3cf+ehWtjDIxIUBvy+Ds3oorkJ 2VBsewmDQKu4Yisc+R0GpwYnamjwkw5PU4WG3/ZWl5IcMvqX9zVvT8amPskktA8Mwt8KWjb7zBY kPT2sxVULtRNQ8jQOH0kn2aw5Eq9A1Ow== X-Received: by 2002:a05:600c:54e7:b0:424:aa41:4c15 with SMTP id 5b1f17b1804b1-4257a0111b5mr58787515e9.22.1719929394063; Tue, 02 Jul 2024 07:09:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF4uRHHq2OlHa1YnnTedsaGn+sZTzHI7rfvWZtB82w1gzbsZfi0Hg091M5CEhcBW1EzVea6dg== X-Received: by 2002:a05:600c:54e7:b0:424:aa41:4c15 with SMTP id 5b1f17b1804b1-4257a0111b5mr58787205e9.22.1719929393377; Tue, 02 Jul 2024 07:09:53 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af55d0fsm197933995e9.19.2024.07.02.07.09.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:09:52 -0700 (PDT) Date: Tue, 2 Jul 2024 10:09:47 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefano Garzarella , David Hildenbrand , Stefan Hajnoczi , Markus Armbruster , Igor Mammedov , Paolo Bonzini , Daniel =?utf-8?b?UC4gQmVycmFuZ8Op?= , Eduardo Habkost , Eric Blake Subject: [PULL 56/91] hostmem: add a new memory backend based on POSIX shm_open() 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Stefano Garzarella shm_open() creates and opens a new POSIX shared memory object. A POSIX shared memory object allows creating memory backend with an associated file descriptor that can be shared with external processes (e.g. vhost-user). The new `memory-backend-shm` can be used as an alternative when `memory-backend-memfd` is not available (Linux only), since shm_open() should be provided by any POSIX-compliant operating system. This backend mimics memfd, allocating memory that is practically anonymous. In theory shm_open() requires a name, but this is allocated for a short time interval and shm_unlink() is called right after shm_open(). After that, only fd is shared with external processes (e.g., vhost-user) as if it were associated with anonymous memory. In the future we may also allow the user to specify the name to be passed to shm_open(), but for now we keep the backend simple, mimicking anonymous memory such as memfd. Acked-by: David Hildenbrand Acked-by: Stefan Hajnoczi Acked-by: Markus Armbruster (QAPI schema) Signed-off-by: Stefano Garzarella Message-Id: <20240618100519.145853-1-sgarzare@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- qapi/qom.json | 23 +++++- backends/hostmem-shm.c | 123 +++++++++++++++++++++++++++++ backends/meson.build | 1 + docs/system/devices/vhost-user.rst | 5 +- qemu-options.hx | 16 ++++ 5 files changed, 164 insertions(+), 4 deletions(-) create mode 100644 backends/hostmem-shm.c diff --git a/qapi/qom.json b/qapi/qom.json index 9b8f6a7ab5..92b0fea76c 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -601,8 +601,8 @@ # # @share: if false, the memory is private to QEMU; if true, it is # shared (default false for backends memory-backend-file and -# memory-backend-ram, true for backends memory-backend-epc and -# memory-backend-memfd) +# memory-backend-ram, true for backends memory-backend-epc, +# memory-backend-memfd, and memory-backend-shm) # # @reserve: if true, reserve swap space (or huge pages) if applicable # (default: true) (since 6.1) @@ -721,6 +721,21 @@ '*hugetlbsize': 'size', '*seal': 'bool' } } +## +# @MemoryBackendShmProperties: +# +# Properties for memory-backend-shm objects. +# +# This memory backend supports only shared memory, which is the +# default. +# +# Since: 9.1 +## +{ 'struct': 'MemoryBackendShmProperties', + 'base': 'MemoryBackendProperties', + 'data': { }, + 'if': 'CONFIG_POSIX' } + ## # @MemoryBackendEpcProperties: # @@ -1049,6 +1064,8 @@ { 'name': 'memory-backend-memfd', 'if': 'CONFIG_LINUX' }, 'memory-backend-ram', + { 'name': 'memory-backend-shm', + 'if': 'CONFIG_POSIX' }, 'pef-guest', { 'name': 'pr-manager-helper', 'if': 'CONFIG_LINUX' }, @@ -1121,6 +1138,8 @@ 'memory-backend-memfd': { 'type': 'MemoryBackendMemfdProperties', 'if': 'CONFIG_LINUX' }, 'memory-backend-ram': 'MemoryBackendProperties', + 'memory-backend-shm': { 'type': 'MemoryBackendShmProperties', + 'if': 'CONFIG_POSIX' }, 'pr-manager-helper': { 'type': 'PrManagerHelperProperties', 'if': 'CONFIG_LINUX' }, 'qtest': 'QtestProperties', diff --git a/backends/hostmem-shm.c b/backends/hostmem-shm.c new file mode 100644 index 0000000000..374edc3db8 --- /dev/null +++ b/backends/hostmem-shm.c @@ -0,0 +1,123 @@ +/* + * QEMU host POSIX shared memory object backend + * + * Copyright (C) 2024 Red Hat Inc + * + * Authors: + * Stefano Garzarella + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "sysemu/hostmem.h" +#include "qapi/error.h" + +#define TYPE_MEMORY_BACKEND_SHM "memory-backend-shm" + +OBJECT_DECLARE_SIMPLE_TYPE(HostMemoryBackendShm, MEMORY_BACKEND_SHM) + +struct HostMemoryBackendShm { + HostMemoryBackend parent_obj; +}; + +static bool +shm_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) +{ + g_autoptr(GString) shm_name = g_string_new(NULL); + g_autofree char *backend_name = NULL; + uint32_t ram_flags; + int fd, oflag; + mode_t mode; + + if (!backend->size) { + error_setg(errp, "can't create shm backend with size 0"); + return false; + } + + if (!backend->share) { + error_setg(errp, "can't create shm backend with `share=off`"); + return false; + } + + /* + * Let's use `mode = 0` because we don't want other processes to open our + * memory unless we share the file descriptor with them. + */ + mode = 0; + oflag = O_RDWR | O_CREAT | O_EXCL; + backend_name = host_memory_backend_get_name(backend); + + /* + * Some operating systems allow creating anonymous POSIX shared memory + * objects (e.g. FreeBSD provides the SHM_ANON constant), but this is not + * defined by POSIX, so let's create a unique name. + * + * From Linux's shm_open(3) man-page: + * For portable use, a shared memory object should be identified + * by a name of the form /somename;" + */ + g_string_printf(shm_name, "/qemu-" FMT_pid "-shm-%s", getpid(), + backend_name); + + fd = shm_open(shm_name->str, oflag, mode); + if (fd < 0) { + error_setg_errno(errp, errno, + "failed to create POSIX shared memory"); + return false; + } + + /* + * We have the file descriptor, so we no longer need to expose the + * POSIX shared memory object. However it will remain allocated as long as + * there are file descriptors pointing to it. + */ + shm_unlink(shm_name->str); + + if (ftruncate(fd, backend->size) == -1) { + error_setg_errno(errp, errno, + "failed to resize POSIX shared memory to %" PRIu64, + backend->size); + close(fd); + return false; + } + + ram_flags = RAM_SHARED; + ram_flags |= backend->reserve ? 0 : RAM_NORESERVE; + + return memory_region_init_ram_from_fd(&backend->mr, OBJECT(backend), + backend_name, backend->size, + ram_flags, fd, 0, errp); +} + +static void +shm_backend_instance_init(Object *obj) +{ + HostMemoryBackendShm *m = MEMORY_BACKEND_SHM(obj); + + MEMORY_BACKEND(m)->share = true; +} + +static void +shm_backend_class_init(ObjectClass *oc, void *data) +{ + HostMemoryBackendClass *bc = MEMORY_BACKEND_CLASS(oc); + + bc->alloc = shm_backend_memory_alloc; +} + +static const TypeInfo shm_backend_info = { + .name = TYPE_MEMORY_BACKEND_SHM, + .parent = TYPE_MEMORY_BACKEND, + .instance_init = shm_backend_instance_init, + .class_init = shm_backend_class_init, + .instance_size = sizeof(HostMemoryBackendShm), +}; + +static void register_types(void) +{ + type_register_static(&shm_backend_info); +} + +type_init(register_types); diff --git a/backends/meson.build b/backends/meson.build index 106312f0c8..749b491f12 100644 --- a/backends/meson.build +++ b/backends/meson.build @@ -13,6 +13,7 @@ system_ss.add([files( if host_os != 'windows' system_ss.add(files('rng-random.c')) system_ss.add(files('hostmem-file.c')) + system_ss.add([files('hostmem-shm.c'), rt]) endif if host_os == 'linux' system_ss.add(files('hostmem-memfd.c')) diff --git a/docs/system/devices/vhost-user.rst b/docs/system/devices/vhost-user.rst index 9b2da106ce..35259d8ec7 100644 --- a/docs/system/devices/vhost-user.rst +++ b/docs/system/devices/vhost-user.rst @@ -98,8 +98,9 @@ Shared memory object In order for the daemon to access the VirtIO queues to process the requests it needs access to the guest's address space. This is -achieved via the ``memory-backend-file`` or ``memory-backend-memfd`` -objects. A reference to a file-descriptor which can access this object +achieved via the ``memory-backend-file``, ``memory-backend-memfd``, or +``memory-backend-shm`` objects. +A reference to a file-descriptor which can access this object will be passed via the socket as part of the protocol negotiation. Currently the shared memory object needs to match the size of the main diff --git a/qemu-options.hx b/qemu-options.hx index 8ca7f34ef0..ad6521ef5e 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -5240,6 +5240,22 @@ SRST The ``share`` boolean option is on by default with memfd. + ``-object memory-backend-shm,id=id,merge=on|off,dump=on|off,share=on|off,prealloc=on|off,size=size,host-nodes=host-nodes,policy=default|preferred|bind|interleave`` + Creates a POSIX shared memory backend object, which allows + QEMU to share the memory with an external process (e.g. when + using vhost-user). + + ``memory-backend-shm`` is a more portable and less featureful version + of ``memory-backend-memfd``. It can then be used in any POSIX system, + especially when memfd is not supported. + + Please refer to ``memory-backend-file`` for a description of the + options. + + The ``share`` boolean option is on by default with shm. Setting it to + off will cause a failure during allocation because it is not supported + by this backend. + ``-object iommufd,id=id[,fd=fd]`` Creates an iommufd backend which allows control of DMA mapping through the ``/dev/iommu`` device. From patchwork Tue Jul 2 14:09:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719721 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AD986C3064D for ; Tue, 2 Jul 2024 14:11:15 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeD9-0003no-0u; Tue, 02 Jul 2024 10:10: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 1sOeCz-00038j-Cq for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:13 -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 1sOeCm-0008UC-D1 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929399; 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=R3m1Xw9Ub15rW4o3esEC0MkiVgr91nuiCfcAKrltL4I=; b=W3VW8c7kY8m9GB2o+H2rbZvWdtymoNlr6JBtVNaCZZ/5oSdB2Z3JJZcdUKZSKzMYicOP+u LjpHQZnJUR1dVlXn5SlVdOr48O+TQyQYjcXke1JshHOF9pe03WQsj3Ub6WWhXOwJPP4bVA tA4VTbkQKFejlqrTrPMRToCUgSRJZDE= 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-462-mvfk0eRONjejOoDZDgbL_w-1; Tue, 02 Jul 2024 10:09:58 -0400 X-MC-Unique: mvfk0eRONjejOoDZDgbL_w-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4258675a531so12042875e9.3 for ; Tue, 02 Jul 2024 07:09:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929397; x=1720534197; 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=R3m1Xw9Ub15rW4o3esEC0MkiVgr91nuiCfcAKrltL4I=; b=mg1rx3WnZd5+UaLRp2estZ+q174sxddDdM0ZkwXAs1ymUimQRTauOlbejhlzNvYIK8 yYpSZ17Fdi7PPtSr+BpPmGrm4sArHijV8wZE0PWO8vC/rSd8Bv4cto3pIMXEFsSNGBHv XItzHc+fvmuFMUTG343/sYB6ByYOrbk+RG2B9wTZc3IucsniiepcPJNK2KHhaL7CwzR9 QVLZWTVXUK22buDAf21lhobucdEkt8AZ42esT0i8DegKfkmS0g1N8VFVOc7GNBWFyaV7 xfHbW+FYegtrCChn4Y5FREXctojtUNt4cVknJx5NXT2rBQj3+zKXNydIoiCTSjjh+JLS NQ8Q== X-Gm-Message-State: AOJu0Yw3ZJJx+NZCp4Q3i7qSQ6EvR4MGhPlscic+Z+as+CHwHKtfSOP6 d55tRRcE33pUFpREtayoNFWSiF/m1izsgCPlz+zNNka7lfFyG4Z+A5IY/9wqaRKY6V6EBwbNjvu l3WBuHtfN+vy4OBFPjiLGDqjMV4lW2psFSqAkxF3gGzADOQzbfnu3w1njLi9Hk9uNRJvWkU9rQS 6FMFYqfSmn3OI3oOdGSKYfLwAolEd/Cg== X-Received: by 2002:a05:600c:4fd6:b0:425:6fe4:5472 with SMTP id 5b1f17b1804b1-4257a00aab9mr58442915e9.2.1719929396849; Tue, 02 Jul 2024 07:09:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHk/LF8ZodaFy/BNUOoJ/VaWcxPCUuYc5QH9ugeJsd02gz8Ub+/tUp56Ox4TYW1JhlBnTWJ5w== X-Received: by 2002:a05:600c:4fd6:b0:425:6fe4:5472 with SMTP id 5b1f17b1804b1-4257a00aab9mr58442605e9.2.1719929396264; Tue, 02 Jul 2024 07:09:56 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0e1481sm13327925f8f.55.2024.07.02.07.09.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:09:55 -0700 (PDT) Date: Tue, 2 Jul 2024 10:09:53 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefano Garzarella , Thomas Huth , Stefan Hajnoczi , Philippe =?utf-8?q?Mathieu-Daud?= =?utf-8?q?=C3=A9?= , David Hildenbrand , Coiby Xu , Laurent Vivier , Paolo Bonzini Subject: [PULL 57/91] tests/qtest/vhost-user-blk-test: use memory-backend-shm 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Stefano Garzarella `memory-backend-memfd` is available only on Linux while the new `memory-backend-shm` can be used on any POSIX-compliant operating system. Let's use it so we can run the test in multiple environments. Since we are here, let`s remove `share=on` which is the default for shm (and also for memfd). Acked-by: Thomas Huth Acked-by: Stefan Hajnoczi Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Reviewed-by: David Hildenbrand Signed-off-by: Stefano Garzarella Message-Id: <20240618100527.145883-1-sgarzare@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/vhost-user-blk-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qtest/vhost-user-blk-test.c b/tests/qtest/vhost-user-blk-test.c index 117b9acd10..ea90d41232 100644 --- a/tests/qtest/vhost-user-blk-test.c +++ b/tests/qtest/vhost-user-blk-test.c @@ -906,7 +906,7 @@ static void start_vhost_user_blk(GString *cmd_line, int vus_instances, vhost_user_blk_bin); g_string_append_printf(cmd_line, - " -object memory-backend-memfd,id=mem,size=256M,share=on " + " -object memory-backend-shm,id=mem,size=256M " " -M memory-backend=mem -m 256M "); for (i = 0; i < vus_instances; i++) { From patchwork Tue Jul 2 14:09:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719803 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E11A5C3064D for ; Tue, 2 Jul 2024 14:26:05 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeD2-0003ID-3t; Tue, 02 Jul 2024 10:10: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 1sOeCr-0002ao-P1 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10: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 1sOeCp-0008WM-VW for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929403; 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=QybIKg16iYqXdH14Jxyn469nV1P/mwHXBmUUNkfpRqo=; b=dN8AFhR4kpaVxVvIBxNIdYeD4O6ayMSdwkCCAyZ4DAEDDdlJDdMXALGl1gTmRrS+mvrggA tbDBgkQBvOe9JyI1E5K0qJRX6cL0n2+zah7UMstenfRIGzWDXZFxP8owJQoDnJAVesA4mw SLiu1LeFY9rfarL1WobAB3bT/OTLzUc= 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-349-IzU3b0dGNTSMrW5A3mAHLA-1; Tue, 02 Jul 2024 10:10:02 -0400 X-MC-Unique: IzU3b0dGNTSMrW5A3mAHLA-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-425739141c2so27419685e9.2 for ; Tue, 02 Jul 2024 07:10:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929400; x=1720534200; 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=QybIKg16iYqXdH14Jxyn469nV1P/mwHXBmUUNkfpRqo=; b=dgMag1O+L9zfSuyR3ef/qa6fcegdFa2A7g+JGLTdlH0zVYfGBh0jMJ/9yIIhcwlzYq rGEHMVFzsZmUPE14wb3QIAel3I+A1kVL2wmwkWniDj7uIGY1VX7pXBQ3MLXRcUMIl8Xp H+LGhhxbwgmHuo1md8YzdqLQQLyNSfLY4kjWyxbRR1RYK9JMHgJtVt7tSmIwFk44wfkw LT4RAuNdy6EG7fN0nUmg+/RpX2Q6hoOHl3VvED9Ru3hJGket1+ICa84/GKfilJ5i4nZa 3o3fXJlCdapAQz6qLhRHiI1ZQKiMQ08IXLwRUgz3kcb7DHROUXZBNobHTLfpOX1pVKjD HiwA== X-Gm-Message-State: AOJu0YxJOfNviLfKNVM9/QMig7Z4J44z6v5IXhUbhcR4uH1a7mbNlq/n mbj9ZzMxcW82YJL38SyWqNdYUK9mr+ldLSPj1c9ntZGtPv+Eq8e2kBTiKTCOy5Gh5Kdwsh2ClJB zPpNyeHvf3g82cm409Idak1bwHX1rHbIM9jgTDvKdiwRcDITWGCr72pWxWIjuxWo+3u/dcBuXk3 cm2Bq9jMww5xkv0P6Zs1bAN/PBOJxgzg== X-Received: by 2002:a05:600c:12c6:b0:424:ada1:6d9 with SMTP id 5b1f17b1804b1-4257a088e18mr77320925e9.34.1719929400501; Tue, 02 Jul 2024 07:10:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEl9FmzUp/EUK4GA1u0LQgSGoi2TW/FrnRT0JL5BVAGCmriZME0X4VREmN1CxYhw9ApWTydYA== X-Received: by 2002:a05:600c:12c6:b0:424:ada1:6d9 with SMTP id 5b1f17b1804b1-4257a088e18mr77320605e9.34.1719929399897; Tue, 02 Jul 2024 07:09:59 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b09890dsm200112335e9.36.2024.07.02.07.09.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:09:59 -0700 (PDT) Date: Tue, 2 Jul 2024 10:09:56 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefano Garzarella , Thomas Huth , Stefan Hajnoczi , David Hildenbrand , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Laurent Vivier , Paolo Bonzini Subject: [PULL 58/91] tests/qtest/vhost-user-test: add a test case for memory-backend-shm 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Stefano Garzarella `memory-backend-shm` can be used with vhost-user devices, so let's add a new test case for it. Acked-by: Thomas Huth Acked-by: Stefan Hajnoczi Reviewed-by: David Hildenbrand Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Stefano Garzarella Message-Id: <20240618100534.145917-1-sgarzare@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/vhost-user-test.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index 255bde54ab..0fa8951c9f 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -44,6 +44,8 @@ "mem-path=%s,share=on -numa node,memdev=mem" #define QEMU_CMD_MEMFD " -m %d -object memory-backend-memfd,id=mem,size=%dM," \ " -numa node,memdev=mem" +#define QEMU_CMD_SHM " -m %d -object memory-backend-shm,id=mem,size=%dM," \ + " -numa node,memdev=mem" #define QEMU_CMD_CHR " -chardev socket,id=%s,path=%s%s" #define QEMU_CMD_NETDEV " -netdev vhost-user,id=hs0,chardev=%s,vhostforce=on" @@ -195,6 +197,7 @@ enum test_memfd { TEST_MEMFD_AUTO, TEST_MEMFD_YES, TEST_MEMFD_NO, + TEST_MEMFD_SHM, }; static void append_vhost_net_opts(TestServer *s, GString *cmd_line, @@ -228,6 +231,8 @@ static void append_mem_opts(TestServer *server, GString *cmd_line, if (memfd == TEST_MEMFD_YES) { g_string_append_printf(cmd_line, QEMU_CMD_MEMFD, size, size); + } else if (memfd == TEST_MEMFD_SHM) { + g_string_append_printf(cmd_line, QEMU_CMD_SHM, size, size); } else { const char *root = init_hugepagefs() ? : server->tmpfs; @@ -791,6 +796,19 @@ static void *vhost_user_test_setup_memfd(GString *cmd_line, void *arg) return server; } +static void *vhost_user_test_setup_shm(GString *cmd_line, void *arg) +{ + TestServer *server = test_server_new("vhost-user-test", arg); + test_server_listen(server); + + append_mem_opts(server, cmd_line, 256, TEST_MEMFD_SHM); + server->vu_ops->append_opts(server, cmd_line, ""); + + g_test_queue_destroy(vhost_user_test_cleanup, server); + + return server; +} + static void test_read_guest_mem(void *obj, void *arg, QGuestAllocator *alloc) { TestServer *server = arg; @@ -1084,6 +1102,11 @@ static void register_vhost_user_test(void) "virtio-net", test_read_guest_mem, &opts); + opts.before = vhost_user_test_setup_shm; + qos_add_test("vhost-user/read-guest-mem/shm", + "virtio-net", + test_read_guest_mem, &opts); + if (qemu_memfd_check(MFD_ALLOW_SEALING)) { opts.before = vhost_user_test_setup_memfd; qos_add_test("vhost-user/read-guest-mem/memfd", From patchwork Tue Jul 2 14:10:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719744 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 038D1C3064D for ; Tue, 2 Jul 2024 14:13:09 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeD1-0003AZ-JV; Tue, 02 Jul 2024 10:10: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 1sOeCv-0002nc-G3 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10: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 1sOeCt-0000FH-2r for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929406; 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=/8Z7JyQo+HEEofucdvOkehCzjauROI/8uJ9hGYzaVe8=; b=NeT/gFBhcV/D7OB5oTDHUElsFegm/YIXrogtle7ho6FqlOl3oS3n8uflevn8cYEd9MdIIu vm3lpoqOoO11XCGCVdCvawNWa40pRGWQeVIaWAPxMANM0AdLY/bG8eiikOhS9oay4S+TtU I32W2enBgvA/Tv50dxKySg1oCEWoIWA= 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-414-M2u2y-SPMWGZUqRdWZVdeA-1; Tue, 02 Jul 2024 10:10:05 -0400 X-MC-Unique: M2u2y-SPMWGZUqRdWZVdeA-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2ec60e68c81so41338891fa.3 for ; Tue, 02 Jul 2024 07:10:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929403; x=1720534203; 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=/8Z7JyQo+HEEofucdvOkehCzjauROI/8uJ9hGYzaVe8=; b=Gp9IvlYu7ueQi6JVLRt/St01d0ZAb1CEVQeuxXn6+WSNan38X85NVXndauYc0hcLIN kYMUmN+eO9gZQU+m2ft/dPJmJkoh7lcy+i8/t48M7Y37mtjgeWOO8RHWoFxXSxwYSG4H EYcER6+zSmP7pHr39hP2kZH+P1H43nI1BoBGgK9IB9S4vJ4QIgxEsDdxDB7GyCmZSWeT Y7rpW6MlYVVyugVaLFI6nWhljWPJ/p46nBlC/523i7F2QsCsv7URMNl5CyXkISfgKIRz PLXqI22mw0tX9x3cRfw3VH7IqW+s8VM9CbwTte7BvYjOPCeA6qXij2+xs3RrhKyY++pS 5ZNQ== X-Gm-Message-State: AOJu0Ywds0Y168hILQgPq6u8DAV6lDqesls4VDUvoJ5AmoEq4BND0y9o 9/HYrAIY4EooN/Lr/EWlzrXex2qhvyec8Kk5wdX5Keb2UYAhLTz5/j53Fk3CVrebBmMQh5quzE4 uMiaObnYUlFJEYHr0EtbMXpq0x+hJpsxGfaX3OHbBYNjD/dCb7dd9lOsu4fSGH2BvsXcVERodJY 8EeGWPLBHS8uNMtccIv7rbtDZFp0vwaA== X-Received: by 2002:a05:651c:198b:b0:2ec:5843:2fbd with SMTP id 38308e7fff4ca-2ee5e6cd69cmr64760301fa.41.1719929403307; Tue, 02 Jul 2024 07:10:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG2vVM+J0u/21ILTnwbOyL1wB1+k03EWEAQcooVg3hcn1q7fxh17QTgSg6QJYKMZp9avWtzvw== X-Received: by 2002:a05:651c:198b:b0:2ec:5843:2fbd with SMTP id 38308e7fff4ca-2ee5e6cd69cmr64759971fa.41.1719929402706; Tue, 02 Jul 2024 07:10:02 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36787db4d12sm1976984f8f.110.2024.07.02.07.10.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:10:02 -0700 (PDT) Date: Tue, 2 Jul 2024 10:10:00 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Thomas Huth , Manos Pitsidianakis Subject: [PULL 59/91] hw/virtio: Fix the de-initialization of vhost-user devices 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Thomas Huth The unrealize functions of the various vhost-user devices are calling the corresponding vhost_*_set_status() functions with a status of 0 to shut down the device correctly. Now these vhost_*_set_status() functions all follow this scheme: bool should_start = virtio_device_should_start(vdev, status); if (vhost_dev_is_started(&vvc->vhost_dev) == should_start) { return; } if (should_start) { /* ... do the initialization stuff ... */ } else { /* ... do the cleanup stuff ... */ } The problem here is virtio_device_should_start(vdev, 0) currently always returns "true" since it internally only looks at vdev->started instead of looking at the "status" parameter. Thus once the device got started once, virtio_device_should_start() always returns true and thus the vhost_*_set_status() functions return early, without ever doing any clean-up when being called with status == 0. This causes e.g. problems when trying to hot-plug and hot-unplug a vhost user devices multiple times since the de-initialization step is completely skipped during the unplug operation. This bug has been introduced in commit 9f6bcfd99f ("hw/virtio: move vm_running check to virtio_device_started") which replaced should_start = status & VIRTIO_CONFIG_S_DRIVER_OK; with should_start = virtio_device_started(vdev, status); which later got replaced by virtio_device_should_start(). This blocked the possibility to set should_start to false in case the status flag VIRTIO_CONFIG_S_DRIVER_OK was not set. Fix it by adjusting the virtio_device_should_start() function to only consider the status flag instead of vdev->started. Since this function is only used in the various vhost_*_set_status() functions for exactly the same purpose, it should be fine to fix it in this central place there without any risk to change the behavior of other code. Fixes: 9f6bcfd99f ("hw/virtio: move vm_running check to virtio_device_started") Buglink: https://issues.redhat.com/browse/RHEL-40708 Signed-off-by: Thomas Huth Message-Id: <20240618121958.88673-1-thuth@redhat.com> Reviewed-by: Manos Pitsidianakis Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/virtio.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index 1451926a13..7512afbc84 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -472,9 +472,9 @@ static inline bool virtio_device_started(VirtIODevice *vdev, uint8_t status) * @vdev - the VirtIO device * @status - the devices status bits * - * This is similar to virtio_device_started() but also encapsulates a - * check on the VM status which would prevent a device starting - * anyway. + * This is similar to virtio_device_started() but ignores vdev->started + * and also encapsulates a check on the VM status which would prevent a + * device from starting anyway. */ static inline bool virtio_device_should_start(VirtIODevice *vdev, uint8_t status) { @@ -482,7 +482,7 @@ static inline bool virtio_device_should_start(VirtIODevice *vdev, uint8_t status return false; } - return virtio_device_started(vdev, status); + return status & VIRTIO_CONFIG_S_DRIVER_OK; } static inline void virtio_set_started(VirtIODevice *vdev, bool started) From patchwork Tue Jul 2 14:10:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719749 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 64458C3064D for ; Tue, 2 Jul 2024 14:13:29 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeD4-0003U8-59; Tue, 02 Jul 2024 10:10: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 1sOeCy-00035W-Qn for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:12 -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 1sOeCw-0000H5-SX for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929410; 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=SUxXXLDnAjmmN0Yi+4nhd+mhBCkrJEwNWiEK8gau7L4=; b=g9QFwDEFaRh+R/WykTlie0CjcwXyBMxtOx+sOxSnqingws+2u81SfXE3ydj2g9YPnAXESq cYnEvxflLhwC7GuQgbgvw1KPaa3OAtAKhHjBXSKMBQ5FDd0KJa4sg+Gs0MVupuQsaZ+pxE nJbRVdWSNLfxGZ1ZadaZHIPWOrRMxHw= 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-601-XoqE_xaUMr6hKXaV3lPEAg-1; Tue, 02 Jul 2024 10:10:08 -0400 X-MC-Unique: XoqE_xaUMr6hKXaV3lPEAg-1 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2ec55065e52so38904251fa.2 for ; Tue, 02 Jul 2024 07:10:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929407; x=1720534207; 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=SUxXXLDnAjmmN0Yi+4nhd+mhBCkrJEwNWiEK8gau7L4=; b=L18Ab5u7xZMNHC2PIDM7BJGhz7VOeb0ENPGeYc18Q2nftmGiHuasUDkfeQmDAfmQuc 5skAEuucpsVofR0nS1g/zbz1OlKTV/5zWUurJ06q+E1hUzr1zqaDD6RCi40T/fdv+eKn ZO+wKf118VZVEsir4AMWCh0hBT/ft1t2Ru7j1rkksREv/wBzutRwFIrp1mZpXUZ5tIxM 6vQsgMUqmzSG/5jVd2KInAu6/PFr5KC5m6j6FSHpJL5TR6uoa3V2fuYFBrTu1jR40ww1 9NMuLpjFvPxG21RlgY/h5QOqtqL4uvU8cBEDkeuE2fTw6eT6jgjhGZDH2RovHMOihtAQ Fwqw== X-Gm-Message-State: AOJu0YyUajnf9vIZfijoxaJRMBL2WcCcfX5gDWsbjyReHXw90aJMMXza K5qXEdQPcFncesMibW+YnS9ofZ92awzJIo+Ei5TrRh5KeZbN1ShGkQISJkfnxSAkzC7uIEjowf9 bTp5akCkW7lUkPQsYOtCrpqghhAr2ShMc8DP7fRWAxi5FiWeaLaY4W9qjQvJGTRXBcgjt9BoQOX f0O8+Jruy9VbT/nFT5tf+vwHLYWG/EuQ== X-Received: by 2002:a05:6512:33cd:b0:52c:e1e1:ae91 with SMTP id 2adb3069b0e04-52e8264be16mr6461259e87.11.1719929407029; Tue, 02 Jul 2024 07:10:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF5HGFD8Gtl1xhibEEU4DuyU74dPhGRwW3+0HCQ5rRmx1zTOaVGlux2qXBFPeZaNzPYhEArKQ== X-Received: by 2002:a05:6512:33cd:b0:52c:e1e1:ae91 with SMTP id 2adb3069b0e04-52e8264be16mr6461215e87.11.1719929405946; Tue, 02 Jul 2024 07:10:05 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0fba0bsm13305331f8f.69.2024.07.02.07.10.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:10:05 -0700 (PDT) Date: Tue, 2 Jul 2024 10:10:02 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Nicolin Chen , Richard Henderson , Eric Auger , Igor Mammedov , Ani Sinha , Shannon Zhao , qemu-arm@nongnu.org Subject: [PULL 60/91] hw/arm/virt-acpi-build: Drop local iort_node_offset 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Nicolin Chen Both the other two callers of build_iort_id_mapping() just directly pass in the IORT_NODE_OFFSET macro. Keeping a "const uint32_t" local variable storing the same value doesn't have any gain. Simplify this by replacing the only place using this local variable with the macro directly. Signed-off-by: Nicolin Chen Message-Id: <20240619001708.926511-1-nicolinc@nvidia.com> Reviewed-by: Richard Henderson Reviewed-by: Eric Auger Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/arm/virt-acpi-build.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index b2366f24f9..102e2da934 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -269,7 +269,6 @@ static void build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) { int i, nb_nodes, rc_mapping_count; - const uint32_t iort_node_offset = IORT_NODE_OFFSET; size_t node_size, smmu_offset = 0; AcpiIortIdMapping *idmap; uint32_t id = 0; @@ -415,7 +414,7 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) range = &g_array_index(its_idmaps, AcpiIortIdMapping, i); /* output IORT node is the ITS group node (the first node) */ build_iort_id_mapping(table_data, range->input_base, - range->id_count, iort_node_offset); + range->id_count, IORT_NODE_OFFSET); } } else { /* output IORT node is the ITS group node (the first node) */ From patchwork Tue Jul 2 14:10:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719728 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A6393C30658 for ; Tue, 2 Jul 2024 14:11:52 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeDF-0004HR-P6; Tue, 02 Jul 2024 10:10:29 -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 1sOeD3-0003PL-Df for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10: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 1sOeD1-0000IE-7U for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929414; 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=SNwFHLByhZ9Qs1kayFDYHhFkt3XkniLJLO/2kGyAGIU=; b=NymRrvByrFLdtxq0SGmrbJsswsL8OPIk1SrOzPz819bIgPHuY4QM09xAQzDFvErXdPP80X OhpI/h7uP3cA4SoWo55BipKnz6xKqInoF8qszZKf7+qhqIUL4NO/TYDpFbgOu/FnnqRUIB aeQVXUuNpaP7U6cmzazWDWGmfYuuqS0= 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-575-5IewY_O7O5eLKeft1x8Xyw-1; Tue, 02 Jul 2024 10:10:12 -0400 X-MC-Unique: 5IewY_O7O5eLKeft1x8Xyw-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-42566e8a9efso39095095e9.2 for ; Tue, 02 Jul 2024 07:10:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929410; x=1720534210; 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=SNwFHLByhZ9Qs1kayFDYHhFkt3XkniLJLO/2kGyAGIU=; b=sY/vrbxuBZEHMKEKEUorE4t+1oDYMSOAVJ4hhoNqvfzzwA9XEErEHd98mVvowQXA7S gobcCBNkX9PueJtET1gQKhKK3gpQNYqMia5gSKupys/2X7tpmjn65a7otPSK8x8kxTaD EZkE7BIvA5/1SBTjvFBETzGBT3AMm5GvJ9IjjrtK6wbdVlurZ9OqadSlDZ54t+dYxvzU VsUsHyEqPStWjqNFZjC7HqcsBNYEJ/YR/fR/RWd0C1SM1TTf3QjRRjVIzdVUFbI16DXu SV9FVMh2ByDM+rOPDblDLySZevsAiDCFib0Q5lu7q84uOQF3idOf3fwxAQTLB/1v6GOj tz4A== X-Gm-Message-State: AOJu0YwLNo2AqbokmrcLsxQHezfhMLnaDCPgJwkjhJ9sNYT8pwBNFzEo yaIx2Pdvv+IXS8Au2Q6pfjM5UegGz2nzJpERkAEpLxosTe26iVGt0sfZ+llZcxdTz/Z0A499Ovk wzfC+H+2+Vgh2qE10NjSs1MNfFZxrFZ5Js29eEx9W1qGblNuGtdYsnD+SSBoUk0MNOV3sAyYV4z DgM2Y00LWh0a3Ry4fqw5kpwffGZrbhnA== X-Received: by 2002:a05:600c:3b8b:b0:425:8bf0:7659 with SMTP id 5b1f17b1804b1-4258bf0785amr14106005e9.9.1719929410581; Tue, 02 Jul 2024 07:10:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF2nHoCqso+sjxxE5A3Y3qgpPSKkOlJEY00W5Xrb62L9JbgqvkjIDIE4xy37xJnoLisJB7HHA== X-Received: by 2002:a05:600c:3b8b:b0:425:8bf0:7659 with SMTP id 5b1f17b1804b1-4258bf0785amr14105585e9.9.1719929409862; Tue, 02 Jul 2024 07:10:09 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4257cdf4982sm120640705e9.47.2024.07.02.07.10.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:10:09 -0700 (PDT) Date: Tue, 2 Jul 2024 10:10:06 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , David Woodhouse , David Woodhouse , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum , Sergio Lopez , Marcelo Tosatti , Paul Durrant , kvm@vger.kernel.org Subject: [PULL 61/91] hw/i386/fw_cfg: Add etc/e820 to fw_cfg late Message-ID: <36574004704d6c4704aba27f3b3f0f37d6d00d00.1719929191.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: David Woodhouse In e820_add_entry() the e820_table is reallocated with g_renew() to make space for a new entry. However, fw_cfg_arch_create() just uses the existing e820_table pointer. This leads to a use-after-free if anything adds a new entry after fw_cfg is set up. Shift the addition of the etc/e820 file to the machine done notifier, via a new fw_cfg_add_e820() function. Also make e820_table private and use an e820_get_table() accessor function for it, which sets a flag that will trigger an assert() for any *later* attempts to add to the table. Make e820_add_entry() return void, as most callers don't check for error anyway. Signed-off-by: David Woodhouse Message-Id: Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/e820_memory_layout.h | 8 ++------ hw/i386/fw_cfg.h | 1 + hw/i386/e820_memory_layout.c | 16 +++++++++++----- hw/i386/fw_cfg.c | 18 +++++++++++++----- hw/i386/microvm.c | 4 ++-- hw/i386/pc.c | 1 + target/i386/kvm/kvm.c | 6 +----- target/i386/kvm/xen-emu.c | 7 +------ 8 files changed, 32 insertions(+), 29 deletions(-) diff --git a/hw/i386/e820_memory_layout.h b/hw/i386/e820_memory_layout.h index 7c239aa033..b50acfa201 100644 --- a/hw/i386/e820_memory_layout.h +++ b/hw/i386/e820_memory_layout.h @@ -22,13 +22,9 @@ struct e820_entry { uint32_t type; } QEMU_PACKED __attribute((__aligned__(4))); -extern struct e820_entry *e820_table; - -int e820_add_entry(uint64_t address, uint64_t length, uint32_t type); -int e820_get_num_entries(void); +void e820_add_entry(uint64_t address, uint64_t length, uint32_t type); bool e820_get_entry(int index, uint32_t type, uint64_t *address, uint64_t *length); - - +int e820_get_table(struct e820_entry **table); #endif diff --git a/hw/i386/fw_cfg.h b/hw/i386/fw_cfg.h index 92e310f5fd..e560fd7be8 100644 --- a/hw/i386/fw_cfg.h +++ b/hw/i386/fw_cfg.h @@ -27,5 +27,6 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, SmbiosEntryPointType ep_type); void fw_cfg_build_feature_control(MachineState *ms, FWCfgState *fw_cfg); void fw_cfg_add_acpi_dsdt(Aml *scope, FWCfgState *fw_cfg); +void fw_cfg_add_e820(FWCfgState *fw_cfg); #endif diff --git a/hw/i386/e820_memory_layout.c b/hw/i386/e820_memory_layout.c index 06970ac44a..0d549accbf 100644 --- a/hw/i386/e820_memory_layout.c +++ b/hw/i386/e820_memory_layout.c @@ -11,22 +11,28 @@ #include "e820_memory_layout.h" static size_t e820_entries; -struct e820_entry *e820_table; +static struct e820_entry *e820_table; +static gboolean e820_done; -int e820_add_entry(uint64_t address, uint64_t length, uint32_t type) +void e820_add_entry(uint64_t address, uint64_t length, uint32_t type) { + assert(!e820_done); + /* new "etc/e820" file -- include ram and reserved entries */ e820_table = g_renew(struct e820_entry, e820_table, e820_entries + 1); e820_table[e820_entries].address = cpu_to_le64(address); e820_table[e820_entries].length = cpu_to_le64(length); e820_table[e820_entries].type = cpu_to_le32(type); e820_entries++; - - return e820_entries; } -int e820_get_num_entries(void) +int e820_get_table(struct e820_entry **table) { + e820_done = true; + + if (table) + *table = e820_table; + return e820_entries; } diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c index 7c43c325ef..0e4494627c 100644 --- a/hw/i386/fw_cfg.c +++ b/hw/i386/fw_cfg.c @@ -48,6 +48,15 @@ const char *fw_cfg_arch_key_name(uint16_t key) return NULL; } +/* Add etc/e820 late, once all regions should be present */ +void fw_cfg_add_e820(FWCfgState *fw_cfg) +{ + struct e820_entry *table; + int nr_e820 = e820_get_table(&table); + + fw_cfg_add_file(fw_cfg, "etc/e820", table, nr_e820 * sizeof(*table)); +} + void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, SmbiosEntryPointType ep_type) { @@ -60,6 +69,7 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms); MachineClass *mc = MACHINE_GET_CLASS(pcms); X86CPU *cpu = X86_CPU(ms->possible_cpus->cpus[0].cpu); + int nr_e820; if (pcmc->smbios_defaults) { /* These values are guest ABI, do not change */ @@ -78,8 +88,9 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, } /* build the array of physical mem area from e820 table */ - mem_array = g_malloc0(sizeof(*mem_array) * e820_get_num_entries()); - for (i = 0, array_count = 0; i < e820_get_num_entries(); i++) { + nr_e820 = e820_get_table(NULL); + mem_array = g_malloc0(sizeof(*mem_array) * nr_e820); + for (i = 0, array_count = 0; i < nr_e820; i++) { uint64_t addr, len; if (e820_get_entry(i, E820_RAM, &addr, &len)) { @@ -138,9 +149,6 @@ FWCfgState *fw_cfg_arch_create(MachineState *ms, #endif fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, 1); - fw_cfg_add_file(fw_cfg, "etc/e820", e820_table, - sizeof(struct e820_entry) * e820_get_num_entries()); - fw_cfg_add_bytes(fw_cfg, FW_CFG_HPET, &hpet_cfg, sizeof(hpet_cfg)); /* allocate memory for the NUMA channel: one (64bit) word for the number * of nodes, one word for each VCPU->node and one word for each node to diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index fec63cacfa..40edcee7af 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -324,8 +324,6 @@ static void microvm_memory_init(MicrovmMachineState *mms) fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, machine->smp.max_cpus); fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)machine->ram_size); fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, 1); - fw_cfg_add_file(fw_cfg, "etc/e820", e820_table, - sizeof(struct e820_entry) * e820_get_num_entries()); rom_set_fw(fw_cfg); @@ -586,9 +584,11 @@ static void microvm_machine_done(Notifier *notifier, void *data) { MicrovmMachineState *mms = container_of(notifier, MicrovmMachineState, machine_done); + X86MachineState *x86ms = X86_MACHINE(mms); acpi_setup_microvm(mms); dt_setup_microvm(mms); + fw_cfg_add_e820(x86ms->fw_cfg); } static void microvm_powerdown_req(Notifier *notifier, void *data) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 77415064c6..d2c29fbfcb 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -625,6 +625,7 @@ void pc_machine_done(Notifier *notifier, void *data) acpi_setup(); if (x86ms->fw_cfg) { fw_cfg_build_smbios(pcms, x86ms->fw_cfg, pcms->smbios_entry_point_type); + fw_cfg_add_e820(x86ms->fw_cfg); fw_cfg_build_feature_control(MACHINE(pcms), x86ms->fw_cfg); /* update FW_CFG_NB_CPUS to account for -device added CPUs */ fw_cfg_modify_i16(x86ms->fw_cfg, FW_CFG_NB_CPUS, x86ms->boot_cpus); diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index dd8b0f3313..bf182570fe 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -2706,11 +2706,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) } /* Tell fw_cfg to notify the BIOS to reserve the range. */ - ret = e820_add_entry(identity_base, 0x4000, E820_RESERVED); - if (ret < 0) { - fprintf(stderr, "e820_add_entry() table is full\n"); - return ret; - } + e820_add_entry(identity_base, 0x4000, E820_RESERVED); shadow_mem = object_property_get_int(OBJECT(s), "kvm-shadow-mem", &error_abort); if (shadow_mem != -1) { diff --git a/target/i386/kvm/xen-emu.c b/target/i386/kvm/xen-emu.c index fc2c2321ac..2f89dc628e 100644 --- a/target/i386/kvm/xen-emu.c +++ b/target/i386/kvm/xen-emu.c @@ -176,12 +176,7 @@ int kvm_xen_init(KVMState *s, uint32_t hypercall_msr) s->xen_caps = xen_caps; /* Tell fw_cfg to notify the BIOS to reserve the range. */ - ret = e820_add_entry(XEN_SPECIAL_AREA_ADDR, XEN_SPECIAL_AREA_SIZE, - E820_RESERVED); - if (ret < 0) { - fprintf(stderr, "e820_add_entry() table is full\n"); - return ret; - } + e820_add_entry(XEN_SPECIAL_AREA_ADDR, XEN_SPECIAL_AREA_SIZE, E820_RESERVED); /* The pages couldn't be overlaid until KVM was initialized */ xen_primary_console_reset(); From patchwork Tue Jul 2 14:10:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719758 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 69117C3064D for ; Tue, 2 Jul 2024 14:14:48 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeDG-0004Rq-UA; Tue, 02 Jul 2024 10:10: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 1sOeD8-0003rd-Ls for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10: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 1sOeD5-0000Ii-FB for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929418; 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=FXwifnBJIBh3zju1O5LT6q/8nalot/g3k4ePiwaH62E=; b=F2YtbeKtlfbvVH+Rhm3sVZhEFHJD8GYAPiQyZOFHQ2x49BzX6yZIRCzlyKKw30uf9tsis7 ANBVJoV0R4+VKZdLk3btlU6hu2uPdQiUHg6qlcTEoeU1hXrddSckK7VZn5Y2leGZOBgEjc FyvuYW0OA4dlYiEmfcuLnRxeW8LaVcQ= 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-184-D2-eDGZOPKiRW9xgmHuuCA-1; Tue, 02 Jul 2024 10:10:15 -0400 X-MC-Unique: D2-eDGZOPKiRW9xgmHuuCA-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-3678e549a1eso196164f8f.0 for ; Tue, 02 Jul 2024 07:10:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929414; x=1720534214; 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=FXwifnBJIBh3zju1O5LT6q/8nalot/g3k4ePiwaH62E=; b=J/yx5TK6e8+dRn4tuEbyuYjL0ByLswJvTpAEO6B8RB1rK/G54IP8MHE384hRj49e/3 rXddElMaMTXcyI01z7QHLLny7wwhJ6dmpPAttEcIIjLGa5GC37Y8nFoGAbsnpLQimoDW g7O0OXhszH7uCO8WrYQdJjt477JJ2g9w7h8sJ+jWWfCii8KEeOZOi4KWCvwgWNjG1Mm+ 796UFGTLA0tUdUW7yuZ+pZwXqGPDhxhp1VDH0K+f9y5KrOrI8MWv24Iclc4dBEWAKeCl yI+NlaXejIlsk1rOws0G4UQUhQA4F3ybdtJRF8zJjUiIMGIj7I63E8V10YBjFwgBHlPC /F4g== X-Gm-Message-State: AOJu0YzYkO3zF0beSPdrcJ48avk3ovJUNstgyBxBs0vbH91p/V+WOhw9 YI8QUpbpizy7nNhtJKlp1ivbBIw3ZbnNYNfWqlLji3r2ZvIw7p7q62WigdyiAJQdMgVKgv6OYRH AiYwNg5FTYR7itNsDtRZSe8S+pkV/fC6xhgpd9uVhkrDZY9950febjYmuUKti648I+q3W2h7mL4 pnIfRPFXE95fj01Iw+2P0Sjtm4oqmHgw== X-Received: by 2002:adf:ec03:0:b0:367:8e63:4da4 with SMTP id ffacd0b85a97d-3678e634fa5mr750890f8f.14.1719929413934; Tue, 02 Jul 2024 07:10:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHXqLGWe/UUyKylroPMXaPCxn4iIPB7sy9r6J/5ObEupwkwci/2EZYqSuhXQD3gPzyaiRDSpg== X-Received: by 2002:adf:ec03:0:b0:367:8e63:4da4 with SMTP id ffacd0b85a97d-3678e634fa5mr750849f8f.14.1719929413359; Tue, 02 Jul 2024 07:10:13 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b099c72sm198300495e9.37.2024.07.02.07.10.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:10:12 -0700 (PDT) Date: Tue, 2 Jul 2024 10:10:10 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Nicolin Chen , Eric Auger , Shannon Zhao , Igor Mammedov , Ani Sinha , qemu-arm@nongnu.org Subject: [PULL 62/91] hw/arm/virt-acpi-build: Fix id_count in build_iort_id_mapping Message-ID: <9bad72efc04a87e595aec1e9ac0c43ae3c0ad695.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Nicolin Chen It's observed that Linux kernel booting with the VM reports a "conflicting mapping for input ID" FW_BUG. The IORT doc defines "Number of IDs" to be "the number of IDs in the range minus one", while virt-acpi-build.c simply stores the number of IDs in the id_count without the "minus one". Meanwhile, some of the callers pass in a 0xFFFF following the spec. So, this is a mismatch between the function and its callers. Fix build_iort_id_mapping() by internally subtracting one from the pass-in @id_count. Accordingly make sure that all existing callers pass in a value without the "minus one", i.e. change all 0xFFFFs to 0x10000s. Also, add a few lines of comments to highlight this change along with the referencing document for this build_iort_id_mapping(). Fixes: 42e0f050e3a5 ("hw/arm/virt-acpi-build: Add IORT support to bypass SMMUv3") Suggested-by: Michael S. Tsirkin Reviewed-by: Eric Auger Signed-off-by: Nicolin Chen Message-Id: <20240619201243.936819-1-nicolinc@nvidia.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/arm/virt-acpi-build.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 102e2da934..e10cad86dd 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -209,12 +209,19 @@ static void acpi_dsdt_add_tpm(Aml *scope, VirtMachineState *vms) #define ROOT_COMPLEX_ENTRY_SIZE 36 #define IORT_NODE_OFFSET 48 +/* + * Append an ID mapping entry as described by "Table 4 ID mapping format" in + * "IO Remapping Table System Software on ARM Platforms", Chapter 3. + * Document number: ARM DEN 0049E.f, Apr 2024 + * + * Note that @id_count gets internally subtracted by one, following the spec. + */ static void build_iort_id_mapping(GArray *table_data, uint32_t input_base, uint32_t id_count, uint32_t out_ref) { - /* Table 4 ID mapping format */ build_append_int_noprefix(table_data, input_base, 4); /* Input base */ - build_append_int_noprefix(table_data, id_count, 4); /* Number of IDs */ + /* Number of IDs - The number of IDs in the range minus one */ + build_append_int_noprefix(table_data, id_count - 1, 4); build_append_int_noprefix(table_data, input_base, 4); /* Output base */ build_append_int_noprefix(table_data, out_ref, 4); /* Output Reference */ /* Flags */ @@ -305,8 +312,8 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) } /* Append the last RC -> ITS ID mapping */ - if (next_range.input_base < 0xFFFF) { - next_range.id_count = 0xFFFF - next_range.input_base; + if (next_range.input_base < 0x10000) { + next_range.id_count = 0x10000 - next_range.input_base; g_array_append_val(its_idmaps, next_range); } @@ -365,7 +372,7 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) build_append_int_noprefix(table_data, 0, 4); /* output IORT node is the ITS group node (the first node) */ - build_iort_id_mapping(table_data, 0, 0xFFFF, IORT_NODE_OFFSET); + build_iort_id_mapping(table_data, 0, 0x10000, IORT_NODE_OFFSET); } /* Table 17 Root Complex Node */ @@ -418,7 +425,7 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) } } else { /* output IORT node is the ITS group node (the first node) */ - build_iort_id_mapping(table_data, 0, 0xFFFF, IORT_NODE_OFFSET); + build_iort_id_mapping(table_data, 0, 0x10000, IORT_NODE_OFFSET); } acpi_table_end(linker, &table); From patchwork Tue Jul 2 14:10:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719784 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4D4D0C3064D for ; Tue, 2 Jul 2024 14:21:25 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeDI-0004bd-2u; Tue, 02 Jul 2024 10:10: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 1sOeDD-0004A7-IW for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:27 -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 1sOeD8-0000J0-36 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929420; 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=Qq6X3kMK8U5RTSY4JoCXP6cD3LHFaX4iQOeFqnwxYP8=; b=AD+Jn+39gteK/SPWlHoM8YBFCH3XwpGf1BMTYSsq4Y2w/ek5GSmtiqWPZGOoJnWF/X/pEz XK506Dr6qbhUs1CnOj8RwsQnnT+DJ5ABASTIogbb+X9NKVHNMroKpsq6hHvl1GbBQLL7ma SfG+QYKlQdnBYUykT5DACW0dfC8/NKo= 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-104-ywZo8X4QMFSRI91soVd6MA-1; Tue, 02 Jul 2024 10:10:18 -0400 X-MC-Unique: ywZo8X4QMFSRI91soVd6MA-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4256667ebf9so29787045e9.1 for ; Tue, 02 Jul 2024 07:10:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929417; x=1720534217; 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=Qq6X3kMK8U5RTSY4JoCXP6cD3LHFaX4iQOeFqnwxYP8=; b=H/ICMbOavj+fgFnpSFL1uMOA/d8PfiUtDSaZUd3+JN7V1ZA+X9KtcAHxceIBkRPJp2 pVIQlOmjT3zZXu6RxME1CdUfEnszQOemAnhPm7r9azPSL0m1b84neHeAUL9zD6eabgwk q+Bev1lAW52BimyRr3cJyXKYrttkXmBzS2/KOvcn2cJPULLhfWYfi5azwB6GSwY2RJUV yXoIXT+xiL9PKfPlnmcofPOasTMhAQyW8Xe/9vOGYfHFbBaJ9Gz0nZFtuCKzPmwlIqYR 34qQRUgqLiqAnU65Ndg6Lxs1Yk/eJDGRBzskafLNZsYtZ487+9TgMje4ot7gEMzdjVD9 XVmQ== X-Gm-Message-State: AOJu0Yyqs9/qDQQtmlQMNvQiprTZAbX92MEZgrvIhR+lEGH2Ehcl6Dri B5Mzn0ZtWJ5eK0hY5ittdHS2HHEE/5h2gwzcH2EPXyxdeMtfGRp7fMHyjNb/Zd87tSN2m0GckqA 3w1RX5J5aW7w4pX6o6N9e5WQb9R8KC3fiZWRKTkg4vkZ2oq45hwxJuhXaK64NLukC7fmNNoqik8 56ow9/ufEg0n64L17MvjPTabADEvkJ7A== X-Received: by 2002:a05:600c:4f94:b0:425:7c46:d336 with SMTP id 5b1f17b1804b1-4257c46d499mr54231075e9.17.1719929417089; Tue, 02 Jul 2024 07:10:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFySsgJqXcJ79POgmKrIbdLl8PEOmX4fONoo6vKU///699K/Pk4odKCdhbUbT93ZVyLZ+bPAg== X-Received: by 2002:a05:600c:4f94:b0:425:7c46:d336 with SMTP id 5b1f17b1804b1-4257c46d499mr54230735e9.17.1719929416515; Tue, 02 Jul 2024 07:10:16 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0fba0bsm13305727f8f.69.2024.07.02.07.10.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:10:16 -0700 (PDT) Date: Tue, 2 Jul 2024 10:10:13 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Sunil V L , Gerd Hoffmann , Alistair Francis , Igor Mammedov , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= Subject: [PULL 63/91] uefi-test-tools/UefiTestToolsPkg: Add RISC-V support Message-ID: <492ce19c7be7fd2a36550420a27d646ed6af74e2.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Sunil V L Enable building the test application for RISC-V with appropriate dependencies updated. Signed-off-by: Sunil V L Acked-by: Gerd Hoffmann Acked-by: Alistair Francis Acked-by: Igor Mammedov Message-Id: <20240625150839.1358279-3-sunilvl@ventanamicro.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/uefi-test-tools/UefiTestToolsPkg/UefiTestToolsPkg.dsc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/uefi-test-tools/UefiTestToolsPkg/UefiTestToolsPkg.dsc b/tests/uefi-test-tools/UefiTestToolsPkg/UefiTestToolsPkg.dsc index c8511cd732..0902fd3c73 100644 --- a/tests/uefi-test-tools/UefiTestToolsPkg/UefiTestToolsPkg.dsc +++ b/tests/uefi-test-tools/UefiTestToolsPkg/UefiTestToolsPkg.dsc @@ -19,7 +19,7 @@ PLATFORM_VERSION = 0.1 PLATFORM_NAME = UefiTestTools SKUID_IDENTIFIER = DEFAULT - SUPPORTED_ARCHITECTURES = ARM|AARCH64|IA32|X64 + SUPPORTED_ARCHITECTURES = ARM|AARCH64|IA32|X64|RISCV64 BUILD_TARGETS = DEBUG [BuildOptions.IA32] @@ -60,6 +60,10 @@ [LibraryClasses.IA32, LibraryClasses.X64] BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf + RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf + +[LibraryClasses.RISCV64] + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf [PcdsFixedAtBuild] gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8040004F From patchwork Tue Jul 2 14:10:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719755 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 39E19C3065C for ; Tue, 2 Jul 2024 14:14:38 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeDQ-0004yK-Ql; Tue, 02 Jul 2024 10:10: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 1sOeDH-0004cT-Tv for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10: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 1sOeDC-0000Jg-JQ for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929423; 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=wXu48vkZ7/C+tOxLrIxzTN9h9b+wSo5eOaPVc/4Fs+U=; b=DqDKiABuQj17XCJvaDf537MqywMzsGY+U5Pcsp8B8oeOPYGOufF+HU/OrEU2IX3UZTk/4B b9VxDwvOaa53a3yTCvjIDW6OaEXc9lPSLQYvA8B1Or0Kmr2ceB933Y4DkjAHPYYJgfsAk3 W30cwcKqD9lS4epkuN4awu3p/GvKjSE= 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-35-aTGA8Zv5O2ai31jmg2Mj6Q-1; Tue, 02 Jul 2024 10:10:22 -0400 X-MC-Unique: aTGA8Zv5O2ai31jmg2Mj6Q-1 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-52ce8969cf1so4161888e87.1 for ; Tue, 02 Jul 2024 07:10:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929420; x=1720534220; 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=wXu48vkZ7/C+tOxLrIxzTN9h9b+wSo5eOaPVc/4Fs+U=; b=t6kif7eA7wXVKpbe8stbFuLuYChnPwBq2Wxehagr6QIThRRATMkwvZh8ddUQrZkaph Hb+0DQgnEzhyB0T6e8y3MwkvGJ32QOuzMxX/VVB98vG768IePF22LNeXfsABQhSlCCVg U/OxCz+zLOblK98+H3Gs+eQxDI3AhzE59zly249cCMCvXU/bleyAbY1+01AbOOGuqLtq MDTyEDD+f3tRYQ8sTJ2rGwUd2e5MIIS8KYMr+YTfQ2p7MqCw9ePsEe4otcQpsGfCIRBz O2GhKcaIvG3mmlWTT2lCb4QW1nFn/gTyvSwJdmrd4RUNK2B9xykA9jjLNEpfNdsoeR+W 0xOQ== X-Gm-Message-State: AOJu0Yy12CR5vpavzmW60uhs/ny9taMOrJiKwpD6JeR2Wd+Wdxob4GgZ DhMQeYQbdjT1MzDQ274EcDaWDnNmJ5xl7910/FQOlakIMglNLaEzpcaacxfAfvzVNyefRflyijr nLsGcfADZORJR0utfG8Ah58NGakKMuzUn9zijMgFh15Fqzeoz1XNuzovmZUqYfjmzMyOX8msU/N yOPqNPyXRhMcaIiDoIcg+FfJIVv2QYCQ== X-Received: by 2002:a05:6512:3da4:b0:52c:c5c4:43d2 with SMTP id 2adb3069b0e04-52e826fb074mr6471126e87.47.1719929420428; Tue, 02 Jul 2024 07:10:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHA4D0ZbXfKi20DsLWoHDU17tX15XCF6STsUfIryVz9NfNRFA+AodEo3+eLry67RPFaeHUcnw== X-Received: by 2002:a05:6512:3da4:b0:52c:c5c4:43d2 with SMTP id 2adb3069b0e04-52e826fb074mr6471076e87.47.1719929419601; Tue, 02 Jul 2024 07:10:19 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af5b61bsm201473875e9.17.2024.07.02.07.10.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:10:18 -0700 (PDT) Date: Tue, 2 Jul 2024 10:10:16 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Sunil V L , Gerd Hoffmann , Igor Mammedov , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= Subject: [PULL 64/91] uefi-test-tools: Add support for python based build script 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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Sunil V L edk2-funcs.sh which is used in this Makefile, was removed in the commit c28a2891f3 ("edk2: update build script"). It is replaced with a python based script. So, update the Makefile and add the configuration file as required to support the python based build script. Signed-off-by: Sunil V L Acked-by: Gerd Hoffmann Acked-by: Igor Mammedov Message-Id: <20240625150839.1358279-4-sunilvl@ventanamicro.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/uefi-test-tools/Makefile | 19 +++---- tests/uefi-test-tools/uefi-test-build.config | 52 ++++++++++++++++++++ 2 files changed, 59 insertions(+), 12 deletions(-) create mode 100644 tests/uefi-test-tools/uefi-test-build.config diff --git a/tests/uefi-test-tools/Makefile b/tests/uefi-test-tools/Makefile index 0c003f2877..f4eaebd8ff 100644 --- a/tests/uefi-test-tools/Makefile +++ b/tests/uefi-test-tools/Makefile @@ -12,7 +12,7 @@ edk2_dir := ../../roms/edk2 images_dir := ../data/uefi-boot-images -emulation_targets := arm aarch64 i386 x86_64 +emulation_targets := arm aarch64 i386 x86_64 riscv64 uefi_binaries := bios-tables-test intermediate_suffixes := .efi .fat .iso.raw @@ -56,7 +56,8 @@ Build/%.iso.raw: Build/%.fat # stripped from, the argument. map_arm_to_uefi = $(subst arm,ARM,$(1)) map_aarch64_to_uefi = $(subst aarch64,AA64,$(call map_arm_to_uefi,$(1))) -map_i386_to_uefi = $(subst i386,IA32,$(call map_aarch64_to_uefi,$(1))) +map_riscv64_to_uefi = $(subst riscv64,RISCV64,$(call map_aarch64_to_uefi,$(1))) +map_i386_to_uefi = $(subst i386,IA32,$(call map_riscv64_to_uefi,$(1))) map_x86_64_to_uefi = $(subst x86_64,X64,$(call map_i386_to_uefi,$(1))) map_to_uefi = $(subst .,,$(call map_x86_64_to_uefi,$(1))) @@ -70,7 +71,7 @@ Build/%.fat: Build/%.efi uefi_bin_b=$$(stat --format=%s -- $<) && \ uefi_fat_kb=$$(( (uefi_bin_b * 11 / 10 + 1023) / 1024 )) && \ uefi_fat_kb=$$(( uefi_fat_kb >= 64 ? uefi_fat_kb : 64 )) && \ - mkdosfs -C $@ -n $(basename $(@F)) -- $$uefi_fat_kb + mkdosfs -C $@ -n "bios-test" -- $$uefi_fat_kb MTOOLS_SKIP_CHECK=1 mmd -i $@ ::EFI MTOOLS_SKIP_CHECK=1 mmd -i $@ ::EFI/BOOT MTOOLS_SKIP_CHECK=1 mcopy -i $@ -- $< \ @@ -95,15 +96,9 @@ Build/%.fat: Build/%.efi # we must mark the recipe manually as recursive, by using the "+" indicator. # This way, when the inner "make" starts a parallel build of the target edk2 # module, it can communicate with the outer "make"'s job server. -Build/bios-tables-test.%.efi: build-edk2-tools - +./build.sh $(edk2_dir) BiosTablesTest $* $@ - -build-edk2-tools: - cd $(edk2_dir)/BaseTools && git submodule update --init --force - $(MAKE) -C $(edk2_dir)/BaseTools \ - PYTHON_COMMAND=$${EDK2_PYTHON_COMMAND:-python3} \ - EXTRA_OPTFLAGS='$(EDK2_BASETOOLS_OPTFLAGS)' \ - EXTRA_LDFLAGS='$(EDK2_BASETOOLS_LDFLAGS)' +Build/bios-tables-test.%.efi: + $(PYTHON) ../../roms/edk2-build.py --config uefi-test-build.config \ + --match $* clean: rm -rf Build Conf log diff --git a/tests/uefi-test-tools/uefi-test-build.config b/tests/uefi-test-tools/uefi-test-build.config new file mode 100644 index 0000000000..1f389ae541 --- /dev/null +++ b/tests/uefi-test-tools/uefi-test-build.config @@ -0,0 +1,52 @@ +[global] +core = ../../roms/edk2 + +#################################################################################### +# arm + +[build.arm] +conf = UefiTestToolsPkg/UefiTestToolsPkg.dsc +plat = UefiTestTools +dest = ./Build +arch = ARM +cpy1 = ARM/BiosTablesTest.efi bios-tables-test.arm.efi + +#################################################################################### +# aarch64 + +[build.aarch64] +conf = UefiTestToolsPkg/UefiTestToolsPkg.dsc +plat = UefiTestTools +dest = ./Build +arch = AARCH64 +cpy1 = AARCH64/BiosTablesTest.efi bios-tables-test.aarch64.efi + +#################################################################################### +# riscv64 + +[build.riscv] +conf = UefiTestToolsPkg/UefiTestToolsPkg.dsc +plat = UefiTestTools +dest = ./Build +arch = RISCV64 +cpy1 = RISCV64/BiosTablesTest.efi bios-tables-test.riscv64.efi + +#################################################################################### +# ia32 + +[build.ia32] +conf = UefiTestToolsPkg/UefiTestToolsPkg.dsc +plat = UefiTestTools +dest = ./Build +arch = IA32 +cpy1 = IA32/BiosTablesTest.efi bios-tables-test.i386.efi + +#################################################################################### +# x64 + +[build.x64] +conf = UefiTestToolsPkg/UefiTestToolsPkg.dsc +plat = UefiTestTools +dest = ./Build +arch = X64 +cpy1 = X64/BiosTablesTest.efi bios-tables-test.x86_64.efi From patchwork Tue Jul 2 14:10:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719799 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9FEB3C3064D for ; Tue, 2 Jul 2024 14:25:36 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeEO-00072K-Vs; Tue, 02 Jul 2024 10:11: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 1sOeDN-0004uf-5Z for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:38 -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 1sOeDE-0000KP-0M for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929427; 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=XZlKbjCfDnCk5ojJHJFE0MXkNQoHYTrUaZpWkcL5Y50=; b=dLxtomE8FphtoM+oNXe/h41PE1dFh1zjIYnuc9gYMOYGpT8hC0DWOy3x7FfRbINGkka97B pWgd6Yz1tyrvMTAT20lT1u2w8dZ8BoeQ3nYH+H7e1yXGDovIkeq0xPuRgArpDwlHTIKZtT LLtRXt5BoUPPB5zFioWrY01LNsiHc20= 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-272-AViqb6p2P6a1HaFycqJ5KQ-1; Tue, 02 Jul 2024 10:10:26 -0400 X-MC-Unique: AViqb6p2P6a1HaFycqJ5KQ-1 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2ee4eb9ab1fso40020011fa.1 for ; Tue, 02 Jul 2024 07:10:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929424; x=1720534224; 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=XZlKbjCfDnCk5ojJHJFE0MXkNQoHYTrUaZpWkcL5Y50=; b=nYVd3nGckUB2povpY/xQQ3ZbBvV8hMsjEiMgyae+jcFycXOdveW29KnL+yYiGHpkJ0 xtQW2vskVODfMEnc2/ZobGuBFksRL1p0R9UVUUpbxgpgHTXVAwQSFMLcqIfjJYQteoPx yqcxUAMNuuU7zpjOgLaSfTxCTz/kAOld0eHkXGHyXx/IvmBucxpNKJ4Hf4H3N2I5jU5U 97rQAo7F4jTl7n7vP2rGavWRxlM2xE6Oi1X4gs7m5G4JlJFm+VjaDMACsfkbPxA8PoE2 PFOwRofCrc1AGUmu74lLHPx4uJg8CPbgmfuIcEkW+a3xZsgChTHsBaCNitubNHohvDnT 5tGA== X-Gm-Message-State: AOJu0YwkiBz+VCuCP0oysjmKzi+rFLgtlO9J8J63yRMJ/Q8D0dWEqLvf lez4tkx+7kjkHNe8yEcD2YFxRlg3m1bi3x79EMNP9mHW+QETDTf+EnG2/WL0H9bC/gyFTKwxiBM l7clsDKBfr6wPZJJd5l9+JMx8NmthXvMU0eCW1dtuZS1jK1l7lc2xYhMhry9JZgCfIPcWfXtTAb WnGrYDUxYWJEQnXymrncDBXSAP30PnZA== X-Received: by 2002:a2e:b0f1:0:b0:2ec:6608:a3af with SMTP id 38308e7fff4ca-2ee5e37a419mr50783121fa.31.1719929423804; Tue, 02 Jul 2024 07:10:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHpOr86L2eP+Gfku4G1tUqjLFXpKt5OcMZAIhHCgwu68QT6guOXIzCp3vb3r/gUwOiQJUOCpg== X-Received: by 2002:a2e:b0f1:0:b0:2ec:6608:a3af with SMTP id 38308e7fff4ca-2ee5e37a419mr50782751fa.31.1719929422825; Tue, 02 Jul 2024 07:10:22 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b0c0f26sm197257145e9.39.2024.07.02.07.10.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:10:22 -0700 (PDT) Date: Tue, 2 Jul 2024 10:10:20 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Sunil V L , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Gerd Hoffmann Subject: [PULL 65/91] tests/data/uefi-boot-images: Add RISC-V ISO image Message-ID: <16baad39f2fe21d5919c15d581d55015d0826eea.1719929191.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: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 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, LOTS_OF_MONEY=0.001, MONEY_NOHTML=2.5, 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=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Sunil V L To test ACPI tables, edk2 needs to be booted with a disk image having EFI partition. This image is created using UefiTestToolsPkg. The image is generated using tests/uefi-test-tools source. Signed-off-by: Sunil V L Message-Id: <20240625150839.1358279-5-sunilvl@ventanamicro.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- .../bios-tables-test.riscv64.iso.qcow2 | Bin 0 -> 16896 bytes tests/uefi-test-tools/uefi-test-build.config | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 tests/data/uefi-boot-images/bios-tables-test.riscv64.iso.qcow2 diff --git a/tests/data/uefi-boot-images/bios-tables-test.riscv64.iso.qcow2 b/tests/data/uefi-boot-images/bios-tables-test.riscv64.iso.qcow2 new file mode 100644 index 0000000000000000000000000000000000000000..c720bf99a45fab6d1e21963cca563ee0ea059b82 GIT binary patch literal 16896 zcmeIZbx>SSw>CPs4er4PLV%!yTYy1A2ofN82rzg8g9R8|1`7!qNN|D#CrEG$?#v)T z2Z!M9gkWFgN8bD0``$X=cmB9l_td@T*;9M%XRXz{cdzcfx_eiRw(`?U004jm_`ibS zABr3JFD>!i1@2#t`A1^>%lN+mHUI!{{@?igH~wG6pDy}u{QnXd|HnZHzyn|aFacNq ztbfj!f6xD7|I+`FcLz2A>pz_Z{u}?LahK`w|4Neo($D(e_#4 zE8%}-+<#Q=zX~kf;DTVVmDR!F2~m_*D{-1h(3Rg|uP~$yhl)@fip@r5v$zOd48nJL z2g>P!gir)yhj6yFVq{Cu&C<~utq>dFWcu*pGkTr?uOnM11AUJM~e=}4HpBji|h%fjCc>3y&^6X?$dDZry`VDTlHyI*NP`;ZFWyE954WuzC(eOUsZ`r#xZO} z!75AoVuWE}0KmsVm{nZ5#880mTL|J^=m*3*L?L1c?|v{K76*$Mm_mRf?7?omM!TJm zLzBqGRVNunckdw=*FoQYM5)mix6BY}7}0_wJggGarA&@aMv@1ve{|Xs8;P{Q0rd|E zXshU|^bZLdDm?u$y)l8qKgf2nw zJGe3h0f6Hu3lM`yY#B8P=1Y3I=a@;_owDE!L1$q>u*5G+!TU-`1VNB_E5`egHUwFS z6hGS>2omH&iVYy3!3`t20Rn~CH|}Gfs6OXWrOWiUQ5f!pAP}tb0uR2if54#NC%(bI zM=t?LFEsd=5}yHd;X$IH_w>>!|EuJV{}uk`zlQ(F=dXS7e{Cn0x$`6Yn`g;R?>Gg~ zUEZbizvEQFcbpn|CuwEx^mOHSoF08A8FcR?WBHw(nfZ>hSl>y|-#pF+x#Ra=+)4Ji zJAV%TJI)z&C%MM%^xUdjwsbXY9w4KQcGu|Ve>~rrS94oI`8Z)bg&vw&f}QS@mhHf2%1*E zdjApWk96O+={RiN&ad?@XMdLLwd=G9D=1O$m)T`_enx*?U2xOMj4(ElyFVbrODS#% zC9_ex6iPnDYLU6wjC zaS)($Z_GpMxHfxwH#4MsW(kxxNBmZ67Z>0&f3SE^boOpN8TH~uL);pgH0yohQrvhj zwjVi)Lr3>nTtxk@R-ZE~A^X6vLe01OZE+`QNMafCK}ez&aB&Lv=16!-Uyy5fqMwqV~y?QpJ%QKJgzowV=zBQ zL?yw6Vam1A=0rtvr3SIq^wX^He3Nu!1BPAgmV3d4D?L38HTY8!1`xLEMFzo~KAM8@17QYY zQ%9s5MF9|l>)@m}f%bZhCfi@I^Qk730QPnTyjGXlCkS~9Zwai9m9ur>b@rjcd7pdj z_8DTFUS`F053z#5+am*aF_PetUy0Vth;Pa_WbCD}amwKMz^lF6E1Mj(nqf3ks;@tp zx7p93b|acvd!;5jIEX!xC5vNqmgW}DeBK9=iATSJp_@P`ZNP7a z8%^Jbmm{J59K5$5i36v?R%0q~23W%9S4|)px;&}Ah(qahcBjIylo>%zuO}C!XJTh2 zqnA^)8U{7Ljs`q1hS%gqO%O*Vn)bUdSZlaEOYJhe7}3uJ1$@_Tq>WZ*w+4aQCZhF}YrCwm@bS+jD`LU^g>PnOYO(?=+l`KBu6X&jp1+4+O?><4_$p&nFL*+qO6^?!)N54nC|0b z?Ub33P=P|4S8t`=%(oZs)6vtJ+icxG!2zGiY+N&0Ckk=SiPyV@hFuidh-c3*2KjUQk+k@H~ zvNqWr-<%v4zaMWE(bKaOjx~_R&`T?i*Zhp)GYZ>nI6M5i1ktH{BVo?RA5E)j{U}El zSyk8Q4+AE)eG5YC`Md3jT<2(Kf4n>=t`(WwT~u&2A*4;&7OKPFjy9ydF4L)Zk&YN= zua2B?QL7uT4Nk2ncEsx`X=a+0Zrp-fUt&4Lw5VYTQuT}uj6_mPxjB;y&rY{_b8&ql zIj7y2mv7(>FLiKr$W(kRoD=+vZ$b{j?WU6@?$IFE%6bdg>?03YIeMYx+&6I9G$h`H zyzGGQgi{7}y)kO742$1JU4HC(W>Sv+G`huPMw49WWP8IAG zeIEux@Z`7o_cFn@^e%yq7u`#0Ed)L17G@qENWc0>B1fJ7_*y{`! z#*+5)f@^o0imM-yKUhdj17$)V>oMXb3>#bX2w&T8KDL5uQ~0t^=%_@JI?o1%7;@gb zeSrL!VB&XdC{)jOct$*~^X`81RO!=XN4D1mWM^5asx~%kPYKT+=-hgvOB9i$)lWAr z7yYuH|B}8}9n>+{VRW-xHSf5WzJ7Z4gmNVPL*6Q96i*gzS%di$ZE0Qc4W8?wftcY@ z8M))w9<=6i*KOCs&F3&IWq%YI#u*~ zgz0;<;Y97lw*;)$+WYA)>SiZRjkR+1o+)qQ1P501#RZTFGxF+JpEKi5pE@o3xQOE7 znv2!E&nR6kg3xS_5*Eze16{0b?*Jk36lu>5zok^Qdg@*3mOmBF;>e}ev>{#$Ov-(M zS*=N*V-YPZ8&7vKq9K(ao?MM!uy}4SJ0>ex{vR?Dqjzng)>lN z)6+xDGYCa=l0F=kR=mrMtC0Uf5eyvmJO4;rGmF)55M9yrNqThd&(zqcCdOiG3jp~1 z@|D8E>NpO=t=HStAr()poK3wjeHn$2PeSpz3vJ`*yXb*ZKZz1&t0J5l07y+PVkYtJpYWh^yB*lk6+ef;Y6Lt;qC!?_q6%`;$36YmkWLL^h{svZ2|$gct^{9ZK{|G)8e~ z!9pSoBHV(hU~U3oA?`n6{ntESv64~ImJrY{_T)ySK`^!Y%0bNfq6ap8M7o@T=k!0P z9f141o*23AbKI0p5Z0I%X~8kG);d!-!z?-_rcyY~k7P;4HaU(L+5aX3oxRG>HI{_P z0ua}##4dnj)g%bq<&M)<3iDZaeyW37kTO8gx8!KsoyY>&)KU_COPq>&?Q5vVm*1T~ z$>NzND)|F@D~uJaI0I~L?R57;`UR4rm^q?@R5j@&K;F@*3MW-?EP%c40_+B1essQn z1us#37#*oWeCLu^EDTn6^bmKH9UL4km`BfrXGLpkZ4&<-z12O$YZ647wzd{&v#|N2 zeOoyNzvqPZY!%+t!F;!Qjln170aoq?j-G?9y#Sq#KjXfkXmvjsWpsn`oCUIg+!C-_`DAz+ws+A+Dh_%*EnQPyD}N+9r*Mmb+3&^b!dS@9gf~P z-7;->LAz@R!Cnj*N0sC=8$D=P(xM%KcB(V+$`(_Xmg`;z((?e{T=`NaguZ8oqf!il zf{KPtdk~;wDncEc0LCZT@=(3Timn8+evT*p54Zg;MAH$7B`?K}IlW!i81dBFD+CtEC{oRH#oiQ0P4=Ae7-ub$5dG`bFoep z2x#RnksBO_;l^F^+*AjwE!}01#ynvx_q~)-*x@Q^=T|HPgX(i;y!SUa$;nrXl9Xen z`F&pr9+COzM6ue@M?dqhg(l73T+ODfNUp}C4R653EEgzP_mPJI&lmeqH|yXBw}E+A zYR&C~!yEq2^s=m6Sfs(2A5d}2mFkP}zWS=t-Y;P> zAv@*YQhGnG@eN}32WD zwcQ=IWk-lb_CFR$*f@nT%|6s&d1 zQs<=_Z^YyYTKmSWh$;^HUCfl7f>SD`;VNVg(5)`QRH|0IaC4948TA-)any6tb)s-e zo9!-z9jvlcJ|q$uqj`xJDjKpojP2fGmQ?6a6mLWe(U9TB5j>SQuQVEPg5ux2#!bNl zSc*AZNZ)0RpyofT0Mr_9fH!GyujD2QB59+OAg3|to?uCWUjg2XWMk&V>9Uzrfk@{bzlOydQHOx|pIg5zcoW{S zn|&gZ8BrlO#+ReFyZFUyZ&5oPHov*`J(= z1V#d5DAHQDxIg&jz`m`LiZsRPR}bM_W>x#Fd4&s1v2#|+Lf`&cE}&AH3x>p|bpHg& zA$@@WdpB{DtUs}Fm#>r@SZG;BuJPT*>9hz3dNx76B?Of0^mCZqAPgOLAn2CHJaIEy zTh9vyc8ke|g22K~(Qk!W6IJtfr;~T*0jTkdtvf#1Hmqz|)42BMJYg{Sk&{GgXKy(d;$hbZauW^&IctYVRw3d8MvlTJ zftG1H!u*Z2&kUn&W-|1mU!g`ol_k(o%;-oH4IPlPPQ4GQHM8jeY_Fv!MkEi^jFPe&=wsGaq~<3qDVsVi?s0Y6O;{KKq#8dFiFGs zM&5*{rHDx~?Eqc081{Pm+gRUMJZ#pQnmolZK5!^nYL0QG4E~nB4`t{O0E&kBSh3Eq zLKNRZ%ye!kemC=x{>K*w0@FoyTHPE z?yypJ_61mR0QcE9-S@@s4ec5Zx_jBBx51=@cE76@eTCd#MDf~y20WjEI`)NrXLSF3 zAE_+=M5@~@YpXlLTD0UI#u<-@YxWX*Ih)?(KznbNU`SB5SU!V-t*HRRY*hGk0Myig zF9vx=hI{5#`U`%*O$wO7tigd1iJ7-?Y%QANMfsT`uqW1zp1kf6yJu#W_lQbz1kSx^ zwLhIDK^D3$GdD>`(3N?{^r@+EKvwL7_^}QT;;qYCmBWqXoVW0sDc9wan$gq3J!7WR zG+*PErq53HVzyqBznVs5%v#&3&`qmzEBiaVYMPp~|IF-K1rnwx$45oI7!=C9BOl>T+~UKET(Pxiz5j~u12u&{=$d8(#axu=*| zYe2I(HBh1AAgN9bO*N2>&{bH9?c0u~F6U!d=2~0(6I?o38nYWl^;@1&*wJdtKH)1* zL$;S+TO*whU0ip>7!7eN&FddFM4;C&0J+-V?Ajr8vL`1sFP^dv2jRaaaF5H5!r5Go z9e=`Q75mH!!S?xH(6F6DnBo@HK8ti1l_gOXA{%7Psu-4##HwNUZn|+weB;gS^@88+ zc>s$od+FmF0D%9{``PU2v}4l{0cl`X>XVN592VdDEPonB&}JzD0B}q1#8L6co~!b9 z(@z2nP@}oQJW(SquPnsuN3DbQx-qy^^ORgciCkvaAa8Utk+m>ey#)*e`mV3;X(WN$HAM!z>RI zHcr%I${%f;AL{0NFJ(WWHlfztR`-Jn$w*aJY_)ZDmt=iO4`0grV z^CFbuDo;Q*-9u70>Y)ikxm}_Bo>ooDnZI^T!&xce?5qTi-!AK5nyNGX1^nh`>aMO7 zS4Yb>RdHCLzC1h2PvzjO* z$^FS1Ej5MWG@DwTk9%XEI+KlNg)hcxE^dJ6l{n>s4)2jF6~-=c!Bu#ItfG)>T7(@7molQ zkiEprfzqK_uWr71$^b!GiuS#-RD_* z?W<3Hk6enCWD;iPcIJ|wChq6bX6<-IlzQ_7y)w{fbDZE2pHV5y_ANPfiqZMZ10LOd z4w{%mg9L3r_7=ZU{z+GDd-Y|hD5LqH@g{0VCtIx=uOpjhZ@x5CbS0Yc&<3v1RA8Z< zAYb1uyQax6H}OE4lFPJD1FfhGGPhpM&)=}HlT_GSc&s1x?Euvy&@H}Lhth3V#LhSE zd)+@v_9D=rN3jEw&1RdWu;W#=%F9nqf4*I0c-~_>z82`cE&)kq_VKpFJCzH|`<_(> zY+0(%6$l58soS&wL^D>;ZO%wZK((-!0G-AoFgwtDA$WyhJhhX7GgxvC@bF3W8W!Fr} z7F${U8t4Tp@FUjy>se8zjdn96M8E8E?Py=U9~bK3Z~q9jO_JUATi!xzp_UnU6BDrg zXaP2Oq*Hf&d24!(T3Sd>LNu9-e&TDsdIi5da`>~;71j*at*Qv_LK^#H8Ht(s3#QgK z*=w|*%V0;VCdG|Hmx)f0dXM;)O5q2!l|G26lDWQk5N~FI!W+^?Jf)!(_*q!Sb)U|Z zOyJrLMsl_L1H*AwI9}{)$VjcQ8P?-@!rEG4u9-((!kqM6H)<|8DmJXWOiqxmYrDI* z^2?AO=!sUU=ZRdF}9H}CkbYpO3+fvb% zNSg3UOor-7LOOEr2*XZb7Dbw9?p}>SV!#mSR(WOTOYBnEAlusniKTDZd66&oXZaVb zuvi4Q&J{3&SWu#uvgaY%^5GlmbsHF(nFRnXk(a9jJF@VwHRl9@AJ>q31w|L0(j7Y_ zbUspwU!=fc0fLPJwoqLsG0O`afW2%@RF-xWI&zh^az+qWx!Oi2!3_1JOh}|i2+Igr zs!30$m&_N)8^Z#OyodDWHw#HNl9jq1{+)f^wh@IUD&~Zf7D+W%(^hL5SVEI#6Y`K7 zV#%V2r$z1!fInY*uqZhyD}8mvE{=HIo>oc@%p{kkqKyAfVKhRo4Ul$GgOWpc`f1GO z0}W9#Gq=H=2<`x}=Fg=hBDFFm1SbtVdL~npxx!-)(ofoSn!UmnA624-b)kwcAE>r!=J(! z;Vio^@`VF`etG$ZTI-By_^Ji+9T#wUREkbpH92;H|7lQ|jc`Is$zGq#0v#l~WCwJp ze2N~OLF6n3DW9iaM{U7(QEPkw{%1U?z89^q`6KgOpNbWau+1$XFn(sHJ}|rGjRC}S z3(7p4(~^polK^9B%!-E3$EV4V;`w7=HRkDDYUO?;5_!XZLiXCYqL5_ASFAm zYD&FIo5Se!@2Ly=(B@2iKbVb-2vhJU_f`Y0BrN(CfHrLew5#1BWMJG`M?)98ze~(fc5h4awQlC?1g@kv2&9dM;? zJC-?4Or8D1Rg*=u)q9nBI4Rp(G_Tic=tg{vcyj2f#gSe1ruTtM$Mzw7!i(GC{zDV= zGPi^;{#%U*-Tk~{dc#S?ckt3wNEBlWKoE9H!>je8p7mG7>oQfLzQPREK{}~6*xI;V zS)JP+<+YcU>*pqqcZ16tNNT2my)nwYCxZC^mr+CX^>*DlK~I-c0_Qd6NsTXia&tfFc?%b@-tn4pb&@$r| zc8FA-O7J3#J82=(Q(;hYvq(wWIBx&miFJjtl9WCs&+*-~4*l9zO9d)X6MGipOrz3hz}C$}A`S1dCv6o^ zYe=Ac&kWx{q|pqc(P7^ub4olj31e6eqF?4yG3!BNjg`5*WQSN@kY7rC`71q?Zc^Pw zx;11kCBzam*{Z?)XNx1Jf@x0IEw}%yrMpu#OHPGlWed6qdZM^7ZQ~I3*j|Cy!6SW= zoQmWvBSn~!h=`Jwh{{;z;_&n`1s(x$*QT@Eb-lEYoaigb&p!M0=jV^gx>OF^YsWe_ zawCbw2L1XsUv5*66h>Yi6Z*duzYoRf;ASRXx8Wu66+`;xMf|YosPCrf=q9q!xGy-0 zZOsVtr&e=X+|W%4Fm>iTx*QwgDIyj8@o2r`I5c`<_tX^UI+}fmYawE(THILtjXZn#p&EDpv@&@_EBAWH- zaq7G(P$3}kN2iELEjl!a`20=aI?xk+?_GNR$DV<8qlMqNTJU38*O~~0lYv}?xYi`m zIdlJOg~GAi-Z&oR%=MQo>%m*sI3`*H&)OkWOstMmb=;A&jjH<>SJI3?6ZfIagCQ+1WYYl`v#;4 zB$`nk96IY7=M0SQ*BUj5n0y_(*dF+~x`Wmfq+ig4VE3IBgh`WR-OB<7MivxRWYZt% zb;MHV=0Z%ZlR~LXA^c=Q&?w%a`uQVKSU%Hc$qkKTG=0Nl2T@w2n+ zrC)8}_=Pk!JJeZq4l~h*kTY;#f7|eSuV8_$Pg+Y_m!x`{wVR|8Gv+D7H)20YLi6#o+A|_u4z8j^a&Bn=V~}oKVu$T8 zDSj?lqvaH*W$z;uWijJhm04P*o^1h z!U8FFwUtS!K}F;e(4~39`23X-dmx&nL`z1q159>0Yi1s%LZDb?p|l0b3|D=uE0L}h z%755p_-@ythwsWqolIw@Wb}K?(sv)%&+9(<4_f$teT4#L(^&CGwwOr7In>pSkUr7CCLsf_nGe z6|>qKZW(qW1^4om+>1zbawQ7OMroHOlcP>x`z)Vg=hQmDR9%-%Ez5iIPpMERUew%f z;Hfp0AM0_|wW41&L>$hS%$z2usi;Se<6>Md(g!4~cBr@cMeFtjkmv^UB&U6}P|sekP-!P*V$sIl&_C)IxpZpE7413l21qY^)aiqn=`#mV+4*WFtj2_Mi}=Cr{ck z1zD|{<9Jj(c`2J!LnE!&HozJW)y)-x1C>7UYeeORs{J~tLrBX}hJhuIC5r4yRAGx4 zzg>I1cHUz$MJj@E`#x^V)URTRfXD<8P*KrAxFmG&{h+UClmz zy>4^KZ{!2#MJ6T&bSVcLKqZt{; zrMaqL^YBaIL*%fqGIMwjCG)ehv*-9Fk=%N&sCvHi{a3fKHnU#5^ z@jZ3me1Z=}&>}^}4Y>Y^1gDID;55ZnS+MV_Q&4V3M5u57V~PP!`nMDJCm+}%s<&6X z=F?GSPYbCvQD!`IG;0mVaDNzg8l?&I{?ph|A!4R^hjEd&ij!x!N zBlS+%k4g+!C1ofABGbS|xMa?5St2QeMyp@SOmclX(38_CEtja7l$l{2y)pd}UtHGt z##)!Kmfw?~D1}!saoqp2*GBt9DZeEBju@w48@Uq?w^UGv96f5(lXJ;3<_=9x>(*Twh}M>mPx)ZFq$o3WSf9*oR!>T719qKd6VT7#l!PEASj9fa4 zHnpSy@_9u#d0pQ~ZB9PuSyFV)8d)ykzo(S-Iq~*>xty`a8I4g(md*gaI+5Iiz~!=3@THbl0-5Sd%Wg zIBXR%P!%%bF{1Fb!-FM4l_!JjjS53Y0}oN@LihM7A+PK|2HFF$Ef+{7330+=7qB$) zDV1rhO`FPLroW80_zcBTt;)Do==5KTKA*+>_@i21@s$9k2<|T&zmtGUg?iQ@IfL9LEl*7vHDe@^K3GATo-tqvA8V%sd(M(I;?-hu zZMuNL+8<)RSo!whP%EXt3Zoa@932C?a+Up%i{RFTxANbs@UtL_toS#9AMYRe@S)#aKNBb}t|bjg{Stu){69at1p zsXlo_HgOa6lVXyQ=aBSuIGAMM;Z& zlWw=G9+Nl`lzy;=q91#;bOe@y5`!PkUZ*)Xk|9KvmnMEaW>$dmfe#bw=<#92#w-#6 zwV$dVjKq|}yX|eQ;s@-wk46TO`Cs5szC9cA%H9<=h*!S|(m%+N27$@CF1Xg=AS~W) z47@SAr&qKi$s$?@6kNE3tp46ST}mA}CMiDk&6jibwpgV#H(n$O^a&c&t_&yNe`4k> zrYHw!eM)XZ)B++abkdXytQEZ|9-0qHai_GGS!QeLvkP5!?l2vc5aosiHgw#e zzdre$+79MG#5Pgzk{b29D{8SAo38GV)U8#sx3Pa}4>QQxp|Ui7e)NIV9}k;m>}1ip zDBjJs%qU?GgEVc>o$=?Wclev^1W)5&VZhCxII|oF^DP&fX>iBt0k%WzfMYwD?C}Lv zS&@|v-fvU45vu2`+VAg?4cMgspTGmG>MPbGr8W|bR4=dR&ojFw65}3@eWy5UEYvRb8ViLmO44^@3DOT zv3>&@@YBw$PM1r;+AI%8x#gmiD{1SC4IGA_ydyEfRq$@7Ns5;^j9Da$)QB>#$9xzA zx++(iz{9g05GKF!wPh;OIf$k)@tiazOTdT(euP1+3fw!i0uWRWQUM4;^K)2UNtwN( zqueAH@u)`AOJ7S%+@E;XAHF+wfPo>WT#V8l+pi=9V_6+y>Gr;=z_=kaIPVE#Ys)^? zh0e};UR{LW7m8GJPN_aG+DgZcF4)x&on9QL58)F&%(&=#Mn<9@q&zH(jNyftSu18E zaYyIUde`Z*IM*1h>CKR=0*j#}K2^_Zo!vcJeYc%2x*qK@a^cOu;dvlR7`U#c@-yW_ z_Lm47rY}T^Hok7Fp#JO^dRi2yAmXCqm%=Y-8-z<5i{RHc2Lg4N_quH>Ii7}H6_pc( ztrc{o%e052G2*x@#H;-hPhz}y&Xe%``dh$@!kV@TkFUafuR&%b?E~90q)}RJj_qLJ zZoX$?;hg#AVmk&&D?|~q@ScjaewIt{Jd0 zHe^;K-rhAECy6322i(x5zF*IV;aX~qvL1-ksIJUoqh&O$UoQ~~&LX2p5B@fio8A6o zWXA4OTjvYQFO78L*6(PTamjjoC}%S$B)$hbsD~oQQ>dir8m*hAv`fDo?obv>S-o{_ zZ-3LH1(Sxcf@f64@~c&q3l!66F}mWJ;&(fRMy@L~=q z^EG~BKEWTBR^*gX6wsic1A-h*YZ39K4=5yWmUvtVXCoa7AC#&*{ie-7NtHr+A_tFS- z(>U^cQ&Ka_8)W_bxx-^$ei`@kOQdFafqDeZP3; zZ}l!P29QtRk*Yj9)cD$q=`5*Qp)y|)y)CBs5b%*uAW4h(v^oGMV@roim z2EM9jxbV7gqu4XG<1v7+BURToRPWn_;LiTuuWjBl8Jdo_W-Azsw_-n|(+dQrA)@K& zVo`j3NR7~B%a7Tl57eJiQ9;ys$T0Lst2i;0j^D`tYJz-qzP`Pc5y!U_$dqCQO<-Bj zfNtD~+59nk{gtpex=Ad`iK$UR=71U3pSQO%N*1Zxx3`URm$w15R4nxo&=?DBlE%=7 zXB$%HeowXhdIGD)h(qc+9ooG$m2iy+sH6CBD*D@i*V$LI7T04RVfXzOK8^+M zxcOxubFw?LRsHfimvuqL3lA!J$B;SgQ(Ro4;)22g52{rJlFf&MZnXeEFCXiNq&2hb zkFC2|T*s6~b7Rfbmr1(`5DijTCS^JX4A&k!R_^KHOvE|o5)@&q-F)Rnetr46-;Jp( z*;~^i!@%=V7n#QQg=STon(gXA2IRut@PcU-cA_+ImOrP>Lz45wd`_o`GyOHBEp=H<*2ysVNwAxBI@g;LK}J-rKMB1 z@Vs!P-zFz#a^v?toAl^M3XuHya|RzS!57yyj!c5B+?5sZA}%*1t>Yy6VZ;T!E5(3J z0>uP-jnmF$9m+G!vy~8=j*c-gocuXLdq6%cGY_I^!XvDqvyo z)za^du2xhl3NwTe(u);>3E{#Fp@48D`r8`S zK%80woB3ux)Qt5uno-(i3t3Opa_zF&U(Havcjdm{_JwoEw8{H;uOnX|ScQy${>*GF z$%T?bnsrb$)TQd)KNt*he{E4YReATZ6l{?2LJ%WCQxw( zU=S2c2Mhw?;|8}u$*_Y#_(AjbWY}$gTQ?>6J2B}rfJ)hXr?c=~VRF6jI{(WThA)g} u>fShPcb7 X-Patchwork-Id: 13719739 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8E870C3064D for ; Tue, 2 Jul 2024 14:12:50 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeDa-00053e-Bb; Tue, 02 Jul 2024 10:11:01 -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 1sOeDJ-0004mD-JZ for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10: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 1sOeDF-0000KY-Sg for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929429; 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=tLYMiEpSTV+muhM/St/OMTi5MMjd/r9xWUNm5/42vJU=; b=IllD2l1dGEIAV/bYKvIvLR1Ig/QnRPL3mlG5BIkuXFHucmEbWq9NgnjnIZ+435kT507mfR tNRUgsioNPLwfMSQ7QPMGR5LSUHgINAF1oZiNzxK62E8QBZDAISNEQoUkWZgcsWCpq2XPN RPz0oc5iGyxF8o+DRLkxR1S9OQiY7x4= 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-150-B1K8QCvfMHqWvVLP96Kcag-1; Tue, 02 Jul 2024 10:10:28 -0400 X-MC-Unique: B1K8QCvfMHqWvVLP96Kcag-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-425897358f0so6728665e9.2 for ; Tue, 02 Jul 2024 07:10:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929426; x=1720534226; 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=tLYMiEpSTV+muhM/St/OMTi5MMjd/r9xWUNm5/42vJU=; b=veWq3XQohJJl4+mrc/8Eronm8O4E1GsRa3rQf2TPmZmaRkwG97xFcd2rAL90JVA4pk 8UBO+V5qhv6CdXRI6PSVT08Nv1n8mGzJQ9MrY1Aweu3xC6WIOJ4oQ2GIGv27W4Q8LeUZ F/gshKb5v6XRbgDCu8iG9gFYYSyjciLqQKIOxGasKnNULG0UCYa+hHp07bOtgF4Rgd8Y Y0jJ+IxVxU5fFJ5UjnALpBon/laCiVM1+O2pNPq8kf4/FThbgTTjUAMfLeSoSo5XnJor TL8uEtzcuuh51pFamRYF1H4QNkLfFdkYv3r/j7mslL/d6cB6YKtWoiaAjcAad5vH89zk Ln+Q== X-Gm-Message-State: AOJu0YxOViSSu7/eKBYrpfNTqWiFtTPIE+ZTq7O8UlH5velvIpYx8dIC xjHmota51xzuUqrkbPVGzWlT+AY1Vbbao74JOBlQVgA+83HbsiI3OlakQQ5yItaWjZgamHUppQA cyjqwqQoprec4rxNWqAkO9kbL4MjJ9AAckIRN/4GO4SMcdlI0SKzqKv2zTPEYODdbZDYNFmZH3o gDz/Mse5RxhcnftxUGNltzYNW5VKga4w== X-Received: by 2002:a05:6000:1fab:b0:367:4e05:bb7b with SMTP id ffacd0b85a97d-36775721674mr6742101f8f.53.1719929426482; Tue, 02 Jul 2024 07:10:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFcAUiENVIUR6dFsMf9AJhHAAqsNXctS2BiGfMuDex+cdjte0I5Bjq/JSkrZAaNAFokoryiAA== X-Received: by 2002:a05:6000:1fab:b0:367:4e05:bb7b with SMTP id ffacd0b85a97d-36775721674mr6742067f8f.53.1719929425905; Tue, 02 Jul 2024 07:10:25 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0fb9c1sm13428079f8f.74.2024.07.02.07.10.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:10:25 -0700 (PDT) Date: Tue, 2 Jul 2024 10:10:23 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Sunil V L , Alistair Francis , Igor Mammedov , Ani Sinha Subject: [PULL 66/91] qtest: bios-tables-test: Rename aarch64 tests with aarch64 in them Message-ID: <5171618ee509fd1ab2c35cb4a9612d3925a18ecb.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Sunil V L Existing AARCH64 virt test functions do not have AARCH64 in their name. To add RISC-V virt related test cases, better to rename existing functions to indicate they are ARM only. Signed-off-by: Sunil V L Reviewed-by: Alistair Francis Reviewed-by: Igor Mammedov Message-Id: <20240625150839.1358279-6-sunilvl@ventanamicro.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 35 ++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index d1ff4db7a2..c4a4d1c7bf 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -1570,7 +1570,7 @@ static void test_acpi_piix4_tcg_dimm_pxm(void) test_acpi_tcg_dimm_pxm(MACHINE_PC); } -static void test_acpi_virt_tcg_memhp(void) +static void test_acpi_aarch64_virt_tcg_memhp(void) { test_data data = { .machine = "virt", @@ -1663,7 +1663,7 @@ static void test_acpi_microvm_ioapic2_tcg(void) free_test_data(&data); } -static void test_acpi_virt_tcg_numamem(void) +static void test_acpi_aarch64_virt_tcg_numamem(void) { test_data data = { .machine = "virt", @@ -1685,7 +1685,7 @@ static void test_acpi_virt_tcg_numamem(void) } -static void test_acpi_virt_tcg_pxb(void) +static void test_acpi_aarch64_virt_tcg_pxb(void) { test_data data = { .machine = "virt", @@ -1758,7 +1758,7 @@ static void test_acpi_piix4_tcg_acpi_hmat(void) test_acpi_tcg_acpi_hmat(MACHINE_PC); } -static void test_acpi_virt_tcg_acpi_hmat(void) +static void test_acpi_aarch64_virt_tcg_acpi_hmat(void) { test_data data = { .machine = "virt", @@ -1914,7 +1914,7 @@ static void test_acpi_microvm_acpi_erst(void) } #endif /* CONFIG_POSIX */ -static void test_acpi_virt_tcg(void) +static void test_acpi_aarch64_virt_tcg(void) { test_data data = { .machine = "virt", @@ -1933,7 +1933,7 @@ static void test_acpi_virt_tcg(void) free_test_data(&data); } -static void test_acpi_virt_tcg_topology(void) +static void test_acpi_aarch64_virt_tcg_topology(void) { test_data data = { .machine = "virt", @@ -2016,7 +2016,7 @@ static void test_acpi_q35_cxl(void) } #endif /* CONFIG_POSIX */ -static void test_acpi_virt_viot(void) +static void test_acpi_aarch64_virt_viot(void) { test_data data = { .machine = "virt", @@ -2192,7 +2192,7 @@ static void test_acpi_microvm_oem_fields(void) g_free(args); } -static void test_acpi_virt_oem_fields(void) +static void test_acpi_aarch64_virt_oem_fields(void) { test_data data = { .machine = "virt", @@ -2364,16 +2364,19 @@ int main(int argc, char *argv[]) } } else if (strcmp(arch, "aarch64") == 0) { if (has_tcg && qtest_has_device("virtio-blk-pci")) { - qtest_add_func("acpi/virt", test_acpi_virt_tcg); + qtest_add_func("acpi/virt", test_acpi_aarch64_virt_tcg); qtest_add_func("acpi/virt/acpihmatvirt", - test_acpi_virt_tcg_acpi_hmat); - qtest_add_func("acpi/virt/topology", test_acpi_virt_tcg_topology); - qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem); - qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp); - qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb); - qtest_add_func("acpi/virt/oem-fields", test_acpi_virt_oem_fields); + test_acpi_aarch64_virt_tcg_acpi_hmat); + qtest_add_func("acpi/virt/topology", + test_acpi_aarch64_virt_tcg_topology); + qtest_add_func("acpi/virt/numamem", + test_acpi_aarch64_virt_tcg_numamem); + qtest_add_func("acpi/virt/memhp", test_acpi_aarch64_virt_tcg_memhp); + qtest_add_func("acpi/virt/pxb", test_acpi_aarch64_virt_tcg_pxb); + qtest_add_func("acpi/virt/oem-fields", + test_acpi_aarch64_virt_oem_fields); if (qtest_has_device("virtio-iommu-pci")) { - qtest_add_func("acpi/virt/viot", test_acpi_virt_viot); + qtest_add_func("acpi/virt/viot", test_acpi_aarch64_virt_viot); } } } From patchwork Tue Jul 2 14:10:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719768 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A69DC41513 for ; Tue, 2 Jul 2024 14:18:24 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeEA-0005TT-HJ; Tue, 02 Jul 2024 10:11: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 1sOeDM-0004tf-8D for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10: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 1sOeDJ-0000Ld-Uv for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929433; 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=J8ROLmjYrb+QdAQNPXPEEZlctlgKEo5Cy/u0jGb6NPk=; b=Q/BB67pMXjtHPXAW25z5Ix6AYETbsRMSUGSXTfSHiJ70O5WcKJYsh3ynxkpmZYeaH4vgor 0ofgXrXdnKJwG0/fbBpxG5RA2PpuqifrRvLg+6CMNxDq2gPKdGQASy9sU9D1m1uAACNErw h1oa2prjt5a+j5Ymz74C7/boaQEht/M= 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-395-znHBKBLiP6WYDoNOJU7FQg-1; Tue, 02 Jul 2024 10:10:32 -0400 X-MC-Unique: znHBKBLiP6WYDoNOJU7FQg-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-424a5a5f024so27798805e9.3 for ; Tue, 02 Jul 2024 07:10:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929430; x=1720534230; 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=J8ROLmjYrb+QdAQNPXPEEZlctlgKEo5Cy/u0jGb6NPk=; b=sJ23BLZBAUhNWZkWrMiGEEW9LEmmyLvz2mB2CTS2J6TFMuIoS8UhAr6OIDUFZc1T9G 14aqrjFozupLWusHeGtzIJeHqHgeQVdZmnj1fXdc1pg1Djs7ch9+h7iNAyvNzq1XmO53 RF7cIVt3SdggLJY8uU0D/A6QSiyd18iuUsleboYDcxOGYz/oblrHRWUEDBZ47oWYl3Gj qTmt38+apYVmrzOt+PMj8113VZF2EzzP9+cPYJqCKYzfNGYnVzkbZqKFvmQCPURslN1v qbJbMtGcUnXQ0f7H7+yy3mheYWqJAnhHWVYzSx/Oz+aTMctL50cvFB8VJnpZtfjy4/1m +QgA== X-Gm-Message-State: AOJu0YwxGNiNQUeW1eS44BDie8ukM5a1x/yCNNmH7Vz2XkwfKcLu9sbX 3zC9J0XVABuFLMQcliF0waVoPhBaVjeXxgTISgisQrDK9khY/UkEjQ9Ivvew+rGACwCAyQQWgon /YOAnaAvaJV8fLTwbxeFnsXxES0DURUK55tdqZ+ZlGyvKgii2rKSttYmOnCjV+4caCv1foGR8Zv AG0VzU0GOTg4wTvIJIItNdZXOSSLtS/g== X-Received: by 2002:a7b:c458:0:b0:424:a2d9:67c5 with SMTP id 5b1f17b1804b1-4257a02b78emr60752535e9.16.1719929430237; Tue, 02 Jul 2024 07:10:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFFGcnsqGUSWFyRiKzfD8TZ+BZGK32tI5ABZTZPejum6k8AolDjKljRxOnae1298rb63x8Q6g== X-Received: by 2002:a7b:c458:0:b0:424:a2d9:67c5 with SMTP id 5b1f17b1804b1-4257a02b78emr60752265e9.16.1719929429586; Tue, 02 Jul 2024 07:10:29 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b09a32asm202056005e9.31.2024.07.02.07.10.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:10:29 -0700 (PDT) Date: Tue, 2 Jul 2024 10:10:26 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Sunil V L , Alistair Francis , Igor Mammedov , Ani Sinha Subject: [PULL 67/91] tests/qtest/bios-tables-test.c: Add support for arch in path 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Sunil V L Since machine name can be common for multiple architectures (ex: virt), add "arch" in the path to search for expected AML files. Since the AML files are still under old path, add support for searching with and without arch in the path. Signed-off-by: Sunil V L Acked-by: Alistair Francis Reviewed-by: Igor Mammedov Message-Id: <20240625150839.1358279-7-sunilvl@ventanamicro.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index c4a4d1c7bf..29c52952f4 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -78,6 +78,7 @@ typedef struct { bool tcg_only; const char *machine; + const char *arch; const char *machine_param; const char *variant; const char *uefi_fl1; @@ -262,8 +263,19 @@ static void dump_aml_files(test_data *data, bool rebuild) g_assert(exp_sdt->aml); if (rebuild) { - aml_file = g_strdup_printf("%s/%s/%.4s%s", data_dir, data->machine, + aml_file = g_strdup_printf("%s/%s/%s/%.4s%s", data_dir, + data->arch, data->machine, sdt->aml, ext); + + /* + * To keep test cases not failing before the DATA files are moved to + * ${arch}/${machine} folder, add this check as well. + */ + if (!g_file_test(aml_file, G_FILE_TEST_EXISTS)) { + aml_file = g_strdup_printf("%s/%s/%.4s%s", data_dir, + data->machine, sdt->aml, ext); + } + if (!g_file_test(aml_file, G_FILE_TEST_EXISTS) && sdt->aml_len == exp_sdt->aml_len && !memcmp(sdt->aml, exp_sdt->aml, sdt->aml_len)) { @@ -398,8 +410,13 @@ static GArray *load_expected_aml(test_data *data) memset(&exp_sdt, 0, sizeof(exp_sdt)); try_again: - aml_file = g_strdup_printf("%s/%s/%.4s%s", data_dir, data->machine, - sdt->aml, ext); + aml_file = g_strdup_printf("%s/%s/%s/%.4s%s", data_dir, data->arch, + data->machine, sdt->aml, ext); + if (!g_file_test(aml_file, G_FILE_TEST_EXISTS)) { + aml_file = g_strdup_printf("%s/%s/%.4s%s", data_dir, data->machine, + sdt->aml, ext); + } + if (verbosity_level >= 2) { fprintf(stderr, "Looking for expected file '%s'\n", aml_file); } From patchwork Tue Jul 2 14:10:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719796 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 01A9BC30658 for ; Tue, 2 Jul 2024 14:23:52 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeEC-0005op-Ms; Tue, 02 Jul 2024 10:11: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 1sOeDP-00053W-Sc for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:41 -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 1sOeDN-0000Ni-Hr for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929436; 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=PxS1+bCJZBeQoTfbYKSlDoSTgSREcQFLu7+nTuWUmeY=; b=ExsYWtsaat39d5Gjp87iOAkEMkNtJEmvNzAy43PI/TsnWErRUO9Uyhoh8Ps+TWwya4beqP CW8l7yk/wI2GCLlYwdtY//BxmdQ0vyDrIxVXTDtbeZpZ4e3HA/vKWN+swHaj0x/lACGjWA ocjcQ5Yg6sniOgJi1YrtQUI2rj9dL8s= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-401-NFh03_mYO1qGqDsp_Welvw-1; Tue, 02 Jul 2024 10:10:35 -0400 X-MC-Unique: NFh03_mYO1qGqDsp_Welvw-1 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-58c4f94b57cso80454a12.0 for ; Tue, 02 Jul 2024 07:10:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929434; x=1720534234; 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=PxS1+bCJZBeQoTfbYKSlDoSTgSREcQFLu7+nTuWUmeY=; b=q7+TUmOAec0clXV25bgfcLF6A/yndTBU/0BONstQ4UcNYbQER2kKf00QDrCun/Uv8M SmJPTaOJa7G+pOmJcI0ZHdxeJtvC8Fj0GoY8+tn3Mr5wx5448+5pfCYuhC4wRJap1Uda F4oNt5bemZ7a4+KEzOExkAhFfhhRIzgJoNkOEqbvhawzxHQhy6WbmljBcsNZr5wZDCo5 6Aobm38TjaHbuqoRq5aKv3uns/A+mdWo8rbLsNq32ZdJVwG6AdXdu3EUKewb9sRqbm2/ 7UL9uU2jqSJMj6HI5P0Rq3jbeGqmCDS6QFZac5sTvKLWi3KbDciQC/Oa+NfL/BLxSdNk bWoA== X-Gm-Message-State: AOJu0YwIl2pNkUwZS2HImnM5eSEAL2zRm536WeFK/TsfkFZWmqeCHm7i bQ3SfU+7P5qL6eeLCFj0uKxPNcL9cm/+DcNCgAYW9Vo9o8rZpASc5Psk4wwDmbhrm/96t0fW4nd 1ESiOF4dr775/pBYGOqLdkfrmQjSS/BseyDlinvZBWznzQhlA8XKIFVBt7B9VHfrPkGsxNQ6/Q9 FQawyEc2sPeytQUiKRZRPKfk33VSh6gw== X-Received: by 2002:a05:6402:254a:b0:578:649e:e63e with SMTP id 4fb4d7f45d1cf-5879f1c2563mr5887463a12.16.1719929433760; Tue, 02 Jul 2024 07:10:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHPBmche2iGcvwCD62/r7nPmS1fB9gFmI3Nm1efVk1vq5I6kd4FLokj1zkFBoOkLzQupRodqw== X-Received: by 2002:a05:6402:254a:b0:578:649e:e63e with SMTP id 4fb4d7f45d1cf-5879f1c2563mr5887433a12.16.1719929433282; Tue, 02 Jul 2024 07:10:33 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5861324feb7sm5779580a12.37.2024.07.02.07.10.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:10:32 -0700 (PDT) Date: Tue, 2 Jul 2024 10:10:30 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Sunil V L , Alistair Francis , Igor Mammedov , Ani Sinha Subject: [PULL 68/91] tests/qtest/bios-tables-test.c: Set "arch" for aarch64 tests 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Sunil V L To search for expected AML files under ${arch}/${machine} path, set this field for AARCH64 related test cases. Signed-off-by: Sunil V L Acked-by: Alistair Francis Reviewed-by: Igor Mammedov Message-Id: <20240625150839.1358279-8-sunilvl@ventanamicro.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 29c52952f4..007c281c9a 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -1591,6 +1591,7 @@ static void test_acpi_aarch64_virt_tcg_memhp(void) { test_data data = { .machine = "virt", + .arch = "aarch64", .tcg_only = true, .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd", .uefi_fl2 = "pc-bios/edk2-arm-vars.fd", @@ -1684,6 +1685,7 @@ static void test_acpi_aarch64_virt_tcg_numamem(void) { test_data data = { .machine = "virt", + .arch = "aarch64", .tcg_only = true, .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd", .uefi_fl2 = "pc-bios/edk2-arm-vars.fd", @@ -1706,6 +1708,7 @@ static void test_acpi_aarch64_virt_tcg_pxb(void) { test_data data = { .machine = "virt", + .arch = "aarch64", .tcg_only = true, .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd", .uefi_fl2 = "pc-bios/edk2-arm-vars.fd", @@ -1779,6 +1782,7 @@ static void test_acpi_aarch64_virt_tcg_acpi_hmat(void) { test_data data = { .machine = "virt", + .arch = "aarch64", .tcg_only = true, .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd", .uefi_fl2 = "pc-bios/edk2-arm-vars.fd", @@ -1935,6 +1939,7 @@ static void test_acpi_aarch64_virt_tcg(void) { test_data data = { .machine = "virt", + .arch = "aarch64", .tcg_only = true, .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd", .uefi_fl2 = "pc-bios/edk2-arm-vars.fd", @@ -1954,6 +1959,7 @@ static void test_acpi_aarch64_virt_tcg_topology(void) { test_data data = { .machine = "virt", + .arch = "aarch64", .variant = ".topology", .tcg_only = true, .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd", @@ -2037,6 +2043,7 @@ static void test_acpi_aarch64_virt_viot(void) { test_data data = { .machine = "virt", + .arch = "aarch64", .tcg_only = true, .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd", .uefi_fl2 = "pc-bios/edk2-arm-vars.fd", @@ -2213,6 +2220,7 @@ static void test_acpi_aarch64_virt_oem_fields(void) { test_data data = { .machine = "virt", + .arch = "aarch64", .tcg_only = true, .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd", .uefi_fl2 = "pc-bios/edk2-arm-vars.fd", From patchwork Tue Jul 2 14:10:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719776 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 599F9C3064D for ; Tue, 2 Jul 2024 14:19:52 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeED-0005vc-Ff; Tue, 02 Jul 2024 10:11:29 -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 1sOeDU-00057r-4j for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:51 -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 1sOeDR-0000OT-Oo for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929441; 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=H0Zx9hcjCb8TTX+fknLAFuiiboZn7NyIn2VBiJnNZQk=; b=XEPfhv//EIrVxqv8Zl+9j3ZVf2TMEBZ/uH1IMjZH09c3wl4bI76hUbhlOg5cMy7aQCVoIx MOYwaDFbj18xtPMCy0Cjg5KXN/W21fAQduOgnBZL+xqmRamGu4NUoXJO6SqoAnQeN1TuQd 6QQwVg8xldJovJnWpebWn15ixqkpiyY= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-418-VdknvXfhOdOzvk0l9lIVOQ-1; Tue, 02 Jul 2024 10:10:38 -0400 X-MC-Unique: VdknvXfhOdOzvk0l9lIVOQ-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-a724d8c38d3so271837266b.2 for ; Tue, 02 Jul 2024 07:10:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929437; x=1720534237; 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=H0Zx9hcjCb8TTX+fknLAFuiiboZn7NyIn2VBiJnNZQk=; b=m/xfkfjj+2nO2plPJ9KN4Im8pSbMvSdsGKJgrzdbadDGyeCpZVpzF8eim+bvSZIU/H NYwrP+Yp1nlwBex/Mc3hyUY4ZAp91IQrNf2cBjKhox0euDD0QiFHXVEVxdikabDiEFVI qBV0eHzOObkbKwwhantco0B08edW+N6Gyp5Z06p5wLwgdrfqFQoPxOTcuULpCZ+Qu0+z 9vTQhWVyx0DsBh+CYpUZS4KplWqTVS1UGFC5+i5/jRLSWHEgd4ZuRVAj5vzM8SvGLL1X bRjyGdymm0eXfS6xcItYSdiXROLNuqi8Gu6WAz1tYaDIm3JO8p/5gVBpuVADJzZVMYsR BGcQ== X-Gm-Message-State: AOJu0Yyn5TrOXQwvSPbGyUpy0pBq1iV9W6TDm0Zz7yrelzai8My/ajuP EkEZtpnuhViYoMl3hXWIVICyFN5Uxqx/o95PpT6F4O6mRQEIirdyh0/GjUS1T6/t7HdL7xeCvuQ jiqP42a/HOLV/y0fcOSbeKlKPCIJgRFDen8QNUtTtVYZfv9FRl40K3eWXvjxaI/bm6s0FUxcPTH 47krS25T/4rCnjdzr2g7YyuiCmrKHzVg== X-Received: by 2002:a17:906:d202:b0:a75:410c:ecb0 with SMTP id a640c23a62f3a-a75410cedd3mr116935066b.67.1719929436839; Tue, 02 Jul 2024 07:10:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHLAenNl69KM30pIiU0bvU7Uxc5sMqwnA8SXben1pdrd6dqMlEm4BtP+CiEeLN9C8wOaKLpBg== X-Received: by 2002:a17:906:d202:b0:a75:410c:ecb0 with SMTP id a640c23a62f3a-a75410cedd3mr116931466b.67.1719929436053; Tue, 02 Jul 2024 07:10:36 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72ab06511fsm426469166b.102.2024.07.02.07.10.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:10:35 -0700 (PDT) Date: Tue, 2 Jul 2024 10:10:33 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Sunil V L , Igor Mammedov , Ani Sinha Subject: [PULL 69/91] tests/qtest/bios-tables-test.c: Set "arch" for x86 tests Message-ID: <7ec0c03b4d8744f0e06800f2e9b1254d0b578830.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Sunil V L To search for expected AML files under ${arch}/${machine} path, set this field for X86 related test cases. Signed-off-by: Sunil V L Reviewed-by: Igor Mammedov Message-Id: <20240625150839.1358279-9-sunilvl@ventanamicro.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 77 ++++++++++++++++++++++++++++------ 1 file changed, 64 insertions(+), 13 deletions(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 007c281c9a..f4c4704bab 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -933,6 +933,7 @@ static void test_acpi_piix4_tcg(void) * This is to make guest actually run. */ data.machine = MACHINE_PC; + data.arch = "x86"; data.required_struct_types = base_required_struct_types; data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types); test_acpi_one(NULL, &data); @@ -944,6 +945,7 @@ static void test_acpi_piix4_tcg_bridge(void) test_data data = {}; data.machine = MACHINE_PC; + data.arch = "x86"; data.variant = ".bridge"; data.required_struct_types = base_required_struct_types; data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types); @@ -981,6 +983,7 @@ static void test_acpi_piix4_no_root_hotplug(void) test_data data = {}; data.machine = MACHINE_PC; + data.arch = "x86"; data.variant = ".roothp"; data.required_struct_types = base_required_struct_types; data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types); @@ -997,6 +1000,7 @@ static void test_acpi_piix4_no_bridge_hotplug(void) test_data data = {}; data.machine = MACHINE_PC; + data.arch = "x86"; data.variant = ".hpbridge"; data.required_struct_types = base_required_struct_types; data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types); @@ -1013,6 +1017,7 @@ static void test_acpi_piix4_no_acpi_pci_hotplug(void) test_data data = {}; data.machine = MACHINE_PC; + data.arch = "x86"; data.variant = ".hpbrroot"; data.required_struct_types = base_required_struct_types; data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types); @@ -1034,6 +1039,7 @@ static void test_acpi_q35_tcg(void) test_data data = {}; data.machine = MACHINE_Q35; + data.arch = "x86"; data.required_struct_types = base_required_struct_types; data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types); test_acpi_one(NULL, &data); @@ -1049,6 +1055,7 @@ static void test_acpi_q35_kvm_type4_count(void) { test_data data = { .machine = MACHINE_Q35, + .arch = "x86", .variant = ".type4-count", .required_struct_types = base_required_struct_types, .required_struct_types_len = ARRAY_SIZE(base_required_struct_types), @@ -1065,6 +1072,7 @@ static void test_acpi_q35_kvm_core_count(void) { test_data data = { .machine = MACHINE_Q35, + .arch = "x86", .variant = ".core-count", .required_struct_types = base_required_struct_types, .required_struct_types_len = ARRAY_SIZE(base_required_struct_types), @@ -1082,6 +1090,7 @@ static void test_acpi_q35_kvm_core_count2(void) { test_data data = { .machine = MACHINE_Q35, + .arch = "x86", .variant = ".core-count2", .required_struct_types = base_required_struct_types, .required_struct_types_len = ARRAY_SIZE(base_required_struct_types), @@ -1099,6 +1108,7 @@ static void test_acpi_q35_kvm_thread_count(void) { test_data data = { .machine = MACHINE_Q35, + .arch = "x86", .variant = ".thread-count", .required_struct_types = base_required_struct_types, .required_struct_types_len = ARRAY_SIZE(base_required_struct_types), @@ -1116,6 +1126,7 @@ static void test_acpi_q35_kvm_thread_count2(void) { test_data data = { .machine = MACHINE_Q35, + .arch = "x86", .variant = ".thread-count2", .required_struct_types = base_required_struct_types, .required_struct_types_len = ARRAY_SIZE(base_required_struct_types), @@ -1134,6 +1145,7 @@ static void test_acpi_q35_tcg_bridge(void) test_data data = {}; data.machine = MACHINE_Q35; + data.arch = "x86", data.variant = ".bridge"; data.required_struct_types = base_required_struct_types; data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types); @@ -1148,6 +1160,7 @@ static void test_acpi_q35_tcg_no_acpi_hotplug(void) test_data data = {}; data.machine = MACHINE_Q35; + data.arch = "x86", data.variant = ".noacpihp"; data.required_struct_types = base_required_struct_types; data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types); @@ -1176,6 +1189,7 @@ static void test_acpi_q35_multif_bridge(void) { test_data data = { .machine = MACHINE_Q35, + .arch = "x86", .variant = ".multi-bridge", }; test_vm_prepare("-S" @@ -1225,6 +1239,7 @@ static void test_acpi_q35_tcg_mmio64(void) { test_data data = { .machine = MACHINE_Q35, + .arch = "x86", .variant = ".mmio64", .tcg_only = true, .required_struct_types = base_required_struct_types, @@ -1245,6 +1260,7 @@ static void test_acpi_piix4_tcg_cphp(void) test_data data = {}; data.machine = MACHINE_PC; + data.arch = "x86"; data.variant = ".cphp"; test_acpi_one("-smp 2,cores=3,sockets=2,maxcpus=6" " -object memory-backend-ram,id=ram0,size=64M" @@ -1260,6 +1276,7 @@ static void test_acpi_q35_tcg_cphp(void) test_data data = {}; data.machine = MACHINE_Q35; + data.arch = "x86", data.variant = ".cphp"; test_acpi_one(" -smp 2,cores=3,sockets=2,maxcpus=6" " -object memory-backend-ram,id=ram0,size=64M" @@ -1279,6 +1296,7 @@ static void test_acpi_q35_tcg_ipmi(void) test_data data = {}; data.machine = MACHINE_Q35; + data.arch = "x86", data.variant = ".ipmibt"; data.required_struct_types = ipmi_required_struct_types; data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types); @@ -1293,6 +1311,7 @@ static void test_acpi_q35_tcg_smbus_ipmi(void) test_data data = {}; data.machine = MACHINE_Q35; + data.arch = "x86", data.variant = ".ipmismbus"; data.required_struct_types = ipmi_required_struct_types; data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types); @@ -1310,6 +1329,7 @@ static void test_acpi_piix4_tcg_ipmi(void) * This is to make guest actually run. */ data.machine = MACHINE_PC; + data.arch = "x86"; data.variant = ".ipmikcs"; data.required_struct_types = ipmi_required_struct_types; data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types); @@ -1324,6 +1344,7 @@ static void test_acpi_q35_tcg_memhp(void) test_data data = {}; data.machine = MACHINE_Q35; + data.arch = "x86", data.variant = ".memhp"; test_acpi_one(" -m 128,slots=3,maxmem=1G" " -object memory-backend-ram,id=ram0,size=64M" @@ -1339,6 +1360,7 @@ static void test_acpi_piix4_tcg_memhp(void) test_data data = {}; data.machine = MACHINE_PC; + data.arch = "x86"; data.variant = ".memhp"; test_acpi_one(" -m 128,slots=3,maxmem=1G" " -object memory-backend-ram,id=ram0,size=64M" @@ -1354,6 +1376,7 @@ static void test_acpi_piix4_tcg_nosmm(void) test_data data = {}; data.machine = MACHINE_PC; + data.arch = "x86"; data.variant = ".nosmm"; test_acpi_one("-machine smm=off", &data); free_test_data(&data); @@ -1364,6 +1387,7 @@ static void test_acpi_piix4_tcg_smm_compat(void) test_data data = {}; data.machine = MACHINE_PC; + data.arch = "x86"; data.variant = ".smm-compat"; test_acpi_one("-global PIIX4_PM.smm-compat=on", &data); free_test_data(&data); @@ -1374,6 +1398,7 @@ static void test_acpi_piix4_tcg_smm_compat_nosmm(void) test_data data = {}; data.machine = MACHINE_PC; + data.arch = "x86"; data.variant = ".smm-compat-nosmm"; test_acpi_one("-global PIIX4_PM.smm-compat=on -machine smm=off", &data); free_test_data(&data); @@ -1384,6 +1409,7 @@ static void test_acpi_piix4_tcg_nohpet(void) test_data data = {}; data.machine = MACHINE_PC; + data.arch = "x86"; data.machine_param = ",hpet=off"; data.variant = ".nohpet"; test_acpi_one(NULL, &data); @@ -1395,6 +1421,7 @@ static void test_acpi_q35_tcg_numamem(void) test_data data = {}; data.machine = MACHINE_Q35; + data.arch = "x86", data.variant = ".numamem"; test_acpi_one(" -object memory-backend-ram,id=ram0,size=128M" " -numa node -numa node,memdev=ram0", &data); @@ -1406,6 +1433,7 @@ static void test_acpi_q35_kvm_xapic(void) test_data data = {}; data.machine = MACHINE_Q35; + data.arch = "x86", data.variant = ".xapic"; test_acpi_one(" -object memory-backend-ram,id=ram0,size=128M" " -numa node -numa node,memdev=ram0" @@ -1418,6 +1446,7 @@ static void test_acpi_q35_tcg_nosmm(void) test_data data = {}; data.machine = MACHINE_Q35; + data.arch = "x86", data.variant = ".nosmm"; test_acpi_one("-machine smm=off", &data); free_test_data(&data); @@ -1428,6 +1457,7 @@ static void test_acpi_q35_tcg_smm_compat(void) test_data data = {}; data.machine = MACHINE_Q35; + data.arch = "x86", data.variant = ".smm-compat"; test_acpi_one("-global ICH9-LPC.smm-compat=on", &data); free_test_data(&data); @@ -1438,6 +1468,7 @@ static void test_acpi_q35_tcg_smm_compat_nosmm(void) test_data data = {}; data.machine = MACHINE_Q35; + data.arch = "x86", data.variant = ".smm-compat-nosmm"; test_acpi_one("-global ICH9-LPC.smm-compat=on -machine smm=off", &data); free_test_data(&data); @@ -1448,6 +1479,7 @@ static void test_acpi_q35_tcg_nohpet(void) test_data data = {}; data.machine = MACHINE_Q35; + data.arch = "x86", data.machine_param = ",hpet=off"; data.variant = ".nohpet"; test_acpi_one(NULL, &data); @@ -1459,6 +1491,7 @@ static void test_acpi_q35_kvm_dmar(void) test_data data = {}; data.machine = MACHINE_Q35; + data.arch = "x86", data.variant = ".dmar"; test_acpi_one("-machine kernel-irqchip=split -accel kvm" " -device intel-iommu,intremap=on,device-iotlb=on", &data); @@ -1470,6 +1503,7 @@ static void test_acpi_q35_tcg_ivrs(void) test_data data = {}; data.machine = MACHINE_Q35; + data.arch = "x86", data.variant = ".ivrs"; data.tcg_only = true, test_acpi_one(" -device amd-iommu", &data); @@ -1481,6 +1515,7 @@ static void test_acpi_piix4_tcg_numamem(void) test_data data = {}; data.machine = MACHINE_PC; + data.arch = "x86"; data.variant = ".numamem"; test_acpi_one(" -object memory-backend-ram,id=ram0,size=128M" " -numa node -numa node,memdev=ram0", &data); @@ -1489,8 +1524,9 @@ static void test_acpi_piix4_tcg_numamem(void) uint64_t tpm_tis_base_addr; -static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if, - uint64_t base, enum TPMVersion tpm_version) +static void test_acpi_tcg_tpm(const char *machine, const char *arch, + const char *tpm_if, uint64_t base, + enum TPMVersion tpm_version) { gchar *tmp_dir_name = g_strdup_printf("qemu-test_acpi_%s_tcg_%s.XXXXXX", machine, tpm_if); @@ -1517,6 +1553,7 @@ static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if, tpm_emu_test_wait_cond(&test); data.machine = machine; + data.arch = arch; data.variant = variant; args = g_strdup_printf( @@ -1540,19 +1577,20 @@ static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if, static void test_acpi_q35_tcg_tpm2_tis(void) { - test_acpi_tcg_tpm("q35", "tis", 0xFED40000, TPM_VERSION_2_0); + test_acpi_tcg_tpm("q35", "x86", "tis", 0xFED40000, TPM_VERSION_2_0); } static void test_acpi_q35_tcg_tpm12_tis(void) { - test_acpi_tcg_tpm("q35", "tis", 0xFED40000, TPM_VERSION_1_2); + test_acpi_tcg_tpm("q35", "x86", "tis", 0xFED40000, TPM_VERSION_1_2); } -static void test_acpi_tcg_dimm_pxm(const char *machine) +static void test_acpi_tcg_dimm_pxm(const char *machine, const char *arch) { test_data data = {}; data.machine = machine; + data.arch = arch; data.variant = ".dimmpxm"; test_acpi_one(" -machine nvdimm=on,nvdimm-persistence=cpu" " -smp 4,sockets=4" @@ -1579,12 +1617,12 @@ static void test_acpi_tcg_dimm_pxm(const char *machine) static void test_acpi_q35_tcg_dimm_pxm(void) { - test_acpi_tcg_dimm_pxm(MACHINE_Q35); + test_acpi_tcg_dimm_pxm(MACHINE_Q35, "x86"); } static void test_acpi_piix4_tcg_dimm_pxm(void) { - test_acpi_tcg_dimm_pxm(MACHINE_PC); + test_acpi_tcg_dimm_pxm(MACHINE_PC, "x86"); } static void test_acpi_aarch64_virt_tcg_memhp(void) @@ -1621,6 +1659,7 @@ static void test_acpi_aarch64_virt_tcg_memhp(void) static void test_acpi_microvm_prepare(test_data *data) { data->machine = "microvm"; + data->arch = "x86"; data->required_struct_types = NULL; /* no smbios */ data->required_struct_types_len = 0; data->blkdev = "virtio-blk-device"; @@ -1737,11 +1776,12 @@ static void test_acpi_aarch64_virt_tcg_pxb(void) free_test_data(&data); } -static void test_acpi_tcg_acpi_hmat(const char *machine) +static void test_acpi_tcg_acpi_hmat(const char *machine, const char *arch) { test_data data = {}; data.machine = machine; + data.arch = arch; data.variant = ".acpihmat"; test_acpi_one(" -machine hmat=on" " -smp 2,sockets=2" @@ -1770,12 +1810,12 @@ static void test_acpi_tcg_acpi_hmat(const char *machine) static void test_acpi_q35_tcg_acpi_hmat(void) { - test_acpi_tcg_acpi_hmat(MACHINE_Q35); + test_acpi_tcg_acpi_hmat(MACHINE_Q35, "x86"); } static void test_acpi_piix4_tcg_acpi_hmat(void) { - test_acpi_tcg_acpi_hmat(MACHINE_PC); + test_acpi_tcg_acpi_hmat(MACHINE_PC, "x86"); } static void test_acpi_aarch64_virt_tcg_acpi_hmat(void) @@ -1841,6 +1881,7 @@ static void test_acpi_q35_tcg_acpi_hmat_noinitiator(void) test_data data = {}; data.machine = MACHINE_Q35; + data.arch = "x86"; data.variant = ".acpihmat-noinitiator"; test_acpi_one(" -machine hmat=on" " -smp 4,sockets=2" @@ -1884,13 +1925,14 @@ static void test_acpi_q35_tcg_acpi_hmat_noinitiator(void) } #ifdef CONFIG_POSIX -static void test_acpi_erst(const char *machine) +static void test_acpi_erst(const char *machine, const char *arch) { gchar *tmp_path = g_dir_make_tmp("qemu-test-erst.XXXXXX", NULL); gchar *params; test_data data = {}; data.machine = machine; + data.arch = arch; data.variant = ".acpierst"; params = g_strdup_printf( " -object memory-backend-file,id=erstnvram," @@ -1905,12 +1947,12 @@ static void test_acpi_erst(const char *machine) static void test_acpi_piix4_acpi_erst(void) { - test_acpi_erst(MACHINE_PC); + test_acpi_erst(MACHINE_PC, "x86"); } static void test_acpi_q35_acpi_erst(void) { - test_acpi_erst(MACHINE_Q35); + test_acpi_erst(MACHINE_Q35, "x86"); } static void test_acpi_microvm_acpi_erst(void) @@ -1978,6 +2020,7 @@ static void test_acpi_q35_viot(void) { test_data data = { .machine = MACHINE_Q35, + .arch = "x86", .variant = ".viot", }; @@ -2002,6 +2045,7 @@ static void test_acpi_q35_cxl(void) test_data data = { .machine = MACHINE_Q35, + .arch = "x86", .variant = ".cxl", }; /* @@ -2067,6 +2111,7 @@ static void test_acpi_q35_slic(void) { test_data data = { .machine = MACHINE_Q35, + .arch = "x86", .variant = ".slic", }; @@ -2081,6 +2126,7 @@ static void test_acpi_q35_applesmc(void) { test_data data = { .machine = MACHINE_Q35, + .arch = "x86", .variant = ".applesmc", }; @@ -2094,6 +2140,7 @@ static void test_acpi_q35_pvpanic_isa(void) { test_data data = { .machine = MACHINE_Q35, + .arch = "x86", .variant = ".pvpanic-isa", }; @@ -2106,6 +2153,7 @@ static void test_acpi_pc_smbios_options(void) uint8_t req_type11[] = { 11 }; test_data data = { .machine = MACHINE_PC, + .arch = "x86", .variant = ".pc_smbios_options", .required_struct_types = req_type11, .required_struct_types_len = ARRAY_SIZE(req_type11), @@ -2120,6 +2168,7 @@ static void test_acpi_pc_smbios_blob(void) uint8_t req_type11[] = { 11 }; test_data data = { .machine = MACHINE_PC, + .arch = "x86", .variant = ".pc_smbios_blob", .required_struct_types = req_type11, .required_struct_types_len = ARRAY_SIZE(req_type11), @@ -2169,6 +2218,7 @@ static void test_acpi_piix4_oem_fields(void) test_data data = {}; data.machine = MACHINE_PC; + data.arch = "x86"; data.required_struct_types = base_required_struct_types; data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types); @@ -2187,6 +2237,7 @@ static void test_acpi_q35_oem_fields(void) test_data data = {}; data.machine = MACHINE_Q35; + data.arch = "x86"; data.required_struct_types = base_required_struct_types; data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types); From patchwork Tue Jul 2 14:10:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719780 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CB5F2C30658 for ; Tue, 2 Jul 2024 14:20:13 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeEE-00060U-3C; Tue, 02 Jul 2024 10:11: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 1sOeDX-000583-Sm for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11: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 1sOeDT-0000Ok-TZ for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929443; 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=0nP2DrQRonjaFy24Ds+EPs3WzJvfgKW/1tcH3BUQFDo=; b=K430Q59Hd2hFhcIHYNcgiJo9spae73T6WLLvxRm39BKQyoSd0YQJD5oJOsJHAh13QGw2nf 7FoOnB20K7F5v1lPlx3En9MJwGGu1nzMo501Nm9YsN1zPKvB6BxPl+oqg8TnbIxvsAkkiJ 1Cw8z2M9g42DX908Me67ageTuCZ16GU= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-552-wqUZUWBxMOG7i724oAdoCA-1; Tue, 02 Jul 2024 10:10:41 -0400 X-MC-Unique: wqUZUWBxMOG7i724oAdoCA-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-a725eed1cfeso287672166b.3 for ; Tue, 02 Jul 2024 07:10:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929440; x=1720534240; 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=0nP2DrQRonjaFy24Ds+EPs3WzJvfgKW/1tcH3BUQFDo=; b=KjV2iRU8+0g1AOrH6M0eBVqVplAThCDAjYkWEiJWTcxmiNQM8Duf9EEz1GRlaAAeaV QZvKLkzxG0m1NVeqlKSs3IuQLUfC40ZvNwmz2wkI0SuRVu9OsZPQzWIFHrea6rCTAeQc xRQHHgsC2gmOZiHdDJ0svrNSGvR40LfkdWr26u6NouCDSBx544WjC3ISFSIXulJzJLYT fP3inYx+a+eLRioMfF6TAjRXWnvanRt/X9Q/WD6/I4i/3yX31PJGU7vqan+/nStEXYmK RoB8ZKrtgqv/MpUJjOn+TmqllC2IAt8QdjmOE4tvcmtrOtLQp52n+8k1Fhjn434cUhQ0 463w== X-Gm-Message-State: AOJu0YzXUbIb0RSuUcBACXcteFcvnpvvk+lL5oAcVXWL3fu1LvgvEBDn qJXsjqhMKWKAzP57YU3nvdQPqLdDufMcdY5135FuF5PlhpSWExNWGdHd4rTJxleotWYCaRsax1Q mx8XYZ0V4UkZKFUBdsdAFB2/1zm44BeUMT/ffPMbqX3YVz20anm3F8WfJXqLdPO5dWyQVyZDdfN CBSvO2P7G3C3lr/adLVsIK/GtrVVSkAw== X-Received: by 2002:a17:907:7242:b0:a6f:c886:b68b with SMTP id a640c23a62f3a-a75144398a9mr808382166b.43.1719929439821; Tue, 02 Jul 2024 07:10:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGxN8G5PjxOFzpvT1yMHsEh57L8Sg6/mGUYcybLQwPPorYI8cG6z6qg3DP0Uv4JhZhf+Whh5w== X-Received: by 2002:a17:907:7242:b0:a6f:c886:b68b with SMTP id a640c23a62f3a-a75144398a9mr808377366b.43.1719929439010; Tue, 02 Jul 2024 07:10:39 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72ab0b7f45sm424740166b.214.2024.07.02.07.10.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:10:38 -0700 (PDT) Date: Tue, 2 Jul 2024 10:10:36 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Sunil V L , Igor Mammedov Subject: [PULL 70/91] tests/data/acpi: Move x86 ACPI tables under x86/${machine} path Message-ID: <1e9e7d076887e30c9c283eeddac98e4c52d0acdf.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Sunil V L To support multiple architectures using same machine name, create x86 folder and move all x86 related AML files for each machine type inside. Signed-off-by: Sunil V L Reviewed-by: Igor Mammedov Message-Id: <20240625150839.1358279-10-sunilvl@ventanamicro.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/data/acpi/{ => x86}/microvm/APIC | Bin tests/data/acpi/{ => x86}/microvm/APIC.ioapic2 | Bin tests/data/acpi/{ => x86}/microvm/APIC.pcie | Bin tests/data/acpi/{ => x86}/microvm/DSDT | Bin tests/data/acpi/{ => x86}/microvm/DSDT.ioapic2 | Bin tests/data/acpi/{ => x86}/microvm/DSDT.pcie | Bin tests/data/acpi/{ => x86}/microvm/DSDT.rtc | Bin tests/data/acpi/{ => x86}/microvm/DSDT.usb | Bin tests/data/acpi/{ => x86}/microvm/ERST.pcie | Bin tests/data/acpi/{ => x86}/microvm/FACP | Bin tests/data/acpi/{ => x86}/pc/APIC | Bin tests/data/acpi/{ => x86}/pc/APIC.acpihmat | Bin tests/data/acpi/{ => x86}/pc/APIC.cphp | Bin tests/data/acpi/{ => x86}/pc/APIC.dimmpxm | Bin tests/data/acpi/{ => x86}/pc/DSDT | Bin tests/data/acpi/{ => x86}/pc/DSDT.acpierst | Bin tests/data/acpi/{ => x86}/pc/DSDT.acpihmat | Bin tests/data/acpi/{ => x86}/pc/DSDT.bridge | Bin tests/data/acpi/{ => x86}/pc/DSDT.cphp | Bin tests/data/acpi/{ => x86}/pc/DSDT.dimmpxm | Bin tests/data/acpi/{ => x86}/pc/DSDT.hpbridge | Bin tests/data/acpi/{ => x86}/pc/DSDT.hpbrroot | Bin tests/data/acpi/{ => x86}/pc/DSDT.ipmikcs | Bin tests/data/acpi/{ => x86}/pc/DSDT.memhp | Bin tests/data/acpi/{ => x86}/pc/DSDT.nohpet | Bin tests/data/acpi/{ => x86}/pc/DSDT.numamem | Bin tests/data/acpi/{ => x86}/pc/DSDT.roothp | Bin tests/data/acpi/{ => x86}/pc/ERST.acpierst | Bin tests/data/acpi/{ => x86}/pc/FACP | Bin tests/data/acpi/{ => x86}/pc/FACP.nosmm | Bin tests/data/acpi/{ => x86}/pc/FACS | Bin tests/data/acpi/{ => x86}/pc/HMAT.acpihmat | Bin tests/data/acpi/{ => x86}/pc/HPET | Bin tests/data/acpi/{ => x86}/pc/NFIT.dimmpxm | Bin tests/data/acpi/{ => x86}/pc/SLIT.cphp | Bin tests/data/acpi/{ => x86}/pc/SLIT.memhp | Bin tests/data/acpi/{ => x86}/pc/SRAT.acpihmat | Bin tests/data/acpi/{ => x86}/pc/SRAT.cphp | Bin tests/data/acpi/{ => x86}/pc/SRAT.dimmpxm | Bin tests/data/acpi/{ => x86}/pc/SRAT.memhp | Bin tests/data/acpi/{ => x86}/pc/SRAT.numamem | Bin tests/data/acpi/{ => x86}/pc/SSDT.dimmpxm | Bin tests/data/acpi/{ => x86}/pc/WAET | Bin tests/data/acpi/{ => x86}/q35/APIC | Bin tests/data/acpi/{ => x86}/q35/APIC.acpihmat | Bin .../acpi/{ => x86}/q35/APIC.acpihmat-noinitiator | Bin tests/data/acpi/{ => x86}/q35/APIC.core-count | Bin tests/data/acpi/{ => x86}/q35/APIC.core-count2 | Bin tests/data/acpi/{ => x86}/q35/APIC.cphp | Bin tests/data/acpi/{ => x86}/q35/APIC.dimmpxm | Bin tests/data/acpi/{ => x86}/q35/APIC.thread-count | Bin tests/data/acpi/{ => x86}/q35/APIC.thread-count2 | Bin tests/data/acpi/{ => x86}/q35/APIC.type4-count | Bin tests/data/acpi/{ => x86}/q35/APIC.xapic | Bin tests/data/acpi/{ => x86}/q35/CEDT.cxl | Bin tests/data/acpi/{ => x86}/q35/DMAR.dmar | Bin tests/data/acpi/{ => x86}/q35/DSDT | Bin tests/data/acpi/{ => x86}/q35/DSDT.acpierst | Bin tests/data/acpi/{ => x86}/q35/DSDT.acpihmat | Bin .../acpi/{ => x86}/q35/DSDT.acpihmat-noinitiator | Bin tests/data/acpi/{ => x86}/q35/DSDT.applesmc | Bin tests/data/acpi/{ => x86}/q35/DSDT.bridge | Bin tests/data/acpi/{ => x86}/q35/DSDT.core-count | Bin tests/data/acpi/{ => x86}/q35/DSDT.core-count2 | Bin tests/data/acpi/{ => x86}/q35/DSDT.cphp | Bin tests/data/acpi/{ => x86}/q35/DSDT.cxl | Bin tests/data/acpi/{ => x86}/q35/DSDT.dimmpxm | Bin tests/data/acpi/{ => x86}/q35/DSDT.ipmibt | Bin tests/data/acpi/{ => x86}/q35/DSDT.ipmismbus | Bin tests/data/acpi/{ => x86}/q35/DSDT.ivrs | Bin tests/data/acpi/{ => x86}/q35/DSDT.memhp | Bin tests/data/acpi/{ => x86}/q35/DSDT.mmio64 | Bin tests/data/acpi/{ => x86}/q35/DSDT.multi-bridge | Bin tests/data/acpi/{ => x86}/q35/DSDT.noacpihp | Bin tests/data/acpi/{ => x86}/q35/DSDT.nohpet | Bin tests/data/acpi/{ => x86}/q35/DSDT.numamem | Bin tests/data/acpi/{ => x86}/q35/DSDT.pvpanic-isa | Bin tests/data/acpi/{ => x86}/q35/DSDT.thread-count | Bin tests/data/acpi/{ => x86}/q35/DSDT.thread-count2 | Bin tests/data/acpi/{ => x86}/q35/DSDT.tis.tpm12 | Bin tests/data/acpi/{ => x86}/q35/DSDT.tis.tpm2 | Bin tests/data/acpi/{ => x86}/q35/DSDT.type4-count | Bin tests/data/acpi/{ => x86}/q35/DSDT.viot | Bin tests/data/acpi/{ => x86}/q35/DSDT.xapic | Bin tests/data/acpi/{ => x86}/q35/ERST.acpierst | Bin tests/data/acpi/{ => x86}/q35/FACP | Bin tests/data/acpi/{ => x86}/q35/FACP.core-count | Bin tests/data/acpi/{ => x86}/q35/FACP.core-count2 | Bin tests/data/acpi/{ => x86}/q35/FACP.nosmm | Bin tests/data/acpi/{ => x86}/q35/FACP.slic | Bin tests/data/acpi/{ => x86}/q35/FACP.thread-count | Bin tests/data/acpi/{ => x86}/q35/FACP.thread-count2 | Bin tests/data/acpi/{ => x86}/q35/FACP.type4-count | Bin tests/data/acpi/{ => x86}/q35/FACP.xapic | Bin tests/data/acpi/{ => x86}/q35/FACS | Bin tests/data/acpi/{ => x86}/q35/HMAT.acpihmat | Bin .../acpi/{ => x86}/q35/HMAT.acpihmat-noinitiator | Bin tests/data/acpi/{ => x86}/q35/HPET | Bin tests/data/acpi/{ => x86}/q35/IVRS.ivrs | Bin tests/data/acpi/{ => x86}/q35/MCFG | Bin tests/data/acpi/{ => x86}/q35/NFIT.dimmpxm | Bin tests/data/acpi/{ => x86}/q35/SLIC.slic | Bin tests/data/acpi/{ => x86}/q35/SLIT.cphp | Bin tests/data/acpi/{ => x86}/q35/SLIT.memhp | Bin tests/data/acpi/{ => x86}/q35/SRAT.acpihmat | Bin .../acpi/{ => x86}/q35/SRAT.acpihmat-noinitiator | Bin tests/data/acpi/{ => x86}/q35/SRAT.cphp | Bin tests/data/acpi/{ => x86}/q35/SRAT.dimmpxm | Bin tests/data/acpi/{ => x86}/q35/SRAT.memhp | Bin tests/data/acpi/{ => x86}/q35/SRAT.mmio64 | Bin tests/data/acpi/{ => x86}/q35/SRAT.numamem | Bin tests/data/acpi/{ => x86}/q35/SRAT.xapic | Bin tests/data/acpi/{ => x86}/q35/SSDT.dimmpxm | Bin tests/data/acpi/{ => x86}/q35/TCPA.tis.tpm12 | Bin tests/data/acpi/{ => x86}/q35/TPM2.tis.tpm2 | Bin tests/data/acpi/{ => x86}/q35/VIOT.viot | Bin tests/data/acpi/{ => x86}/q35/WAET | Bin 117 files changed, 0 insertions(+), 0 deletions(-) rename tests/data/acpi/{ => x86}/microvm/APIC (100%) rename tests/data/acpi/{ => x86}/microvm/APIC.ioapic2 (100%) rename tests/data/acpi/{ => x86}/microvm/APIC.pcie (100%) rename tests/data/acpi/{ => x86}/microvm/DSDT (100%) rename tests/data/acpi/{ => x86}/microvm/DSDT.ioapic2 (100%) rename tests/data/acpi/{ => x86}/microvm/DSDT.pcie (100%) rename tests/data/acpi/{ => x86}/microvm/DSDT.rtc (100%) rename tests/data/acpi/{ => x86}/microvm/DSDT.usb (100%) rename tests/data/acpi/{ => x86}/microvm/ERST.pcie (100%) rename tests/data/acpi/{ => x86}/microvm/FACP (100%) rename tests/data/acpi/{ => x86}/pc/APIC (100%) rename tests/data/acpi/{ => x86}/pc/APIC.acpihmat (100%) rename tests/data/acpi/{ => x86}/pc/APIC.cphp (100%) rename tests/data/acpi/{ => x86}/pc/APIC.dimmpxm (100%) rename tests/data/acpi/{ => x86}/pc/DSDT (100%) rename tests/data/acpi/{ => x86}/pc/DSDT.acpierst (100%) rename tests/data/acpi/{ => x86}/pc/DSDT.acpihmat (100%) rename tests/data/acpi/{ => x86}/pc/DSDT.bridge (100%) rename tests/data/acpi/{ => x86}/pc/DSDT.cphp (100%) rename tests/data/acpi/{ => x86}/pc/DSDT.dimmpxm (100%) rename tests/data/acpi/{ => x86}/pc/DSDT.hpbridge (100%) rename tests/data/acpi/{ => x86}/pc/DSDT.hpbrroot (100%) rename tests/data/acpi/{ => x86}/pc/DSDT.ipmikcs (100%) rename tests/data/acpi/{ => x86}/pc/DSDT.memhp (100%) rename tests/data/acpi/{ => x86}/pc/DSDT.nohpet (100%) rename tests/data/acpi/{ => x86}/pc/DSDT.numamem (100%) rename tests/data/acpi/{ => x86}/pc/DSDT.roothp (100%) rename tests/data/acpi/{ => x86}/pc/ERST.acpierst (100%) rename tests/data/acpi/{ => x86}/pc/FACP (100%) rename tests/data/acpi/{ => x86}/pc/FACP.nosmm (100%) rename tests/data/acpi/{ => x86}/pc/FACS (100%) rename tests/data/acpi/{ => x86}/pc/HMAT.acpihmat (100%) rename tests/data/acpi/{ => x86}/pc/HPET (100%) rename tests/data/acpi/{ => x86}/pc/NFIT.dimmpxm (100%) rename tests/data/acpi/{ => x86}/pc/SLIT.cphp (100%) rename tests/data/acpi/{ => x86}/pc/SLIT.memhp (100%) rename tests/data/acpi/{ => x86}/pc/SRAT.acpihmat (100%) rename tests/data/acpi/{ => x86}/pc/SRAT.cphp (100%) rename tests/data/acpi/{ => x86}/pc/SRAT.dimmpxm (100%) rename tests/data/acpi/{ => x86}/pc/SRAT.memhp (100%) rename tests/data/acpi/{ => x86}/pc/SRAT.numamem (100%) rename tests/data/acpi/{ => x86}/pc/SSDT.dimmpxm (100%) rename tests/data/acpi/{ => x86}/pc/WAET (100%) rename tests/data/acpi/{ => x86}/q35/APIC (100%) rename tests/data/acpi/{ => x86}/q35/APIC.acpihmat (100%) rename tests/data/acpi/{ => x86}/q35/APIC.acpihmat-noinitiator (100%) rename tests/data/acpi/{ => x86}/q35/APIC.core-count (100%) rename tests/data/acpi/{ => x86}/q35/APIC.core-count2 (100%) rename tests/data/acpi/{ => x86}/q35/APIC.cphp (100%) rename tests/data/acpi/{ => x86}/q35/APIC.dimmpxm (100%) rename tests/data/acpi/{ => x86}/q35/APIC.thread-count (100%) rename tests/data/acpi/{ => x86}/q35/APIC.thread-count2 (100%) rename tests/data/acpi/{ => x86}/q35/APIC.type4-count (100%) rename tests/data/acpi/{ => x86}/q35/APIC.xapic (100%) rename tests/data/acpi/{ => x86}/q35/CEDT.cxl (100%) rename tests/data/acpi/{ => x86}/q35/DMAR.dmar (100%) rename tests/data/acpi/{ => x86}/q35/DSDT (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.acpierst (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.acpihmat (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.acpihmat-noinitiator (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.applesmc (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.bridge (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.core-count (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.core-count2 (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.cphp (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.cxl (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.dimmpxm (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.ipmibt (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.ipmismbus (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.ivrs (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.memhp (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.mmio64 (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.multi-bridge (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.noacpihp (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.nohpet (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.numamem (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.pvpanic-isa (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.thread-count (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.thread-count2 (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.tis.tpm12 (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.tis.tpm2 (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.type4-count (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.viot (100%) rename tests/data/acpi/{ => x86}/q35/DSDT.xapic (100%) rename tests/data/acpi/{ => x86}/q35/ERST.acpierst (100%) rename tests/data/acpi/{ => x86}/q35/FACP (100%) rename tests/data/acpi/{ => x86}/q35/FACP.core-count (100%) rename tests/data/acpi/{ => x86}/q35/FACP.core-count2 (100%) rename tests/data/acpi/{ => x86}/q35/FACP.nosmm (100%) rename tests/data/acpi/{ => x86}/q35/FACP.slic (100%) rename tests/data/acpi/{ => x86}/q35/FACP.thread-count (100%) rename tests/data/acpi/{ => x86}/q35/FACP.thread-count2 (100%) rename tests/data/acpi/{ => x86}/q35/FACP.type4-count (100%) rename tests/data/acpi/{ => x86}/q35/FACP.xapic (100%) rename tests/data/acpi/{ => x86}/q35/FACS (100%) rename tests/data/acpi/{ => x86}/q35/HMAT.acpihmat (100%) rename tests/data/acpi/{ => x86}/q35/HMAT.acpihmat-noinitiator (100%) rename tests/data/acpi/{ => x86}/q35/HPET (100%) rename tests/data/acpi/{ => x86}/q35/IVRS.ivrs (100%) rename tests/data/acpi/{ => x86}/q35/MCFG (100%) rename tests/data/acpi/{ => x86}/q35/NFIT.dimmpxm (100%) rename tests/data/acpi/{ => x86}/q35/SLIC.slic (100%) rename tests/data/acpi/{ => x86}/q35/SLIT.cphp (100%) rename tests/data/acpi/{ => x86}/q35/SLIT.memhp (100%) rename tests/data/acpi/{ => x86}/q35/SRAT.acpihmat (100%) rename tests/data/acpi/{ => x86}/q35/SRAT.acpihmat-noinitiator (100%) rename tests/data/acpi/{ => x86}/q35/SRAT.cphp (100%) rename tests/data/acpi/{ => x86}/q35/SRAT.dimmpxm (100%) rename tests/data/acpi/{ => x86}/q35/SRAT.memhp (100%) rename tests/data/acpi/{ => x86}/q35/SRAT.mmio64 (100%) rename tests/data/acpi/{ => x86}/q35/SRAT.numamem (100%) rename tests/data/acpi/{ => x86}/q35/SRAT.xapic (100%) rename tests/data/acpi/{ => x86}/q35/SSDT.dimmpxm (100%) rename tests/data/acpi/{ => x86}/q35/TCPA.tis.tpm12 (100%) rename tests/data/acpi/{ => x86}/q35/TPM2.tis.tpm2 (100%) rename tests/data/acpi/{ => x86}/q35/VIOT.viot (100%) rename tests/data/acpi/{ => x86}/q35/WAET (100%) diff --git a/tests/data/acpi/microvm/APIC b/tests/data/acpi/x86/microvm/APIC similarity index 100% rename from tests/data/acpi/microvm/APIC rename to tests/data/acpi/x86/microvm/APIC diff --git a/tests/data/acpi/microvm/APIC.ioapic2 b/tests/data/acpi/x86/microvm/APIC.ioapic2 similarity index 100% rename from tests/data/acpi/microvm/APIC.ioapic2 rename to tests/data/acpi/x86/microvm/APIC.ioapic2 diff --git a/tests/data/acpi/microvm/APIC.pcie b/tests/data/acpi/x86/microvm/APIC.pcie similarity index 100% rename from tests/data/acpi/microvm/APIC.pcie rename to tests/data/acpi/x86/microvm/APIC.pcie diff --git a/tests/data/acpi/microvm/DSDT b/tests/data/acpi/x86/microvm/DSDT similarity index 100% rename from tests/data/acpi/microvm/DSDT rename to tests/data/acpi/x86/microvm/DSDT diff --git a/tests/data/acpi/microvm/DSDT.ioapic2 b/tests/data/acpi/x86/microvm/DSDT.ioapic2 similarity index 100% rename from tests/data/acpi/microvm/DSDT.ioapic2 rename to tests/data/acpi/x86/microvm/DSDT.ioapic2 diff --git a/tests/data/acpi/microvm/DSDT.pcie b/tests/data/acpi/x86/microvm/DSDT.pcie similarity index 100% rename from tests/data/acpi/microvm/DSDT.pcie rename to tests/data/acpi/x86/microvm/DSDT.pcie diff --git a/tests/data/acpi/microvm/DSDT.rtc b/tests/data/acpi/x86/microvm/DSDT.rtc similarity index 100% rename from tests/data/acpi/microvm/DSDT.rtc rename to tests/data/acpi/x86/microvm/DSDT.rtc diff --git a/tests/data/acpi/microvm/DSDT.usb b/tests/data/acpi/x86/microvm/DSDT.usb similarity index 100% rename from tests/data/acpi/microvm/DSDT.usb rename to tests/data/acpi/x86/microvm/DSDT.usb diff --git a/tests/data/acpi/microvm/ERST.pcie b/tests/data/acpi/x86/microvm/ERST.pcie similarity index 100% rename from tests/data/acpi/microvm/ERST.pcie rename to tests/data/acpi/x86/microvm/ERST.pcie diff --git a/tests/data/acpi/microvm/FACP b/tests/data/acpi/x86/microvm/FACP similarity index 100% rename from tests/data/acpi/microvm/FACP rename to tests/data/acpi/x86/microvm/FACP diff --git a/tests/data/acpi/pc/APIC b/tests/data/acpi/x86/pc/APIC similarity index 100% rename from tests/data/acpi/pc/APIC rename to tests/data/acpi/x86/pc/APIC diff --git a/tests/data/acpi/pc/APIC.acpihmat b/tests/data/acpi/x86/pc/APIC.acpihmat similarity index 100% rename from tests/data/acpi/pc/APIC.acpihmat rename to tests/data/acpi/x86/pc/APIC.acpihmat diff --git a/tests/data/acpi/pc/APIC.cphp b/tests/data/acpi/x86/pc/APIC.cphp similarity index 100% rename from tests/data/acpi/pc/APIC.cphp rename to tests/data/acpi/x86/pc/APIC.cphp diff --git a/tests/data/acpi/pc/APIC.dimmpxm b/tests/data/acpi/x86/pc/APIC.dimmpxm similarity index 100% rename from tests/data/acpi/pc/APIC.dimmpxm rename to tests/data/acpi/x86/pc/APIC.dimmpxm diff --git a/tests/data/acpi/pc/DSDT b/tests/data/acpi/x86/pc/DSDT similarity index 100% rename from tests/data/acpi/pc/DSDT rename to tests/data/acpi/x86/pc/DSDT diff --git a/tests/data/acpi/pc/DSDT.acpierst b/tests/data/acpi/x86/pc/DSDT.acpierst similarity index 100% rename from tests/data/acpi/pc/DSDT.acpierst rename to tests/data/acpi/x86/pc/DSDT.acpierst diff --git a/tests/data/acpi/pc/DSDT.acpihmat b/tests/data/acpi/x86/pc/DSDT.acpihmat similarity index 100% rename from tests/data/acpi/pc/DSDT.acpihmat rename to tests/data/acpi/x86/pc/DSDT.acpihmat diff --git a/tests/data/acpi/pc/DSDT.bridge b/tests/data/acpi/x86/pc/DSDT.bridge similarity index 100% rename from tests/data/acpi/pc/DSDT.bridge rename to tests/data/acpi/x86/pc/DSDT.bridge diff --git a/tests/data/acpi/pc/DSDT.cphp b/tests/data/acpi/x86/pc/DSDT.cphp similarity index 100% rename from tests/data/acpi/pc/DSDT.cphp rename to tests/data/acpi/x86/pc/DSDT.cphp diff --git a/tests/data/acpi/pc/DSDT.dimmpxm b/tests/data/acpi/x86/pc/DSDT.dimmpxm similarity index 100% rename from tests/data/acpi/pc/DSDT.dimmpxm rename to tests/data/acpi/x86/pc/DSDT.dimmpxm diff --git a/tests/data/acpi/pc/DSDT.hpbridge b/tests/data/acpi/x86/pc/DSDT.hpbridge similarity index 100% rename from tests/data/acpi/pc/DSDT.hpbridge rename to tests/data/acpi/x86/pc/DSDT.hpbridge diff --git a/tests/data/acpi/pc/DSDT.hpbrroot b/tests/data/acpi/x86/pc/DSDT.hpbrroot similarity index 100% rename from tests/data/acpi/pc/DSDT.hpbrroot rename to tests/data/acpi/x86/pc/DSDT.hpbrroot diff --git a/tests/data/acpi/pc/DSDT.ipmikcs b/tests/data/acpi/x86/pc/DSDT.ipmikcs similarity index 100% rename from tests/data/acpi/pc/DSDT.ipmikcs rename to tests/data/acpi/x86/pc/DSDT.ipmikcs diff --git a/tests/data/acpi/pc/DSDT.memhp b/tests/data/acpi/x86/pc/DSDT.memhp similarity index 100% rename from tests/data/acpi/pc/DSDT.memhp rename to tests/data/acpi/x86/pc/DSDT.memhp diff --git a/tests/data/acpi/pc/DSDT.nohpet b/tests/data/acpi/x86/pc/DSDT.nohpet similarity index 100% rename from tests/data/acpi/pc/DSDT.nohpet rename to tests/data/acpi/x86/pc/DSDT.nohpet diff --git a/tests/data/acpi/pc/DSDT.numamem b/tests/data/acpi/x86/pc/DSDT.numamem similarity index 100% rename from tests/data/acpi/pc/DSDT.numamem rename to tests/data/acpi/x86/pc/DSDT.numamem diff --git a/tests/data/acpi/pc/DSDT.roothp b/tests/data/acpi/x86/pc/DSDT.roothp similarity index 100% rename from tests/data/acpi/pc/DSDT.roothp rename to tests/data/acpi/x86/pc/DSDT.roothp diff --git a/tests/data/acpi/pc/ERST.acpierst b/tests/data/acpi/x86/pc/ERST.acpierst similarity index 100% rename from tests/data/acpi/pc/ERST.acpierst rename to tests/data/acpi/x86/pc/ERST.acpierst diff --git a/tests/data/acpi/pc/FACP b/tests/data/acpi/x86/pc/FACP similarity index 100% rename from tests/data/acpi/pc/FACP rename to tests/data/acpi/x86/pc/FACP diff --git a/tests/data/acpi/pc/FACP.nosmm b/tests/data/acpi/x86/pc/FACP.nosmm similarity index 100% rename from tests/data/acpi/pc/FACP.nosmm rename to tests/data/acpi/x86/pc/FACP.nosmm diff --git a/tests/data/acpi/pc/FACS b/tests/data/acpi/x86/pc/FACS similarity index 100% rename from tests/data/acpi/pc/FACS rename to tests/data/acpi/x86/pc/FACS diff --git a/tests/data/acpi/pc/HMAT.acpihmat b/tests/data/acpi/x86/pc/HMAT.acpihmat similarity index 100% rename from tests/data/acpi/pc/HMAT.acpihmat rename to tests/data/acpi/x86/pc/HMAT.acpihmat diff --git a/tests/data/acpi/pc/HPET b/tests/data/acpi/x86/pc/HPET similarity index 100% rename from tests/data/acpi/pc/HPET rename to tests/data/acpi/x86/pc/HPET diff --git a/tests/data/acpi/pc/NFIT.dimmpxm b/tests/data/acpi/x86/pc/NFIT.dimmpxm similarity index 100% rename from tests/data/acpi/pc/NFIT.dimmpxm rename to tests/data/acpi/x86/pc/NFIT.dimmpxm diff --git a/tests/data/acpi/pc/SLIT.cphp b/tests/data/acpi/x86/pc/SLIT.cphp similarity index 100% rename from tests/data/acpi/pc/SLIT.cphp rename to tests/data/acpi/x86/pc/SLIT.cphp diff --git a/tests/data/acpi/pc/SLIT.memhp b/tests/data/acpi/x86/pc/SLIT.memhp similarity index 100% rename from tests/data/acpi/pc/SLIT.memhp rename to tests/data/acpi/x86/pc/SLIT.memhp diff --git a/tests/data/acpi/pc/SRAT.acpihmat b/tests/data/acpi/x86/pc/SRAT.acpihmat similarity index 100% rename from tests/data/acpi/pc/SRAT.acpihmat rename to tests/data/acpi/x86/pc/SRAT.acpihmat diff --git a/tests/data/acpi/pc/SRAT.cphp b/tests/data/acpi/x86/pc/SRAT.cphp similarity index 100% rename from tests/data/acpi/pc/SRAT.cphp rename to tests/data/acpi/x86/pc/SRAT.cphp diff --git a/tests/data/acpi/pc/SRAT.dimmpxm b/tests/data/acpi/x86/pc/SRAT.dimmpxm similarity index 100% rename from tests/data/acpi/pc/SRAT.dimmpxm rename to tests/data/acpi/x86/pc/SRAT.dimmpxm diff --git a/tests/data/acpi/pc/SRAT.memhp b/tests/data/acpi/x86/pc/SRAT.memhp similarity index 100% rename from tests/data/acpi/pc/SRAT.memhp rename to tests/data/acpi/x86/pc/SRAT.memhp diff --git a/tests/data/acpi/pc/SRAT.numamem b/tests/data/acpi/x86/pc/SRAT.numamem similarity index 100% rename from tests/data/acpi/pc/SRAT.numamem rename to tests/data/acpi/x86/pc/SRAT.numamem diff --git a/tests/data/acpi/pc/SSDT.dimmpxm b/tests/data/acpi/x86/pc/SSDT.dimmpxm similarity index 100% rename from tests/data/acpi/pc/SSDT.dimmpxm rename to tests/data/acpi/x86/pc/SSDT.dimmpxm diff --git a/tests/data/acpi/pc/WAET b/tests/data/acpi/x86/pc/WAET similarity index 100% rename from tests/data/acpi/pc/WAET rename to tests/data/acpi/x86/pc/WAET diff --git a/tests/data/acpi/q35/APIC b/tests/data/acpi/x86/q35/APIC similarity index 100% rename from tests/data/acpi/q35/APIC rename to tests/data/acpi/x86/q35/APIC diff --git a/tests/data/acpi/q35/APIC.acpihmat b/tests/data/acpi/x86/q35/APIC.acpihmat similarity index 100% rename from tests/data/acpi/q35/APIC.acpihmat rename to tests/data/acpi/x86/q35/APIC.acpihmat diff --git a/tests/data/acpi/q35/APIC.acpihmat-noinitiator b/tests/data/acpi/x86/q35/APIC.acpihmat-noinitiator similarity index 100% rename from tests/data/acpi/q35/APIC.acpihmat-noinitiator rename to tests/data/acpi/x86/q35/APIC.acpihmat-noinitiator diff --git a/tests/data/acpi/q35/APIC.core-count b/tests/data/acpi/x86/q35/APIC.core-count similarity index 100% rename from tests/data/acpi/q35/APIC.core-count rename to tests/data/acpi/x86/q35/APIC.core-count diff --git a/tests/data/acpi/q35/APIC.core-count2 b/tests/data/acpi/x86/q35/APIC.core-count2 similarity index 100% rename from tests/data/acpi/q35/APIC.core-count2 rename to tests/data/acpi/x86/q35/APIC.core-count2 diff --git a/tests/data/acpi/q35/APIC.cphp b/tests/data/acpi/x86/q35/APIC.cphp similarity index 100% rename from tests/data/acpi/q35/APIC.cphp rename to tests/data/acpi/x86/q35/APIC.cphp diff --git a/tests/data/acpi/q35/APIC.dimmpxm b/tests/data/acpi/x86/q35/APIC.dimmpxm similarity index 100% rename from tests/data/acpi/q35/APIC.dimmpxm rename to tests/data/acpi/x86/q35/APIC.dimmpxm diff --git a/tests/data/acpi/q35/APIC.thread-count b/tests/data/acpi/x86/q35/APIC.thread-count similarity index 100% rename from tests/data/acpi/q35/APIC.thread-count rename to tests/data/acpi/x86/q35/APIC.thread-count diff --git a/tests/data/acpi/q35/APIC.thread-count2 b/tests/data/acpi/x86/q35/APIC.thread-count2 similarity index 100% rename from tests/data/acpi/q35/APIC.thread-count2 rename to tests/data/acpi/x86/q35/APIC.thread-count2 diff --git a/tests/data/acpi/q35/APIC.type4-count b/tests/data/acpi/x86/q35/APIC.type4-count similarity index 100% rename from tests/data/acpi/q35/APIC.type4-count rename to tests/data/acpi/x86/q35/APIC.type4-count diff --git a/tests/data/acpi/q35/APIC.xapic b/tests/data/acpi/x86/q35/APIC.xapic similarity index 100% rename from tests/data/acpi/q35/APIC.xapic rename to tests/data/acpi/x86/q35/APIC.xapic diff --git a/tests/data/acpi/q35/CEDT.cxl b/tests/data/acpi/x86/q35/CEDT.cxl similarity index 100% rename from tests/data/acpi/q35/CEDT.cxl rename to tests/data/acpi/x86/q35/CEDT.cxl diff --git a/tests/data/acpi/q35/DMAR.dmar b/tests/data/acpi/x86/q35/DMAR.dmar similarity index 100% rename from tests/data/acpi/q35/DMAR.dmar rename to tests/data/acpi/x86/q35/DMAR.dmar diff --git a/tests/data/acpi/q35/DSDT b/tests/data/acpi/x86/q35/DSDT similarity index 100% rename from tests/data/acpi/q35/DSDT rename to tests/data/acpi/x86/q35/DSDT diff --git a/tests/data/acpi/q35/DSDT.acpierst b/tests/data/acpi/x86/q35/DSDT.acpierst similarity index 100% rename from tests/data/acpi/q35/DSDT.acpierst rename to tests/data/acpi/x86/q35/DSDT.acpierst diff --git a/tests/data/acpi/q35/DSDT.acpihmat b/tests/data/acpi/x86/q35/DSDT.acpihmat similarity index 100% rename from tests/data/acpi/q35/DSDT.acpihmat rename to tests/data/acpi/x86/q35/DSDT.acpihmat diff --git a/tests/data/acpi/q35/DSDT.acpihmat-noinitiator b/tests/data/acpi/x86/q35/DSDT.acpihmat-noinitiator similarity index 100% rename from tests/data/acpi/q35/DSDT.acpihmat-noinitiator rename to tests/data/acpi/x86/q35/DSDT.acpihmat-noinitiator diff --git a/tests/data/acpi/q35/DSDT.applesmc b/tests/data/acpi/x86/q35/DSDT.applesmc similarity index 100% rename from tests/data/acpi/q35/DSDT.applesmc rename to tests/data/acpi/x86/q35/DSDT.applesmc diff --git a/tests/data/acpi/q35/DSDT.bridge b/tests/data/acpi/x86/q35/DSDT.bridge similarity index 100% rename from tests/data/acpi/q35/DSDT.bridge rename to tests/data/acpi/x86/q35/DSDT.bridge diff --git a/tests/data/acpi/q35/DSDT.core-count b/tests/data/acpi/x86/q35/DSDT.core-count similarity index 100% rename from tests/data/acpi/q35/DSDT.core-count rename to tests/data/acpi/x86/q35/DSDT.core-count diff --git a/tests/data/acpi/q35/DSDT.core-count2 b/tests/data/acpi/x86/q35/DSDT.core-count2 similarity index 100% rename from tests/data/acpi/q35/DSDT.core-count2 rename to tests/data/acpi/x86/q35/DSDT.core-count2 diff --git a/tests/data/acpi/q35/DSDT.cphp b/tests/data/acpi/x86/q35/DSDT.cphp similarity index 100% rename from tests/data/acpi/q35/DSDT.cphp rename to tests/data/acpi/x86/q35/DSDT.cphp diff --git a/tests/data/acpi/q35/DSDT.cxl b/tests/data/acpi/x86/q35/DSDT.cxl similarity index 100% rename from tests/data/acpi/q35/DSDT.cxl rename to tests/data/acpi/x86/q35/DSDT.cxl diff --git a/tests/data/acpi/q35/DSDT.dimmpxm b/tests/data/acpi/x86/q35/DSDT.dimmpxm similarity index 100% rename from tests/data/acpi/q35/DSDT.dimmpxm rename to tests/data/acpi/x86/q35/DSDT.dimmpxm diff --git a/tests/data/acpi/q35/DSDT.ipmibt b/tests/data/acpi/x86/q35/DSDT.ipmibt similarity index 100% rename from tests/data/acpi/q35/DSDT.ipmibt rename to tests/data/acpi/x86/q35/DSDT.ipmibt diff --git a/tests/data/acpi/q35/DSDT.ipmismbus b/tests/data/acpi/x86/q35/DSDT.ipmismbus similarity index 100% rename from tests/data/acpi/q35/DSDT.ipmismbus rename to tests/data/acpi/x86/q35/DSDT.ipmismbus diff --git a/tests/data/acpi/q35/DSDT.ivrs b/tests/data/acpi/x86/q35/DSDT.ivrs similarity index 100% rename from tests/data/acpi/q35/DSDT.ivrs rename to tests/data/acpi/x86/q35/DSDT.ivrs diff --git a/tests/data/acpi/q35/DSDT.memhp b/tests/data/acpi/x86/q35/DSDT.memhp similarity index 100% rename from tests/data/acpi/q35/DSDT.memhp rename to tests/data/acpi/x86/q35/DSDT.memhp diff --git a/tests/data/acpi/q35/DSDT.mmio64 b/tests/data/acpi/x86/q35/DSDT.mmio64 similarity index 100% rename from tests/data/acpi/q35/DSDT.mmio64 rename to tests/data/acpi/x86/q35/DSDT.mmio64 diff --git a/tests/data/acpi/q35/DSDT.multi-bridge b/tests/data/acpi/x86/q35/DSDT.multi-bridge similarity index 100% rename from tests/data/acpi/q35/DSDT.multi-bridge rename to tests/data/acpi/x86/q35/DSDT.multi-bridge diff --git a/tests/data/acpi/q35/DSDT.noacpihp b/tests/data/acpi/x86/q35/DSDT.noacpihp similarity index 100% rename from tests/data/acpi/q35/DSDT.noacpihp rename to tests/data/acpi/x86/q35/DSDT.noacpihp diff --git a/tests/data/acpi/q35/DSDT.nohpet b/tests/data/acpi/x86/q35/DSDT.nohpet similarity index 100% rename from tests/data/acpi/q35/DSDT.nohpet rename to tests/data/acpi/x86/q35/DSDT.nohpet diff --git a/tests/data/acpi/q35/DSDT.numamem b/tests/data/acpi/x86/q35/DSDT.numamem similarity index 100% rename from tests/data/acpi/q35/DSDT.numamem rename to tests/data/acpi/x86/q35/DSDT.numamem diff --git a/tests/data/acpi/q35/DSDT.pvpanic-isa b/tests/data/acpi/x86/q35/DSDT.pvpanic-isa similarity index 100% rename from tests/data/acpi/q35/DSDT.pvpanic-isa rename to tests/data/acpi/x86/q35/DSDT.pvpanic-isa diff --git a/tests/data/acpi/q35/DSDT.thread-count b/tests/data/acpi/x86/q35/DSDT.thread-count similarity index 100% rename from tests/data/acpi/q35/DSDT.thread-count rename to tests/data/acpi/x86/q35/DSDT.thread-count diff --git a/tests/data/acpi/q35/DSDT.thread-count2 b/tests/data/acpi/x86/q35/DSDT.thread-count2 similarity index 100% rename from tests/data/acpi/q35/DSDT.thread-count2 rename to tests/data/acpi/x86/q35/DSDT.thread-count2 diff --git a/tests/data/acpi/q35/DSDT.tis.tpm12 b/tests/data/acpi/x86/q35/DSDT.tis.tpm12 similarity index 100% rename from tests/data/acpi/q35/DSDT.tis.tpm12 rename to tests/data/acpi/x86/q35/DSDT.tis.tpm12 diff --git a/tests/data/acpi/q35/DSDT.tis.tpm2 b/tests/data/acpi/x86/q35/DSDT.tis.tpm2 similarity index 100% rename from tests/data/acpi/q35/DSDT.tis.tpm2 rename to tests/data/acpi/x86/q35/DSDT.tis.tpm2 diff --git a/tests/data/acpi/q35/DSDT.type4-count b/tests/data/acpi/x86/q35/DSDT.type4-count similarity index 100% rename from tests/data/acpi/q35/DSDT.type4-count rename to tests/data/acpi/x86/q35/DSDT.type4-count diff --git a/tests/data/acpi/q35/DSDT.viot b/tests/data/acpi/x86/q35/DSDT.viot similarity index 100% rename from tests/data/acpi/q35/DSDT.viot rename to tests/data/acpi/x86/q35/DSDT.viot diff --git a/tests/data/acpi/q35/DSDT.xapic b/tests/data/acpi/x86/q35/DSDT.xapic similarity index 100% rename from tests/data/acpi/q35/DSDT.xapic rename to tests/data/acpi/x86/q35/DSDT.xapic diff --git a/tests/data/acpi/q35/ERST.acpierst b/tests/data/acpi/x86/q35/ERST.acpierst similarity index 100% rename from tests/data/acpi/q35/ERST.acpierst rename to tests/data/acpi/x86/q35/ERST.acpierst diff --git a/tests/data/acpi/q35/FACP b/tests/data/acpi/x86/q35/FACP similarity index 100% rename from tests/data/acpi/q35/FACP rename to tests/data/acpi/x86/q35/FACP diff --git a/tests/data/acpi/q35/FACP.core-count b/tests/data/acpi/x86/q35/FACP.core-count similarity index 100% rename from tests/data/acpi/q35/FACP.core-count rename to tests/data/acpi/x86/q35/FACP.core-count diff --git a/tests/data/acpi/q35/FACP.core-count2 b/tests/data/acpi/x86/q35/FACP.core-count2 similarity index 100% rename from tests/data/acpi/q35/FACP.core-count2 rename to tests/data/acpi/x86/q35/FACP.core-count2 diff --git a/tests/data/acpi/q35/FACP.nosmm b/tests/data/acpi/x86/q35/FACP.nosmm similarity index 100% rename from tests/data/acpi/q35/FACP.nosmm rename to tests/data/acpi/x86/q35/FACP.nosmm diff --git a/tests/data/acpi/q35/FACP.slic b/tests/data/acpi/x86/q35/FACP.slic similarity index 100% rename from tests/data/acpi/q35/FACP.slic rename to tests/data/acpi/x86/q35/FACP.slic diff --git a/tests/data/acpi/q35/FACP.thread-count b/tests/data/acpi/x86/q35/FACP.thread-count similarity index 100% rename from tests/data/acpi/q35/FACP.thread-count rename to tests/data/acpi/x86/q35/FACP.thread-count diff --git a/tests/data/acpi/q35/FACP.thread-count2 b/tests/data/acpi/x86/q35/FACP.thread-count2 similarity index 100% rename from tests/data/acpi/q35/FACP.thread-count2 rename to tests/data/acpi/x86/q35/FACP.thread-count2 diff --git a/tests/data/acpi/q35/FACP.type4-count b/tests/data/acpi/x86/q35/FACP.type4-count similarity index 100% rename from tests/data/acpi/q35/FACP.type4-count rename to tests/data/acpi/x86/q35/FACP.type4-count diff --git a/tests/data/acpi/q35/FACP.xapic b/tests/data/acpi/x86/q35/FACP.xapic similarity index 100% rename from tests/data/acpi/q35/FACP.xapic rename to tests/data/acpi/x86/q35/FACP.xapic diff --git a/tests/data/acpi/q35/FACS b/tests/data/acpi/x86/q35/FACS similarity index 100% rename from tests/data/acpi/q35/FACS rename to tests/data/acpi/x86/q35/FACS diff --git a/tests/data/acpi/q35/HMAT.acpihmat b/tests/data/acpi/x86/q35/HMAT.acpihmat similarity index 100% rename from tests/data/acpi/q35/HMAT.acpihmat rename to tests/data/acpi/x86/q35/HMAT.acpihmat diff --git a/tests/data/acpi/q35/HMAT.acpihmat-noinitiator b/tests/data/acpi/x86/q35/HMAT.acpihmat-noinitiator similarity index 100% rename from tests/data/acpi/q35/HMAT.acpihmat-noinitiator rename to tests/data/acpi/x86/q35/HMAT.acpihmat-noinitiator diff --git a/tests/data/acpi/q35/HPET b/tests/data/acpi/x86/q35/HPET similarity index 100% rename from tests/data/acpi/q35/HPET rename to tests/data/acpi/x86/q35/HPET diff --git a/tests/data/acpi/q35/IVRS.ivrs b/tests/data/acpi/x86/q35/IVRS.ivrs similarity index 100% rename from tests/data/acpi/q35/IVRS.ivrs rename to tests/data/acpi/x86/q35/IVRS.ivrs diff --git a/tests/data/acpi/q35/MCFG b/tests/data/acpi/x86/q35/MCFG similarity index 100% rename from tests/data/acpi/q35/MCFG rename to tests/data/acpi/x86/q35/MCFG diff --git a/tests/data/acpi/q35/NFIT.dimmpxm b/tests/data/acpi/x86/q35/NFIT.dimmpxm similarity index 100% rename from tests/data/acpi/q35/NFIT.dimmpxm rename to tests/data/acpi/x86/q35/NFIT.dimmpxm diff --git a/tests/data/acpi/q35/SLIC.slic b/tests/data/acpi/x86/q35/SLIC.slic similarity index 100% rename from tests/data/acpi/q35/SLIC.slic rename to tests/data/acpi/x86/q35/SLIC.slic diff --git a/tests/data/acpi/q35/SLIT.cphp b/tests/data/acpi/x86/q35/SLIT.cphp similarity index 100% rename from tests/data/acpi/q35/SLIT.cphp rename to tests/data/acpi/x86/q35/SLIT.cphp diff --git a/tests/data/acpi/q35/SLIT.memhp b/tests/data/acpi/x86/q35/SLIT.memhp similarity index 100% rename from tests/data/acpi/q35/SLIT.memhp rename to tests/data/acpi/x86/q35/SLIT.memhp diff --git a/tests/data/acpi/q35/SRAT.acpihmat b/tests/data/acpi/x86/q35/SRAT.acpihmat similarity index 100% rename from tests/data/acpi/q35/SRAT.acpihmat rename to tests/data/acpi/x86/q35/SRAT.acpihmat diff --git a/tests/data/acpi/q35/SRAT.acpihmat-noinitiator b/tests/data/acpi/x86/q35/SRAT.acpihmat-noinitiator similarity index 100% rename from tests/data/acpi/q35/SRAT.acpihmat-noinitiator rename to tests/data/acpi/x86/q35/SRAT.acpihmat-noinitiator diff --git a/tests/data/acpi/q35/SRAT.cphp b/tests/data/acpi/x86/q35/SRAT.cphp similarity index 100% rename from tests/data/acpi/q35/SRAT.cphp rename to tests/data/acpi/x86/q35/SRAT.cphp diff --git a/tests/data/acpi/q35/SRAT.dimmpxm b/tests/data/acpi/x86/q35/SRAT.dimmpxm similarity index 100% rename from tests/data/acpi/q35/SRAT.dimmpxm rename to tests/data/acpi/x86/q35/SRAT.dimmpxm diff --git a/tests/data/acpi/q35/SRAT.memhp b/tests/data/acpi/x86/q35/SRAT.memhp similarity index 100% rename from tests/data/acpi/q35/SRAT.memhp rename to tests/data/acpi/x86/q35/SRAT.memhp diff --git a/tests/data/acpi/q35/SRAT.mmio64 b/tests/data/acpi/x86/q35/SRAT.mmio64 similarity index 100% rename from tests/data/acpi/q35/SRAT.mmio64 rename to tests/data/acpi/x86/q35/SRAT.mmio64 diff --git a/tests/data/acpi/q35/SRAT.numamem b/tests/data/acpi/x86/q35/SRAT.numamem similarity index 100% rename from tests/data/acpi/q35/SRAT.numamem rename to tests/data/acpi/x86/q35/SRAT.numamem diff --git a/tests/data/acpi/q35/SRAT.xapic b/tests/data/acpi/x86/q35/SRAT.xapic similarity index 100% rename from tests/data/acpi/q35/SRAT.xapic rename to tests/data/acpi/x86/q35/SRAT.xapic diff --git a/tests/data/acpi/q35/SSDT.dimmpxm b/tests/data/acpi/x86/q35/SSDT.dimmpxm similarity index 100% rename from tests/data/acpi/q35/SSDT.dimmpxm rename to tests/data/acpi/x86/q35/SSDT.dimmpxm diff --git a/tests/data/acpi/q35/TCPA.tis.tpm12 b/tests/data/acpi/x86/q35/TCPA.tis.tpm12 similarity index 100% rename from tests/data/acpi/q35/TCPA.tis.tpm12 rename to tests/data/acpi/x86/q35/TCPA.tis.tpm12 diff --git a/tests/data/acpi/q35/TPM2.tis.tpm2 b/tests/data/acpi/x86/q35/TPM2.tis.tpm2 similarity index 100% rename from tests/data/acpi/q35/TPM2.tis.tpm2 rename to tests/data/acpi/x86/q35/TPM2.tis.tpm2 diff --git a/tests/data/acpi/q35/VIOT.viot b/tests/data/acpi/x86/q35/VIOT.viot similarity index 100% rename from tests/data/acpi/q35/VIOT.viot rename to tests/data/acpi/x86/q35/VIOT.viot diff --git a/tests/data/acpi/q35/WAET b/tests/data/acpi/x86/q35/WAET similarity index 100% rename from tests/data/acpi/q35/WAET rename to tests/data/acpi/x86/q35/WAET From patchwork Tue Jul 2 14:10:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719792 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 92054C30658 for ; Tue, 2 Jul 2024 14:22:22 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeEC-0005mb-BY; Tue, 02 Jul 2024 10:11: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 1sOeDY-000591-LT for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:01 -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 1sOeDW-0000PP-Ls for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929445; 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=MwYyD/KUkbkxSb1TRAT8zXkqiqU7/n4SuhkILToxS/w=; b=inb+kMW00R0INDllmf6N7KLCff+ba8m3EkYFQoZ+WxyS++4Fvs3nZi0OP0cWhnQsV67NYp LnBFWHxWnhk1xsfCT9jYo+fy8UoePXQeCTI0PrAtKfrbNczHnr+6q9RSL/ZCJ/KO8IuOGc ItTzIucxIuePxHYNgHaVxKe48KzzIAs= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-607-6im5TGkkMvSxz5-XfeEpoA-1; Tue, 02 Jul 2024 10:10:44 -0400 X-MC-Unique: 6im5TGkkMvSxz5-XfeEpoA-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a7246c24b00so303413266b.0 for ; Tue, 02 Jul 2024 07:10:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929443; x=1720534243; 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=MwYyD/KUkbkxSb1TRAT8zXkqiqU7/n4SuhkILToxS/w=; b=M1VOM3WXAMEbi6kpT/CyPskxpWjgQyhMk38oz+C9ol/PjqZ5K+lfCFINZxtrVv0xNe ROmUIzMh4N0s6VFGWIwi3l4lyUZhYu/U6Ri9IW1xcH0/iHAxfxwxtkzSa1nRVxjkyZxy GSTUF1uBEWeaMK0vJSybufSxQhUbvNJ+R1KTabn6nyF0WLDTVqTNhLWos2oK2yS6+GAY pnu2OkgTUMeG6ATzYnNS3e4FTGMEAli98I1Gz7JJTcqDfE0VOq0b5dYlnP1ULB11dUBL Pb2sgH1nuqEWvTYrYGiPOcFF8QjMX4P6q3HvX3bjLUDCM651pdefBhbwU2rIeNdpydNB +yvw== X-Gm-Message-State: AOJu0YwGF7HeELpIxcdWEWvnvyY2jFusjmifDdQ75yRX3ICsiICG4vpA XmLUj4uYD/s1IwZJbF0QOOi+EPehdNoilevc23cJPQYFDdo9lbD+hIMNAvsehZXgYJy6KfJ2Oss WF6+bWHGxGlodZvG9WVhmTSxyL8hWddZlBIzCM15RZu/fVuuTbc3YrlbW/rvnOuYHl9j2ETQVjX qufdLK+qSYkYbgZvONAZGAcS57LUt2jA== X-Received: by 2002:a17:907:a0c9:b0:a6f:bc02:a008 with SMTP id a640c23a62f3a-a7514402354mr697862966b.4.1719929442942; Tue, 02 Jul 2024 07:10:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF1nClnaKFBznZ8WsfWDFFXO+jDuQWsI1e1WL3+Vzz9e7LBO5rK0uzrwQHqe016UjeGBPGU1g== X-Received: by 2002:a17:907:a0c9:b0:a6f:bc02:a008 with SMTP id a640c23a62f3a-a7514402354mr697857166b.4.1719929441901; Tue, 02 Jul 2024 07:10:41 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72aaf60476sm426463566b.55.2024.07.02.07.10.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:10:41 -0700 (PDT) Date: Tue, 2 Jul 2024 10:10:39 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Sunil V L , Igor Mammedov Subject: [PULL 71/91] tests/data/acpi/virt: Move ARM64 ACPI tables under aarch64/${machine} path Message-ID: <8654b3eb9ea725160667be2ff093a0448f3073e3.1719929191.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Sunil V L Same machine name can be used by different architectures. Hence, create aarch64 folder and move all aarch64 related AML files for virt machine inside. Signed-off-by: Sunil V L Reviewed-by: Igor Mammedov Message-Id: <20240625150839.1358279-11-sunilvl@ventanamicro.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/data/acpi/{ => aarch64}/virt/APIC | Bin .../data/acpi/{ => aarch64}/virt/APIC.acpihmatvirt | Bin tests/data/acpi/{ => aarch64}/virt/APIC.topology | Bin tests/data/acpi/{ => aarch64}/virt/DBG2 | Bin tests/data/acpi/{ => aarch64}/virt/DSDT | Bin .../data/acpi/{ => aarch64}/virt/DSDT.acpihmatvirt | Bin tests/data/acpi/{ => aarch64}/virt/DSDT.memhp | Bin tests/data/acpi/{ => aarch64}/virt/DSDT.pxb | Bin tests/data/acpi/{ => aarch64}/virt/DSDT.topology | Bin tests/data/acpi/{ => aarch64}/virt/FACP | Bin tests/data/acpi/{ => aarch64}/virt/GTDT | Bin .../data/acpi/{ => aarch64}/virt/HMAT.acpihmatvirt | Bin tests/data/acpi/{ => aarch64}/virt/IORT | Bin tests/data/acpi/{ => aarch64}/virt/MCFG | Bin tests/data/acpi/{ => aarch64}/virt/NFIT.memhp | Bin tests/data/acpi/{ => aarch64}/virt/PPTT | Bin .../data/acpi/{ => aarch64}/virt/PPTT.acpihmatvirt | Bin tests/data/acpi/{ => aarch64}/virt/PPTT.topology | Bin tests/data/acpi/{ => aarch64}/virt/SLIT.memhp | Bin tests/data/acpi/{ => aarch64}/virt/SPCR | Bin .../data/acpi/{ => aarch64}/virt/SRAT.acpihmatvirt | Bin tests/data/acpi/{ => aarch64}/virt/SRAT.memhp | Bin tests/data/acpi/{ => aarch64}/virt/SRAT.numamem | Bin tests/data/acpi/{ => aarch64}/virt/SSDT.memhp | Bin tests/data/acpi/{ => aarch64}/virt/VIOT | Bin 25 files changed, 0 insertions(+), 0 deletions(-) rename tests/data/acpi/{ => aarch64}/virt/APIC (100%) rename tests/data/acpi/{ => aarch64}/virt/APIC.acpihmatvirt (100%) rename tests/data/acpi/{ => aarch64}/virt/APIC.topology (100%) rename tests/data/acpi/{ => aarch64}/virt/DBG2 (100%) rename tests/data/acpi/{ => aarch64}/virt/DSDT (100%) rename tests/data/acpi/{ => aarch64}/virt/DSDT.acpihmatvirt (100%) rename tests/data/acpi/{ => aarch64}/virt/DSDT.memhp (100%) rename tests/data/acpi/{ => aarch64}/virt/DSDT.pxb (100%) rename tests/data/acpi/{ => aarch64}/virt/DSDT.topology (100%) rename tests/data/acpi/{ => aarch64}/virt/FACP (100%) rename tests/data/acpi/{ => aarch64}/virt/GTDT (100%) rename tests/data/acpi/{ => aarch64}/virt/HMAT.acpihmatvirt (100%) rename tests/data/acpi/{ => aarch64}/virt/IORT (100%) rename tests/data/acpi/{ => aarch64}/virt/MCFG (100%) rename tests/data/acpi/{ => aarch64}/virt/NFIT.memhp (100%) rename tests/data/acpi/{ => aarch64}/virt/PPTT (100%) rename tests/data/acpi/{ => aarch64}/virt/PPTT.acpihmatvirt (100%) rename tests/data/acpi/{ => aarch64}/virt/PPTT.topology (100%) rename tests/data/acpi/{ => aarch64}/virt/SLIT.memhp (100%) rename tests/data/acpi/{ => aarch64}/virt/SPCR (100%) rename tests/data/acpi/{ => aarch64}/virt/SRAT.acpihmatvirt (100%) rename tests/data/acpi/{ => aarch64}/virt/SRAT.memhp (100%) rename tests/data/acpi/{ => aarch64}/virt/SRAT.numamem (100%) rename tests/data/acpi/{ => aarch64}/virt/SSDT.memhp (100%) rename tests/data/acpi/{ => aarch64}/virt/VIOT (100%) diff --git a/tests/data/acpi/virt/APIC b/tests/data/acpi/aarch64/virt/APIC similarity index 100% rename from tests/data/acpi/virt/APIC rename to tests/data/acpi/aarch64/virt/APIC diff --git a/tests/data/acpi/virt/APIC.acpihmatvirt b/tests/data/acpi/aarch64/virt/APIC.acpihmatvirt similarity index 100% rename from tests/data/acpi/virt/APIC.acpihmatvirt rename to tests/data/acpi/aarch64/virt/APIC.acpihmatvirt diff --git a/tests/data/acpi/virt/APIC.topology b/tests/data/acpi/aarch64/virt/APIC.topology similarity index 100% rename from tests/data/acpi/virt/APIC.topology rename to tests/data/acpi/aarch64/virt/APIC.topology diff --git a/tests/data/acpi/virt/DBG2 b/tests/data/acpi/aarch64/virt/DBG2 similarity index 100% rename from tests/data/acpi/virt/DBG2 rename to tests/data/acpi/aarch64/virt/DBG2 diff --git a/tests/data/acpi/virt/DSDT b/tests/data/acpi/aarch64/virt/DSDT similarity index 100% rename from tests/data/acpi/virt/DSDT rename to tests/data/acpi/aarch64/virt/DSDT diff --git a/tests/data/acpi/virt/DSDT.acpihmatvirt b/tests/data/acpi/aarch64/virt/DSDT.acpihmatvirt similarity index 100% rename from tests/data/acpi/virt/DSDT.acpihmatvirt rename to tests/data/acpi/aarch64/virt/DSDT.acpihmatvirt diff --git a/tests/data/acpi/virt/DSDT.memhp b/tests/data/acpi/aarch64/virt/DSDT.memhp similarity index 100% rename from tests/data/acpi/virt/DSDT.memhp rename to tests/data/acpi/aarch64/virt/DSDT.memhp diff --git a/tests/data/acpi/virt/DSDT.pxb b/tests/data/acpi/aarch64/virt/DSDT.pxb similarity index 100% rename from tests/data/acpi/virt/DSDT.pxb rename to tests/data/acpi/aarch64/virt/DSDT.pxb diff --git a/tests/data/acpi/virt/DSDT.topology b/tests/data/acpi/aarch64/virt/DSDT.topology similarity index 100% rename from tests/data/acpi/virt/DSDT.topology rename to tests/data/acpi/aarch64/virt/DSDT.topology diff --git a/tests/data/acpi/virt/FACP b/tests/data/acpi/aarch64/virt/FACP similarity index 100% rename from tests/data/acpi/virt/FACP rename to tests/data/acpi/aarch64/virt/FACP diff --git a/tests/data/acpi/virt/GTDT b/tests/data/acpi/aarch64/virt/GTDT similarity index 100% rename from tests/data/acpi/virt/GTDT rename to tests/data/acpi/aarch64/virt/GTDT diff --git a/tests/data/acpi/virt/HMAT.acpihmatvirt b/tests/data/acpi/aarch64/virt/HMAT.acpihmatvirt similarity index 100% rename from tests/data/acpi/virt/HMAT.acpihmatvirt rename to tests/data/acpi/aarch64/virt/HMAT.acpihmatvirt diff --git a/tests/data/acpi/virt/IORT b/tests/data/acpi/aarch64/virt/IORT similarity index 100% rename from tests/data/acpi/virt/IORT rename to tests/data/acpi/aarch64/virt/IORT diff --git a/tests/data/acpi/virt/MCFG b/tests/data/acpi/aarch64/virt/MCFG similarity index 100% rename from tests/data/acpi/virt/MCFG rename to tests/data/acpi/aarch64/virt/MCFG diff --git a/tests/data/acpi/virt/NFIT.memhp b/tests/data/acpi/aarch64/virt/NFIT.memhp similarity index 100% rename from tests/data/acpi/virt/NFIT.memhp rename to tests/data/acpi/aarch64/virt/NFIT.memhp diff --git a/tests/data/acpi/virt/PPTT b/tests/data/acpi/aarch64/virt/PPTT similarity index 100% rename from tests/data/acpi/virt/PPTT rename to tests/data/acpi/aarch64/virt/PPTT diff --git a/tests/data/acpi/virt/PPTT.acpihmatvirt b/tests/data/acpi/aarch64/virt/PPTT.acpihmatvirt similarity index 100% rename from tests/data/acpi/virt/PPTT.acpihmatvirt rename to tests/data/acpi/aarch64/virt/PPTT.acpihmatvirt diff --git a/tests/data/acpi/virt/PPTT.topology b/tests/data/acpi/aarch64/virt/PPTT.topology similarity index 100% rename from tests/data/acpi/virt/PPTT.topology rename to tests/data/acpi/aarch64/virt/PPTT.topology diff --git a/tests/data/acpi/virt/SLIT.memhp b/tests/data/acpi/aarch64/virt/SLIT.memhp similarity index 100% rename from tests/data/acpi/virt/SLIT.memhp rename to tests/data/acpi/aarch64/virt/SLIT.memhp diff --git a/tests/data/acpi/virt/SPCR b/tests/data/acpi/aarch64/virt/SPCR similarity index 100% rename from tests/data/acpi/virt/SPCR rename to tests/data/acpi/aarch64/virt/SPCR diff --git a/tests/data/acpi/virt/SRAT.acpihmatvirt b/tests/data/acpi/aarch64/virt/SRAT.acpihmatvirt similarity index 100% rename from tests/data/acpi/virt/SRAT.acpihmatvirt rename to tests/data/acpi/aarch64/virt/SRAT.acpihmatvirt diff --git a/tests/data/acpi/virt/SRAT.memhp b/tests/data/acpi/aarch64/virt/SRAT.memhp similarity index 100% rename from tests/data/acpi/virt/SRAT.memhp rename to tests/data/acpi/aarch64/virt/SRAT.memhp diff --git a/tests/data/acpi/virt/SRAT.numamem b/tests/data/acpi/aarch64/virt/SRAT.numamem similarity index 100% rename from tests/data/acpi/virt/SRAT.numamem rename to tests/data/acpi/aarch64/virt/SRAT.numamem diff --git a/tests/data/acpi/virt/SSDT.memhp b/tests/data/acpi/aarch64/virt/SSDT.memhp similarity index 100% rename from tests/data/acpi/virt/SSDT.memhp rename to tests/data/acpi/aarch64/virt/SSDT.memhp diff --git a/tests/data/acpi/virt/VIOT b/tests/data/acpi/aarch64/virt/VIOT similarity index 100% rename from tests/data/acpi/virt/VIOT rename to tests/data/acpi/aarch64/virt/VIOT From patchwork Tue Jul 2 14:10:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719779 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4BAC6C30658 for ; Tue, 2 Jul 2024 14:20:11 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeEQ-0007DZ-FM; Tue, 02 Jul 2024 10:11:43 -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 1sOeDg-00059S-3F for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11: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 1sOeDZ-0000Q0-Tm for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929448; 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=C7ChEDGI2fc0o0DZcqX9FIMiPGbOKd/BvwKVobPrMIk=; b=A/NDyEprXStz6Xj+7KfrvIbjJVDaUd/LEL87MVLwyqzajS43l8HtQQClE4yWyrWWJ/i/O4 ZsxRwzAtGo+Ra/sg6qLBqgl0xzjJbluEUCqbnIka3FE2r+Qq6rm+2DaH22NhqCh6RbIP8U BkbUlI7KDtKHOk/jsesH7osvYkZsrcc= 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-648-gq60ES0vPQmQVI5SgpjDNQ-1; Tue, 02 Jul 2024 10:10:47 -0400 X-MC-Unique: gq60ES0vPQmQVI5SgpjDNQ-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-3678f832c75so103650f8f.3 for ; Tue, 02 Jul 2024 07:10:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929445; x=1720534245; 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=C7ChEDGI2fc0o0DZcqX9FIMiPGbOKd/BvwKVobPrMIk=; b=U389ho6xQeFRG0TIqJOsBvpVQoX8cnlbgy4iHe1ssF5oIxdzo+qhbcf1odq6rjo8FX CCgStK9VRGK8s/zkHBR43DsUE4U7IFg20IH2jtoi/euobmouB+Eg94APJUelWW2JMmGc hzHgQY4cJEjEIFs2fU8ktmYhwVLmNSSSEanmCT8Bugxzn0+peKHPOMDQ3Fh1FXeWxhpK ui6d/uebmTXQZscUnpgMJOWSXchPYTCW0+3aUDYEiCqX6pwp6Ki4Qy//wj2+cxLO2p8P UDF8oafEVlVcnaOI5JM8n0sNGjA/ELohFdxS+MyJrUQYEs1ec/xgaA7DA1pyXHto4Zzx WySw== X-Gm-Message-State: AOJu0YyOjIvmvk5mA8LelVgbP2m8n2STvy7VtG+z0lOYjlmynpkTCj3J IapZKZsk2ue7pzotqiytX75npx2Al0OkVoQyE8RUqq8pdrlIbpG7xUutMAV+iWHiOLVnppmlZDH zWtPoiOhUl/RzaeCEp+tfHmtmYWTjKb9ynZc/qkwUsXhHTnxr8cBW6B6vdhzukDt/ql3QJfm4rO 3Hd3kxa10aGlaUimFAHUvd7KlGTSSJRA== X-Received: by 2002:a5d:4812:0:b0:366:ddb6:a067 with SMTP id ffacd0b85a97d-367756a92efmr7205222f8f.20.1719929445570; Tue, 02 Jul 2024 07:10:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFJgb1h070XrEeVmERupzPswNXBOUduypkqnnBbiTK8B/BYWHqNXMldhoz+w4ManCdadLXgyw== X-Received: by 2002:a5d:4812:0:b0:366:ddb6:a067 with SMTP id ffacd0b85a97d-367756a92efmr7205183f8f.20.1719929445058; Tue, 02 Jul 2024 07:10:45 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0ce6c9sm13498899f8f.22.2024.07.02.07.10.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:10:44 -0700 (PDT) Date: Tue, 2 Jul 2024 10:10:42 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Sunil V L , Alistair Francis , Igor Mammedov , Paolo Bonzini , =?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 72/91] meson.build: Add RISC-V to the edk2-target list Message-ID: <59652fd06ed7775b68c771aee5a15c6b28c952d0.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Sunil V L so that ACPI table test can be supported. Signed-off-by: Sunil V L Reviewed-by: Alistair Francis Reviewed-by: Igor Mammedov Message-Id: <20240625150839.1358279-12-sunilvl@ventanamicro.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index a947b83c3f..088bbbbbda 100644 --- a/meson.build +++ b/meson.build @@ -93,7 +93,7 @@ else iasl = find_program(get_option('iasl'), required: true) endif -edk2_targets = [ 'arm-softmmu', 'aarch64-softmmu', 'i386-softmmu', 'x86_64-softmmu' ] +edk2_targets = [ 'arm-softmmu', 'aarch64-softmmu', 'i386-softmmu', 'x86_64-softmmu', 'riscv64-softmmu' ] unpack_edk2_blobs = false foreach target : edk2_targets if target in target_dirs From patchwork Tue Jul 2 14:10:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719806 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8818EC30658 for ; Tue, 2 Jul 2024 14:26:54 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeEN-0006od-JZ; Tue, 02 Jul 2024 10:11: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 1sOeDh-0005AH-Ea for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:01 -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 1sOeDf-0000QJ-Su for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929451; 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=f1BCTKIu7zTn8KYIwKYaAlAh7ZMPZO9ZVLyIB5EQHjk=; b=MwZMYwjZaODlNH8EanL/fnlTi99Zty8KcT0fK4V4tMeAhwq7PFouVAe+C7RTrIAkcbir4t 5tHhNjMrSwySxGvQCzeu1zWSfx0BgKQjLbOdSg2joAh00sib6QEDQ/JvrwIKotnbuhT6JV JqNFekhPJkj5lDRCB3t2wUdULSeYy2g= 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-453-4zlfdHNkM-2nFnNmVFLG0Q-1; Tue, 02 Jul 2024 10:10:50 -0400 X-MC-Unique: 4zlfdHNkM-2nFnNmVFLG0Q-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4256f895ce8so31796115e9.2 for ; Tue, 02 Jul 2024 07:10:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929449; x=1720534249; 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=f1BCTKIu7zTn8KYIwKYaAlAh7ZMPZO9ZVLyIB5EQHjk=; b=gVgy8xU9CF+M4XJlsqERBMIDm2pCQ3JQZEJE3ufjrnzyl/DH/f9rezPwXcSVs7uxzX Xo6DCwLmTtg9cJvbJbOAM90cYrPpCSZPPyu11ayyAuw0lt17ciWkFAKUHRnU8/xKupyk bOreXtnObe7hpYtH9AzGYZckIfhbHcDEdL4EF7vKcYUhHA8iUH/WN4a3uOkBYOVoDyCV 1Gcktzh9ViMiDdpJKbGpZeKzcsUmV16hXu2kTJVrz+9GJj9+C+wnK3EbDR3gUVmKnD6o hEapq79nU54VDEo58qUg0oGg2rYwKMscqylh4kU8lJHVs9VfP48p4bw0nmro2DLaPtl2 G8yA== X-Gm-Message-State: AOJu0YxU7hEcitLZOJvbUlV3P3S/Jaq9TBF45FVxdc5XJ8mSDfVjZ0o+ HaadA/dZdPQcw/WVTh5dA8d5wTbhvXgHV7myULdM6kID+EdkIhxSGaHiefoOQw0pMvq6lkBXNtK LgUJQV22QbiH/8Uvqv4XV71uEVgeLA8tsbELxRsRKP/Epz74TLRibo9Sd8oH9rcxK1+tcNmhftE euO5+PD1O2DEb2+IQZVMnsz8Kb4qm17Q== X-Received: by 2002:a05:600c:1616:b0:425:6bea:8554 with SMTP id 5b1f17b1804b1-4257a05fa13mr59618135e9.27.1719929448949; Tue, 02 Jul 2024 07:10:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGA/TyojuA+gJdMqFu0OqF53+4p8fcjQ6s1IicICG42SwFCXQCq5jYynweYltGZXY+CzcE2/g== X-Received: by 2002:a05:600c:1616:b0:425:6bea:8554 with SMTP id 5b1f17b1804b1-4257a05fa13mr59617915e9.27.1719929448470; Tue, 02 Jul 2024 07:10:48 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b09a94csm199702835e9.33.2024.07.02.07.10.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:10:48 -0700 (PDT) Date: Tue, 2 Jul 2024 10:10:45 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Sunil V L , Alistair Francis , Igor Mammedov , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PULL 73/91] pc-bios/meson.build: Add support for RISC-V in unpack_edk2_blobs Message-ID: <5d3f12a7d423ed09aff5843ee7e955bd0d0d8d9f.1719929191.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Sunil V L Update list of images supported in unpack_edk2_blobs to enable RISC-V ACPI table testing. Signed-off-by: Sunil V L Reviewed-by: Alistair Francis Reviewed-by: Igor Mammedov Message-Id: <20240625150839.1358279-13-sunilvl@ventanamicro.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- pc-bios/meson.build | 2 ++ tests/qtest/meson.build | 3 +++ 2 files changed, 5 insertions(+) diff --git a/pc-bios/meson.build b/pc-bios/meson.build index 0760612bea..8602b45b9b 100644 --- a/pc-bios/meson.build +++ b/pc-bios/meson.build @@ -4,6 +4,8 @@ if unpack_edk2_blobs 'edk2-aarch64-code.fd', 'edk2-arm-code.fd', 'edk2-arm-vars.fd', + 'edk2-riscv-code.fd', + 'edk2-riscv-vars.fd', 'edk2-i386-code.fd', 'edk2-i386-secure-code.fd', 'edk2-i386-vars.fd', diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 12792948ff..6508bfb1a2 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -259,6 +259,9 @@ qtests_s390x = \ qtests_riscv32 = \ (config_all_devices.has_key('CONFIG_SIFIVE_E_AON') ? ['sifive-e-aon-watchdog-test'] : []) +qtests_riscv64 = \ + (unpack_edk2_blobs ? ['bios-tables-test'] : []) + qos_test_ss = ss.source_set() qos_test_ss.add( 'ac97-test.c', From patchwork Tue Jul 2 14:10:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719757 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00E2DC30658 for ; Tue, 2 Jul 2024 14:14:47 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeEG-00069u-G8; Tue, 02 Jul 2024 10:11: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 1sOeDj-0005Cj-IN for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:02 -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 1sOeDi-0000R2-27 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:10:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929457; 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=Dp+XdzPzdo45On8QxmeO3KbH8ukLhYQRI6dbRMmEeEA=; b=ax+NCpcAegEY4L8uGtvloZ7awSCjBqp7vV76PyFa5Kr9Q4PFZKApNf8UzmzXsCdYItWxeJ +jzRH0NBhWzsCewn44m+Gqga58iCsjYFFPbjRYX9fcmOPcuI11p+3OXhOiTKOuBUsfu+/Y rkWRqNH0iBxW+itCTc0BOKHoin0FXJE= 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-119-A3gurigOMOCR_zlV-SvH0Q-1; Tue, 02 Jul 2024 10:10:53 -0400 X-MC-Unique: A3gurigOMOCR_zlV-SvH0Q-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-3648793ae51so2853032f8f.2 for ; Tue, 02 Jul 2024 07:10:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929452; x=1720534252; 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=Dp+XdzPzdo45On8QxmeO3KbH8ukLhYQRI6dbRMmEeEA=; b=biAXx8sq+Mre1S26zcCYYInsDVDRdvkk//maRWFFwPhrAWN3k0jzKxQnmAWrugaKBB gZ64HsCVn1hBcdIyPFXsRQqW+qC4GbwUArMRwgoQ/1wi4R8OXoVhrlLxqb6rZ2/Tg59c N2Yd6W0FmiMp4s0oB2/WcpKr9x0JNdpyRnRgXGHxaSFTLcZrnQxu53BIgXdKNLk9Bi0A 6Wbw1K9oRjpAhx+DD4ipN4XfPUcrMGA1mviJ1zCjrOftq1izuA7Nd1RrsLZCqnGBc81h RdHb3YKEauJzSGM9B0LlbOpK6YuKM8uZQR/DOPaqmLhjx8gJFTfgz0XrpRf/4WFduIC3 OpyA== X-Gm-Message-State: AOJu0YyErLnpTDRHxKzRa+tDx+8ESS4IhjaBICHnZrCui/NXcCTzd4Uy j5F9wVgu7EKyFYmJuuGvRL71nnKIn5hzU6pHtfNC8lec/mBJhy1D3skS9bjdZ/eDoLhTZWSqq5e Y+FuYr0YnOYVxAJc539U45sR678xEgnfymN7vsT9Ycejqid7M+sTPtakZgKlZLq66x/mgNz1/sb sUlgH3n0NVdbgyfNSUVTa/A242f/hO6Q== X-Received: by 2002:a5d:4487:0:b0:35f:218a:ea60 with SMTP id ffacd0b85a97d-367756ad6eamr4985710f8f.19.1719929451809; Tue, 02 Jul 2024 07:10:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHaVfIPMlxCcD/zXEDodQ4i+Q9OAWvlTaxtZYKGS3ps4dtVcEtJidlaC689nHpgdInozezujA== X-Received: by 2002:a5d:4487:0:b0:35f:218a:ea60 with SMTP id ffacd0b85a97d-367756ad6eamr4985690f8f.19.1719929451306; Tue, 02 Jul 2024 07:10:51 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0d8cb4sm13332736f8f.25.2024.07.02.07.10.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:10:50 -0700 (PDT) Date: Tue, 2 Jul 2024 10:10:48 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Sunil V L , Alistair Francis , Igor Mammedov , Ani Sinha Subject: [PULL 74/91] tests/data/acpi/rebuild-expected-aml.sh: Add RISC-V 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Sunil V L Update the list of supported architectures to include RISC-V. Signed-off-by: Sunil V L Reviewed-by: Alistair Francis Reviewed-by: Igor Mammedov Message-Id: <20240625150839.1358279-14-sunilvl@ventanamicro.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/data/acpi/rebuild-expected-aml.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/data/acpi/rebuild-expected-aml.sh b/tests/data/acpi/rebuild-expected-aml.sh index dcf2e2f221..c1092fb8ba 100755 --- a/tests/data/acpi/rebuild-expected-aml.sh +++ b/tests/data/acpi/rebuild-expected-aml.sh @@ -12,7 +12,7 @@ # This work is licensed under the terms of the GNU GPLv2. # See the COPYING.LIB file in the top-level directory. -qemu_arches="x86_64 aarch64" +qemu_arches="x86_64 aarch64 riscv64" if [ ! -e "tests/qtest/bios-tables-test" ]; then echo "Test: bios-tables-test is required! Run make check before this script." @@ -36,7 +36,8 @@ fi if [ -z "$qemu_bins" ]; then echo "Only the following architectures are currently supported: $qemu_arches" echo "None of these configured!" - echo "To fix, run configure --target-list=x86_64-softmmu,aarch64-softmmu" + echo "To fix, run configure \ + --target-list=x86_64-softmmu,aarch64-softmmu,riscv64-softmmu" exit 1; fi From patchwork Tue Jul 2 14:10:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719754 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 020C0C3064D for ; Tue, 2 Jul 2024 14:14:37 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeEG-00069N-9M; Tue, 02 Jul 2024 10:11: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 1sOeDy-0005LZ-0H for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:16 -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 1sOeDl-0000Ra-BQ for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929460; 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=k5HbSZj+J5fFVUz4QWaOQfMriUE05NQ5H5UstCGrrUE=; b=bw2CB6E/Yp5A9NTwKjc3EPgqvtEpU/zDkOxBAO2hICSdPhGZ86AdnGIeiM3ZMHavrltaC0 bRpSSsw3R/phgnlc3cYbYdb+VUxnLGeT3VAqT+VkEy7b0g75JwEH+8S/C1A98aGgKnhOf0 LpWVIMrBgPRDi1l//9JRno2jDJCEJIs= 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-275-pdZJDBJUMqCNhVbtcz1NAw-1; Tue, 02 Jul 2024 10:10:58 -0400 X-MC-Unique: pdZJDBJUMqCNhVbtcz1NAw-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-3634a634f8aso2403472f8f.2 for ; Tue, 02 Jul 2024 07:10:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929454; x=1720534254; 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=k5HbSZj+J5fFVUz4QWaOQfMriUE05NQ5H5UstCGrrUE=; b=Yb7i72almIseAc138AN5cQxvKvb/I5pwFwPXzOVUMK27SN7UMxZv/m/babbKiJyhMt CS0fM0f1rvbt3SYt5SU1BOuBIuifflxt3C1NaZ5ljEoTuQKIqjO/f1tsZ6RL2BMOEaij JI0UjVP3Hssl73cxQVoZ+UPMZ7cVoU4i4+OmN8uhYO8Y5eetd8DP0nJGZ2UZuRcN/GUT pYRK72bXui/GUwRMD+OzFwAoIxBpVzMHr615NNYumO/M3Ly6xPkNXz/hCrPVN0VMxqqN WqoxPVK/O+5ktoAoIaGcTs1+DWq7O1OqrDTI+QjIkSCkc8JnAKYkGoKUvzAall3MKNor lE/g== X-Gm-Message-State: AOJu0YxPe4MG+/d3j32ZJMygkczAA//JtIBBJvFdzHNtbId+vJDBesdj VXoanLZGFaSBqH+7Vq8QOrSNcPClNzX6qKu+ZxdX/eZREZN7C6UTu7RRz0+QrBhJBfxw9D3vQXP Gsrh96HH+YdY0CUhiaevQVcAZG8n5clyfVXbZJg4Pmk+Hal1VivqpzfPCdQkixOpBBZZmq/wqED LQkXVEz//NKxSm9gZvpzV5qMtMym7Pkg== X-Received: by 2002:a5d:4fd1:0:b0:367:4354:52c4 with SMTP id ffacd0b85a97d-367756ae62emr5451634f8f.24.1719929454486; Tue, 02 Jul 2024 07:10:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHz8DhNyvdv6aBbt3QB8jItMlDHzyhEzu91IR/kZdL9LE/Iw/oHNnq08VseejoNe/DOSJpHkA== X-Received: by 2002:a5d:4fd1:0:b0:367:4354:52c4 with SMTP id ffacd0b85a97d-367756ae62emr5451616f8f.24.1719929453961; Tue, 02 Jul 2024 07:10:53 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0cd5f1sm13440198f8f.6.2024.07.02.07.10.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:10:53 -0700 (PDT) Date: Tue, 2 Jul 2024 10:10:51 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Sunil V L , Alistair Francis , Igor Mammedov , Ani Sinha Subject: [PULL 75/91] tests/qtest/bios-tables-test: Add empty ACPI data files for RISC-V Message-ID: <208760683664dd2a81f8c120e607a2fb5dba3d10.1719929191.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Sunil V L As per process documented (steps 1-3) in bios-tables-test.c, add empty AML data files for RISC-V ACPI tables and add the entries in bios-tables-test-allowed-diff.h. Signed-off-by: Sunil V L Acked-by: Alistair Francis Reviewed-by: Igor Mammedov Message-Id: <20240625150839.1358279-15-sunilvl@ventanamicro.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 6 ++++++ tests/data/acpi/riscv64/virt/APIC | 0 tests/data/acpi/riscv64/virt/DSDT | 0 tests/data/acpi/riscv64/virt/FACP | 0 tests/data/acpi/riscv64/virt/MCFG | 0 tests/data/acpi/riscv64/virt/RHCT | 0 tests/data/acpi/riscv64/virt/SPCR | 0 7 files changed, 6 insertions(+) create mode 100644 tests/data/acpi/riscv64/virt/APIC create mode 100644 tests/data/acpi/riscv64/virt/DSDT create mode 100644 tests/data/acpi/riscv64/virt/FACP create mode 100644 tests/data/acpi/riscv64/virt/MCFG create mode 100644 tests/data/acpi/riscv64/virt/RHCT create mode 100644 tests/data/acpi/riscv64/virt/SPCR diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..70474a097f 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,7 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/riscv64/virt/APIC", +"tests/data/acpi/riscv64/virt/DSDT", +"tests/data/acpi/riscv64/virt/FACP", +"tests/data/acpi/riscv64/virt/MCFG", +"tests/data/acpi/riscv64/virt/RHCT", +"tests/data/acpi/riscv64/virt/SPCR", diff --git a/tests/data/acpi/riscv64/virt/APIC b/tests/data/acpi/riscv64/virt/APIC new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/riscv64/virt/DSDT b/tests/data/acpi/riscv64/virt/DSDT new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/riscv64/virt/FACP b/tests/data/acpi/riscv64/virt/FACP new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/riscv64/virt/MCFG b/tests/data/acpi/riscv64/virt/MCFG new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/riscv64/virt/RHCT b/tests/data/acpi/riscv64/virt/RHCT new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/riscv64/virt/SPCR b/tests/data/acpi/riscv64/virt/SPCR new file mode 100644 index 0000000000..e69de29bb2 From patchwork Tue Jul 2 14:10:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719782 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CE103C3064D for ; Tue, 2 Jul 2024 14:21:07 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeEP-000784-CV; Tue, 02 Jul 2024 10:11: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 1sOeDr-0005Hm-4I for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11: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 1sOeDm-0000Re-Qh for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929461; 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=XYcGnVhFPwoZSWuivRppJKLTtobAaVwu1fbEznMs2YQ=; b=ivtKHSO7l4ijpDNTdAr5zA/fvOs17XesD7bjfqVIwkho3obtIcSRovLAXKRhYPrtBDuQoZ KiuiXOPKcul/h/iE5Zb5htWqEJymtNtaISxqw++sh22lQvz8MMtOhimCuPiDqnhKjdoF+O BjS0+XyT6hNVUkWW3LygRMIYzoWHpIA= 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-465-hQ8XnS69PUOeC1wYy9PGUg-1; Tue, 02 Jul 2024 10:10:58 -0400 X-MC-Unique: hQ8XnS69PUOeC1wYy9PGUg-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-42567dbbd20so31687345e9.0 for ; Tue, 02 Jul 2024 07:10:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929457; x=1720534257; 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=XYcGnVhFPwoZSWuivRppJKLTtobAaVwu1fbEznMs2YQ=; b=F3yfuIvvfV5gXoO55mqXGp2diPeha9Ola8SnXkWyQQVL7htkQy5NMO24RZPZ/Azi0F fOIm3LaCqcNXG/ysCsCOJh08J4lCqXEr5KfC/IKvEAz8o1I1IF9Dk8NtrVjeNzsBbp+O pbBZ0OVMJLWsD96l7By9B+ZPde9vdBdHfvdIjeiU3libD07U8K/dO9PiF5/raLZwlUV9 2u9gzCy+i+qx4ju+j192rsHyuOAKDfsFZzywxka3clcmD4TxPUWjAVeoFnHYGzFb+ynj A6TRd3fPNOnUIDjo+8UuueplZP5EF02i3bssQFjbmUiYpDW1zK17DiRGuYKuZTKPylJP 4Ihw== X-Gm-Message-State: AOJu0YxfJkJYSRUd/P/OaGw/ue4+yrN76UCa/S8D71ZIYEixcgqZr/0p vsy/+oasQ/BdsThMVwGLdYZCUbBFvdGYhA8M5AeZlIHSkzgs+paVM4Qxys5kyHlnlZNp3WKE3rF l9qdsMfhxTWg0TRSufUQu7bhDBwg0AU6qnmOg/LTvb0x7dqW3BNXqm735iSFqyqzTpcKBCyHuUU c/qCzIKrhgE4IuRYVUh9iJo2Fzo3FD9w== X-Received: by 2002:a05:600c:4aa9:b0:425:656b:76ae with SMTP id 5b1f17b1804b1-4257a00ce69mr58232815e9.23.1719929457206; Tue, 02 Jul 2024 07:10:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFqlsKd2f4fzcx/rAiCo2L0yUzu3ELum731IQMLwJfYQe/Isnab1sTKoMTn1v/QPAvDlgMBww== X-Received: by 2002:a05:600c:4aa9:b0:425:656b:76ae with SMTP id 5b1f17b1804b1-4257a00ce69mr58232565e9.23.1719929456693; Tue, 02 Jul 2024 07:10:56 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0d9385sm13272258f8f.39.2024.07.02.07.10.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:10:56 -0700 (PDT) Date: Tue, 2 Jul 2024 10:10:54 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Sunil V L , Alistair Francis , Igor Mammedov , Ani Sinha Subject: [PULL 76/91] tests/qtest/bios-tables-test.c: Enable basic testing for RISC-V Message-ID: <45fa5b80a3bc3df238414aa738a7bd352bb6665f.1719929191.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Sunil V L Add basic ACPI table test case for RISC-V. Signed-off-by: Sunil V L Reviewed-by: Alistair Francis Reviewed-by: Igor Mammedov Message-Id: <20240625150839.1358279-16-sunilvl@ventanamicro.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index f4c4704bab..0f9c654e96 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -1977,6 +1977,28 @@ static void test_acpi_microvm_acpi_erst(void) } #endif /* CONFIG_POSIX */ +static void test_acpi_riscv64_virt_tcg(void) +{ + test_data data = { + .machine = "virt", + .arch = "riscv64", + .tcg_only = true, + .uefi_fl1 = "pc-bios/edk2-riscv-code.fd", + .uefi_fl2 = "pc-bios/edk2-riscv-vars.fd", + .cd = "tests/data/uefi-boot-images/bios-tables-test.riscv64.iso.qcow2", + .ram_start = 0x80000000ULL, + .scan_len = 128ULL * 1024 * 1024, + }; + + /* + * RHCT will have ISA string encoded. To reduce the effort + * of updating expected AML file for any new default ISA extension, + * use the profile rva22s64. + */ + test_acpi_one("-cpu rva22s64 ", &data); + free_test_data(&data); +} + static void test_acpi_aarch64_virt_tcg(void) { test_data data = { @@ -2455,6 +2477,10 @@ int main(int argc, char *argv[]) qtest_add_func("acpi/virt/viot", test_acpi_aarch64_virt_viot); } } + } else if (strcmp(arch, "riscv64") == 0) { + if (has_tcg && qtest_has_device("virtio-blk-pci")) { + qtest_add_func("acpi/virt", test_acpi_riscv64_virt_tcg); + } } ret = g_test_run(); boot_sector_cleanup(disk); From patchwork Tue Jul 2 14:10:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719747 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E0CB6C3065C for ; Tue, 2 Jul 2024 14:13:13 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeEJ-0006OE-Ce; Tue, 02 Jul 2024 10:11: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 1sOeE5-0005Ra-Ol for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11: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 1sOeDp-0000Rl-Sw for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929463; 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=0xyAuW055SU97MgsZtqzgKijVpNO++k4HuluYJlbn+s=; b=GHQGKpSw0wmhP6WEyuhf5Bs7LZzJ+vmIUzSxGFqTlGg9EiiL5xx+zRXP2Imh2QgUXnHbUI s5hK4K5vCzv/3zYvpI7nr+ZZqQJRHg3ipB3Y53LmCr65XkXNB5ntAdDGchWAhkPWFfL5F0 a3eLIIrqauvyRdf5QEeRntsVA6Az4R4= 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-247-phX1d6ZbMjujvU-Du6Fjjw-1; Tue, 02 Jul 2024 10:11:01 -0400 X-MC-Unique: phX1d6ZbMjujvU-Du6Fjjw-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4210d151c5bso29352615e9.3 for ; Tue, 02 Jul 2024 07:11:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929460; x=1720534260; 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=0xyAuW055SU97MgsZtqzgKijVpNO++k4HuluYJlbn+s=; b=bZVmouM81vgtwDQQnvwOqihN1MT3O6wxvzYuKh7nG7DXz7aE76kBye5FkI3BJ23zBR iRXxFyUuFjWpbNRAF7z83Rd4DMBP2NZcXCa8Y+e728UPih4OvzbMPAK1J+0OfpGPLs21 GOk8Kv9w2ewC9EsaCEqdxDA3cee+c6rpATUfdMzHTR5wEQRiFVUUhhzFgzZFy65I1B9s 8QDtAtwqYXo7VtOvu+SNsXjQV0bH1vACLazt6aD/mpjtbvUSRVfbWvcpJZ1e0mgylk1s 3ZW4GERPz0XugiRxZms3qZsvbJOMBwDW8Nyx1oscWfMl8oopNgV3ckomLNjYF1lIA3wa +qOQ== X-Gm-Message-State: AOJu0YwAtLLiB6/OEhNux4BDiYH4ippmBPwbo4oiQTN+rPKJefV+aO01 tUtNpt9/QH3WguTiUQAEwAH+wKm45pWbaDt7geB1JjP+c8/aOab2qJatoDQANwaOaF2lwc6NLvr 3MUTGVKq2AjmT0DrsWW+iR6R3tLsXWJ4EbW3e8rQxSOcpRovXxFUXqrL3g97CHFzJZ8X9yGGDeX lxzdhET6bcfe7AQwU7CMJJlvi3jwS+0g== X-Received: by 2002:a05:600c:5486:b0:425:672a:7688 with SMTP id 5b1f17b1804b1-4257a02b722mr60396605e9.31.1719929460285; Tue, 02 Jul 2024 07:11:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGB4Hx420q2AMejLtsc1rfQ0V0LnpzgBIxjP8QLTBlTubxh+yxZcos7opNP6u6wCRpnaDkxqQ== X-Received: by 2002:a05:600c:5486:b0:425:672a:7688 with SMTP id 5b1f17b1804b1-4257a02b722mr60396355e9.31.1719929459789; Tue, 02 Jul 2024 07:10:59 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0e169dsm13256393f8f.65.2024.07.02.07.10.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:10:59 -0700 (PDT) Date: Tue, 2 Jul 2024 10:10:56 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Sunil V L , Alistair Francis , Igor Mammedov , Ani Sinha Subject: [PULL 77/91] tests/qtest/bios-tables-test: Add expected ACPI data files for RISC-V Message-ID: <5d7dfa170ec9731cf2808102c0f65517a8fd2b80.1719929191.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: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Sunil V L As per the step 5 in the process documented in bios-tables-test.c, generate the expected ACPI AML data files for RISC-V using the rebuild-expected-aml.sh script and update the bios-tables-test-allowed-diff.h. These are all new files being added for the first time. Hence, iASL diff output is not added. Signed-off-by: Sunil V L Acked-by: Alistair Francis Acked-by: Igor Mammedov Message-Id: <20240625150839.1358279-17-sunilvl@ventanamicro.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 6 ------ tests/data/acpi/riscv64/virt/APIC | Bin 0 -> 116 bytes tests/data/acpi/riscv64/virt/DSDT | Bin 0 -> 3518 bytes tests/data/acpi/riscv64/virt/FACP | Bin 0 -> 276 bytes tests/data/acpi/riscv64/virt/MCFG | Bin 0 -> 60 bytes tests/data/acpi/riscv64/virt/RHCT | Bin 0 -> 314 bytes tests/data/acpi/riscv64/virt/SPCR | Bin 0 -> 80 bytes 7 files changed, 6 deletions(-) diff --git a/tests/data/acpi/riscv64/virt/APIC b/tests/data/acpi/riscv64/virt/APIC index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..66a25dfd2d6ea2b607c024722b2eab95873a01e9 100644 GIT binary patch literal 116 zcmZ<^@N_O=U|?X|;^gn_5v<@85#X$#prF9Wz`y`vgJ>9#P+??1=7Rt_Us?qr5)aeJ KkN{%wz_g5w7zgmjiIX_aOKm4@(l%|fuo4Hf(j=j@7eo`gFRq%_8>bX0AR|>>u>>sz z7Ni9sRynXxaoMfJg-a2Y_znmG5+`olcsq093+&NoJa*Q9)~@8n(|P_gKi86^?16meQa)vpqpERBgR;V6we*?)PmxfW=~Q)bLi^2TK+80 z%QdY|ME7Vs?dQzHLAVF!z+r2wJ=+2=SyF4Fgfw3GMV2H<4Qdt7axJ5i(krS~{low3 z`#WC_&L95p^-p`>O2)Ee)KjICx8FIL+_?4L>AN4C-Z{BPMcUk;@w6wuGK}2&2g5_g z*xHjtXSBUVn!}0<9;kd2{ZP- zb4)w-ME2MQDV}Lt!SmT;UH)Wm?U3U2`vK8D*Y1*0l8e4C5wB^_ zu6R|4jI#J!P}hBO$tzhnHx*QNW>>s2nwk=oEUZjXP#LX~4l1J^q=U+6YFbpb!^*U% zj8>6@%4i32P#H~?MP;;kSyV==WWbpLX9k@aQ5mh01!oqVS#)O6nFD7IoH=yn(5Zk^ z0jGja1)X_t=E0dqXC9p@I8|_}=v2{J0A~T51#}kBSp;VhoJDjN(OCj#37jQ#me5%S zXBnJjbe7RM2hKTg&Y^P-ofn za}k|O;9LUd5;~XAxeU%_a4w^B8J!JqHo)0HX9Jxp;9LRc3OZNNxeCrzaIT_r6`f6R zHo@6MXESn+r?$*rYT`A|n?{pu&tAmN(ACRoA!rm^!7E+#o;X&`dhXDb!lQjs^D!QltfDNQ8N`SY=w;NU%_@B92U z3Ww-575B(-NHIsleX4Hfy+hZO&nIMB$L-7A+{K%`lOGTM?mlidHorQ)+xz*Y-*25y zRN1tSJLeNsF|Fh78Nc8;{6m*Veaug4lb$ hw_JD<`4=Dl#igsVr|u8qH^uk;m*M8{uQtJd@jo@e>K_0A literal 0 HcmV?d00001 diff --git a/tests/data/acpi/riscv64/virt/FACP b/tests/data/acpi/riscv64/virt/FACP index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..a5276b65ea8ce46cc9b40d96d98f0669c9089ed4 100644 GIT binary patch literal 276 zcmZ>BbPf<$*+=sJU9_>-(p91>m8jKM4FH=ApMv&XcBM_0X$| z+T59Nrc|_an{2_(jg{M%j%@1fQ><{^v+>$kDt56x1$k^AOK?==&_|{+FV1=@T2j#y z6(y-CMMW`{k3`H`hZL*Z(I*p)|0L#=cUEsPV SoKANTxNMzk^IHMj3*aAn-C+R$ literal 0 HcmV?d00001 diff --git a/tests/data/acpi/riscv64/virt/SPCR b/tests/data/acpi/riscv64/virt/SPCR index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..4da9daf65f71a13ac2b488d4e9728f194b569a43 100644 GIT binary patch literal 80 zcmWFza1IJ!U|?X{>E!S15v<@85#X$#prF9Wz`y`vgJ>{NU;r@%Kx_d9E(Qh$c8~z` M|NsC0LsftQ0Q@}*0RR91 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 70474a097f..dfb8523c8b 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1,7 +1 @@ /* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/riscv64/virt/APIC", -"tests/data/acpi/riscv64/virt/DSDT", -"tests/data/acpi/riscv64/virt/FACP", -"tests/data/acpi/riscv64/virt/MCFG", -"tests/data/acpi/riscv64/virt/RHCT", -"tests/data/acpi/riscv64/virt/SPCR", From patchwork Tue Jul 2 14:11:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719771 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 28081C30658 for ; Tue, 2 Jul 2024 14:18:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeEQ-0007Hq-Nx; Tue, 02 Jul 2024 10:11:42 -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 1sOeE1-0005Qm-37 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:22 -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 1sOeDs-0000S0-Kx for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929467; 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=Q9nP82XxVIGsGRwJDQ3jJpLzlD/V4rH3MYQjc7zH+sg=; b=e7FPsY7ZNQwy+prP0z9Nzn0rsjJwBt+OeSUMgA7d6IJvG8g+pvbHUX/h+z5OaXQl9Ib6IM ZcGLxAwafAZ34h688bbjZvZptAW7G5OywSaXSblb1CKhAJ0WIx+Ikdglb8vUBvdubO7QVW iyROLwQBe8tO3XmRBhVTBmPRqB6wuEA= 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-668-ehECJNVAMnuQzGpcMhs5Qg-1; Tue, 02 Jul 2024 10:11:05 -0400 X-MC-Unique: ehECJNVAMnuQzGpcMhs5Qg-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4256b7702a5so23908465e9.1 for ; Tue, 02 Jul 2024 07:11:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929464; x=1720534264; 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=Q9nP82XxVIGsGRwJDQ3jJpLzlD/V4rH3MYQjc7zH+sg=; b=X667Wt9PuvBNiBL2l/hawMrFiRQj540TWdXJQd5iIrVLFXSVziBmBzALu+HniVZGxP pE6O8IKWZ07xAmVl1VQl51x6GHMwcgjvK5aYptK2aPIju0iEfQIU4GhZc1lgs1AdenLS IsckMeO/gs5DV6bS2zC7/mJiPPKJIQZztBoQrF6uTeZsQT5D2KsnPPfTtTWn+Pi6oIIn 1p6FFmvlCyLPGuoHXgflfw590GElWHnCxYDyuhNAYQXcn8rM3AUDA7T2op9rZRBeKOig lHDKXzE1JJaTev7kBlUZh4Ooy0zZudHg3IZn9WtAnJDVye7aET8HrigyAstvQ9OCeaZY tRGA== X-Gm-Message-State: AOJu0YyRRi59iKS3RkWEUItIE4R2zt4jTwQeynyAURjf5bBAUW+0VzOY n12rKPrDYPwpQBH6hpb60HEcoJLfWAnyh5dFlcz7lKQmj4OkIAUkWq6UG9iNLirEqO7/Bsvevv5 MYbIB5wVOKkGW6qGvjhnIf0TeQFDy6TgUTI1bCjbIyum6Jh94195PYChiGYMUsr0DeSUhl/W/7i G8zvwPzjCJQXgokKI9zZrYGdg1bRrtmg== X-Received: by 2002:a05:600c:3b9b:b0:424:86aa:b7e7 with SMTP id 5b1f17b1804b1-4256d4fb27emr108852055e9.9.1719929463616; Tue, 02 Jul 2024 07:11:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE3mUuXs25FLZXtC0x3kBezPssEJk1PM8tj1V917BjzOa0/97lm2kEqKUi1ie/T6of6fSpZvg== X-Received: by 2002:a05:600c:3b9b:b0:424:86aa:b7e7 with SMTP id 5b1f17b1804b1-4256d4fb27emr108851735e9.9.1719929463011; Tue, 02 Jul 2024 07:11:03 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af5ba67sm199529405e9.19.2024.07.02.07.11.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:11:02 -0700 (PDT) Date: Tue, 2 Jul 2024 10:11:00 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Markus Armbruster , Fan Ni , Eric Blake Subject: [PULL 78/91] hw/cxl/events: Improve QMP interfaces and documentation for add/release dynamic capacity. 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Jonathan Cameron New DCD command definitions updated in response to review comments from Markus. - Used CxlXXXX instead of CXLXXXXX for newly added types. - Expanded some abreviations in type names to be easier to read. - Additional documentation for some fields. - Replace slightly vague cxl r3.1 references with "Compute Express Link (CXL) Specification, Revision 3.1, XXXX" to bring them inline with what it says on the specification cover. Suggested-by: Markus Armbruster Signed-off-by: Jonathan Cameron Message-Id: <20240625170805.359278-2-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- qapi/cxl.json | 144 ++++++++++++++++++++++++--------------- hw/mem/cxl_type3.c | 18 ++--- hw/mem/cxl_type3_stubs.c | 8 +-- 3 files changed, 103 insertions(+), 67 deletions(-) diff --git a/qapi/cxl.json b/qapi/cxl.json index 57d9f82014..a38622a0d1 100644 --- a/qapi/cxl.json +++ b/qapi/cxl.json @@ -363,9 +363,11 @@ 'data': {'path': 'str', 'type': 'CxlCorErrorType'}} ## -# @CXLDynamicCapacityExtent: +# @CxlDynamicCapacityExtent: # -# A single dynamic capacity extent +# A single dynamic capacity extent. This is a contiguous allocation +# of memory by Device Physical Address within a single Dynamic +# Capacity Region on a CXL Type 3 Device. # # @offset: The offset (in bytes) to the start of the region # where the extent belongs to. @@ -374,7 +376,7 @@ # # Since: 9.1 ## -{ 'struct': 'CXLDynamicCapacityExtent', +{ 'struct': 'CxlDynamicCapacityExtent', 'data': { 'offset':'uint64', 'len': 'uint64' @@ -382,22 +384,40 @@ } ## -# @CXLExtSelPolicy: +# @CxlExtentSelectionPolicy: # # The policy to use for selecting which extents comprise the added -# capacity, as defined in cxl spec r3.1 Table 7-70. +# capacity, as defined in Compute Express Link (CXL) Specification, +# Revision 3.1, Table 7-70. # -# @free: 0h = Free +# @free: Device is responsible for allocating the requested memory +# capacity and is free to do this using any combination of +# supported extents. # -# @contiguous: 1h = Continuous +# @contiguous: Device is responsible for allocating the requested +# memory capacity but must do so as a single contiguous +# extent. # -# @prescriptive: 2h = Prescriptive +# @prescriptive: The precise set of extents to be allocated is +# specified by the command. Thus allocation is being managed +# by the issuer of the allocation command, not the device. # -# @enable-shared-access: 3h = Enable Shared Access +# @enable-shared-access: Capacity has already been allocated to a +# different host using free, contiguous or prescriptive policy +# with a known tag. This policy then instructs the device to +# make the capacity with the specified tag available to an +# additional host. Capacity is implicit as it matches that +# already associated with the tag. Note that the extent list +# (and hence Device Physical Addresses) used are per host, so +# a device may use different representations on each host. +# The ordering of the extents provided to each host is indicated +# to the host using per extent sequence numbers generated by +# the device. Has a similar meaning for temporal sharing, but +# in that case there may be only one host involved. # # Since: 9.1 ## -{ 'enum': 'CXLExtSelPolicy', +{ 'enum': 'CxlExtentSelectionPolicy', 'data': ['free', 'contiguous', 'prescriptive', @@ -407,54 +427,60 @@ ## # @cxl-add-dynamic-capacity: # -# Command to initiate to add dynamic capacity extents to a host. It -# simulates operations defined in cxl spec r3.1 7.6.7.6.5. +# Initiate adding dynamic capacity extents to a host. This simulates +# operations defined in Compute Express Link (CXL) Specification, +# Revision 3.1, Section 7.6.7.6.5. Note that, currently, establishing +# success or failure of the full Add Dynamic Capacity flow requires +# out of band communication with the OS of the CXL host. # -# @path: CXL DCD canonical QOM path. +# @path: path to the CXL Dynamic Capacity Device in the QOM tree. # -# @host-id: The "Host ID" field as defined in cxl spec r3.1 -# Table 7-70. +# @host-id: The "Host ID" field as defined in Compute Express Link +# (CXL) Specification, Revision 3.1, Table 7-70. # # @selection-policy: The "Selection Policy" bits as defined in -# cxl spec r3.1 Table 7-70. It specifies the policy to use for -# selecting which extents comprise the added capacity. +# Compute Express Link (CXL) Specification, Revision 3.1, +# Table 7-70. It specifies the policy to use for selecting +# which extents comprise the added capacity. # -# @region: The "Region Number" field as defined in cxl spec r3.1 -# Table 7-70. The dynamic capacity region where the capacity -# is being added. Valid range is from 0-7. +# @region: The "Region Number" field as defined in Compute Express +# Link (CXL) Specification, Revision 3.1, Table 7-70. Valid +# range is from 0-7. # -# @tag: The "Tag" field as defined in cxl spec r3.1 Table 7-70. +# @tag: The "Tag" field as defined in Compute Express Link (CXL) +# Specification, Revision 3.1, Table 7-70. # -# @extents: The "Extent List" field as defined in cxl spec r3.1 -# Table 7-70. +# @extents: The "Extent List" field as defined in Compute Express Link +# (CXL) Specification, Revision 3.1, Table 7-70. # # Since : 9.1 ## { 'command': 'cxl-add-dynamic-capacity', 'data': { 'path': 'str', 'host-id': 'uint16', - 'selection-policy': 'CXLExtSelPolicy', + 'selection-policy': 'CxlExtentSelectionPolicy', 'region': 'uint8', '*tag': 'str', - 'extents': [ 'CXLDynamicCapacityExtent' ] + 'extents': [ 'CxlDynamicCapacityExtent' ] } } ## -# @CXLExtRemovalPolicy: +# @CxlExtentRemovalPolicy: # # The policy to use for selecting which extents comprise the released -# capacity, defined in the "Flags" field in cxl spec r3.1 Table 7-71. +# capacity, defined in the "Flags" field in Compute Express Link (CXL) +# Specification, Revision 3.1, Table 7-71. # -# @tag-based: value = 0h. Extents are selected by the device based -# on tag, with no requirement for contiguous extents. +# @tag-based: Extents are selected by the device based on tag, with +# no requirement for contiguous extents. # -# @prescriptive: value = 1h. Extent list of capacity to release is -# included in the request payload. +# @prescriptive: Extent list of capacity to release is included in +# the request payload. # # Since: 9.1 ## -{ 'enum': 'CXLExtRemovalPolicy', +{ 'enum': 'CxlExtentRemovalPolicy', 'data': ['tag-based', 'prescriptive'] } @@ -462,45 +488,55 @@ ## # @cxl-release-dynamic-capacity: # -# Command to initiate to release dynamic capacity extents from a -# host. It simulates operations defined in cxl spec r3.1 7.6.7.6.6. +# Initiate release of dynamic capacity extents from a host. This +# simulates operations defined in Compute Express Link (CXL) +# Specification, Revision 3.1, Section 7.6.7.6.6. Note that, +# currently, success or failure of the full Release Dynamic Capacity +# flow requires out of band communication with the OS of the CXL host. # -# @path: CXL DCD canonical QOM path. +# @path: path to the CXL Dynamic Capacity Device in the QOM tree. # -# @host-id: The "Host ID" field as defined in cxl spec r3.1 +# @host-id: The "Host ID" field as defined in Compute Express Link +# (CXL) Specification, Revision 3.1, Table 7-71. +# +# @removal-policy: Bit[3:0] of the "Flags" field as defined in +# Compute Express Link (CXL) Specification, Revision 3.1, # Table 7-71. # -# @removal-policy: Bit[3:0] of the "Flags" field as defined in cxl -# spec r3.1 Table 7-71. +# @forced-removal: Bit[4] of the "Flags" field in Compute Express +# Link (CXL) Specification, Revision 3.1, Table 7-71. When set, +# the device does not wait for a Release Dynamic Capacity command +# from the host. Instead, the host immediately looses access to +# the released capacity. # -# @forced-removal: Bit[4] of the "Flags" field in cxl spec r3.1 -# Table 7-71. When set, device does not wait for a Release -# Dynamic Capacity command from the host. Host immediately -# loses access to released capacity. +# @sanitize-on-release: Bit[5] of the "Flags" field in Compute +# Express Link (CXL) Specification, Revision 3.1, Table 7-71. +# When set, the device should sanitize all released capacity as +# a result of this request. This ensures that all user data +# and metadata is made permanently unavailable by whatever +# means is appropriate for the media type. Note that changing +# encryption keys is not sufficient. # -# @sanitize-on-release: Bit[5] of the "Flags" field in cxl spec r3.1 -# Table 7-71. When set, device should sanitize all released -# capacity as a result of this request. +# @region: The "Region Number" field as defined in Compute Express +# Link Specification, Revision 3.1, Table 7-71. Valid range +# is from 0-7. # -# @region: The "Region Number" field as defined in cxl spec r3.1 -# Table 7-71. The dynamic capacity region where the capacity -# is being added. Valid range is from 0-7. +# @tag: The "Tag" field as defined in Compute Express Link (CXL) +# Specification, Revision 3.1, Table 7-71. # -# @tag: The "Tag" field as defined in cxl spec r3.1 Table 7-71. -# -# @extents: The "Extent List" field as defined in cxl spec r3.1 -# Table 7-71. +# @extents: The "Extent List" field as defined in Compute Express +# Link (CXL) Specification, Revision 3.1, Table 7-71. # # Since : 9.1 ## { 'command': 'cxl-release-dynamic-capacity', 'data': { 'path': 'str', 'host-id': 'uint16', - 'removal-policy': 'CXLExtRemovalPolicy', + 'removal-policy': 'CxlExtentRemovalPolicy', '*forced-removal': 'bool', '*sanitize-on-release': 'bool', 'region': 'uint8', '*tag': 'str', - 'extents': [ 'CXLDynamicCapacityExtent' ] + 'extents': [ 'CxlDynamicCapacityExtent' ] } } diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index 3274e5dcbb..35ac59883a 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -1874,7 +1874,7 @@ static bool cxl_extent_groups_overlaps_dpa_range(CXLDCExtentGroupList *list, */ static void qmp_cxl_process_dynamic_capacity_prescriptive(const char *path, uint16_t hid, CXLDCEventType type, uint8_t rid, - CXLDynamicCapacityExtentList *records, Error **errp) + CxlDynamicCapacityExtentList *records, Error **errp) { Object *obj; CXLEventDynamicCapacity dCap = {}; @@ -1882,7 +1882,7 @@ static void qmp_cxl_process_dynamic_capacity_prescriptive(const char *path, CXLType3Dev *dcd; uint8_t flags = 1 << CXL_EVENT_TYPE_INFO; uint32_t num_extents = 0; - CXLDynamicCapacityExtentList *list; + CxlDynamicCapacityExtentList *list; CXLDCExtentGroup *group = NULL; g_autofree CXLDCExtentRaw *extents = NULL; uint8_t enc_log = CXL_EVENT_TYPE_DYNAMIC_CAP; @@ -2032,13 +2032,13 @@ static void qmp_cxl_process_dynamic_capacity_prescriptive(const char *path, } void qmp_cxl_add_dynamic_capacity(const char *path, uint16_t host_id, - CXLExtSelPolicy sel_policy, uint8_t region, - const char *tag, - CXLDynamicCapacityExtentList *extents, + CxlExtentSelectionPolicy sel_policy, + uint8_t region, const char *tag, + CxlDynamicCapacityExtentList *extents, Error **errp) { switch (sel_policy) { - case CXL_EXT_SEL_POLICY_PRESCRIPTIVE: + case CXL_EXTENT_SELECTION_POLICY_PRESCRIPTIVE: qmp_cxl_process_dynamic_capacity_prescriptive(path, host_id, DC_EVENT_ADD_CAPACITY, region, extents, errp); @@ -2050,14 +2050,14 @@ void qmp_cxl_add_dynamic_capacity(const char *path, uint16_t host_id, } void qmp_cxl_release_dynamic_capacity(const char *path, uint16_t host_id, - CXLExtRemovalPolicy removal_policy, + CxlExtentRemovalPolicy removal_policy, bool has_forced_removal, bool forced_removal, bool has_sanitize_on_release, bool sanitize_on_release, uint8_t region, const char *tag, - CXLDynamicCapacityExtentList *extents, + CxlDynamicCapacityExtentList *extents, Error **errp) { CXLDCEventType type = DC_EVENT_RELEASE_CAPACITY; @@ -2070,7 +2070,7 @@ void qmp_cxl_release_dynamic_capacity(const char *path, uint16_t host_id, } switch (removal_policy) { - case CXL_EXT_REMOVAL_POLICY_PRESCRIPTIVE: + case CXL_EXTENT_REMOVAL_POLICY_PRESCRIPTIVE: qmp_cxl_process_dynamic_capacity_prescriptive(path, host_id, type, region, extents, errp); return; diff --git a/hw/mem/cxl_type3_stubs.c b/hw/mem/cxl_type3_stubs.c index 45419bbefe..c1a5e4a7c1 100644 --- a/hw/mem/cxl_type3_stubs.c +++ b/hw/mem/cxl_type3_stubs.c @@ -70,24 +70,24 @@ void qmp_cxl_inject_correctable_error(const char *path, CxlCorErrorType type, void qmp_cxl_add_dynamic_capacity(const char *path, uint16_t host_id, - CXLExtSelPolicy sel_policy, + CxlExtentSelectionPolicy sel_policy, uint8_t region, const char *tag, - CXLDynamicCapacityExtentList *extents, + CxlDynamicCapacityExtentList *extents, Error **errp) { error_setg(errp, "CXL Type 3 support is not compiled in"); } void qmp_cxl_release_dynamic_capacity(const char *path, uint16_t host_id, - CXLExtRemovalPolicy removal_policy, + CxlExtentRemovalPolicy removal_policy, bool has_forced_removal, bool forced_removal, bool has_sanitize_on_release, bool sanitize_on_release, uint8_t region, const char *tag, - CXLDynamicCapacityExtentList *extents, + CxlDynamicCapacityExtentList *extents, Error **errp) { error_setg(errp, "CXL Type 3 support is not compiled in"); From patchwork Tue Jul 2 14:11:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719774 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82702C30658 for ; Tue, 2 Jul 2024 14:19:12 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeER-0007Ua-RU; Tue, 02 Jul 2024 10:11:43 -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 1sOeE0-0005Qe-DP for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11: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 1sOeDv-0000SQ-5Z for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929469; 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=C8uBwo3DHXNNhuf3rApspBTWgLSO8s/xdDqrmh63AMQ=; b=MKJEHjUhtZo/2JDsoxUZurLwteGMdDCXlTSRQ1zFAqfrAMc1F7h2c/MUcfv2gRx2k2U0AH Vlaccaajy8Gsryxl5gQb7DbmqQalTIsRyC9A+w1UytGehqPSFcjkwXEeMrZDZ/goXcXIwg roZHCL178WfeOFKz2v5Z1SpNMiuxtrU= 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-625-M-1pKNPLP7-eB7tk_SamZw-1; Tue, 02 Jul 2024 10:11:08 -0400 X-MC-Unique: M-1pKNPLP7-eB7tk_SamZw-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4258675a6easo15724435e9.3 for ; Tue, 02 Jul 2024 07:11:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929466; x=1720534266; 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=C8uBwo3DHXNNhuf3rApspBTWgLSO8s/xdDqrmh63AMQ=; b=QmrZf949AZssGqEdXxPvIggdS12wQgvVpH2MAf90WWEAIAfLrSUlno5LWR+TeoJR+2 iPF8oPn/3h1yi3nsO6lyZ+WNyB3xW3UCMmMnz4UoyEOhbhgJBi3f2F8SjPkEUs1RbrNK m0sBkfjL1MtQDW1kzXAB4bxhAtKqkcFTRpC+F8ktqmXZcXLERi5Ha3PV5HhvQW4aS2En CvxWiYi8+cchvV6Mftm+CYPRwx6qO6xDqBYzsigHFBVN8PdHm5JYESvO65+IGRxMzi5v +Q4ofe15SDrrW1Zh6KGtKJ2fGyJH9VCzO3fWq46zvOf5mmQ5w28HKRZhRGnF9T4Hps35 OaLA== X-Gm-Message-State: AOJu0YwFM8LcBLYqIvEXxTwmB5S/d0+HNeeKAUCGvOSDWkDsAsGTDzyi FxOO+KDL3HJN2mIsYqWAxCyMs4A+E0L6qh/xcKZM28G92f1E0oOp3Q3tBrkGbi5t41gOQxM//Pr rdUJLOkXFUyi4H86b6S7svaokjHpjc1HwSXFy3qvDlDxNmyCKum7QRfBjwYgi1oXttxdDkrD7Nw rbFKwljn+kH2cdI4IBHW7m0W3wVut46A== X-Received: by 2002:a5d:47af:0:b0:367:434f:caa2 with SMTP id ffacd0b85a97d-36775627d4dmr7446142f8f.0.1719929466669; Tue, 02 Jul 2024 07:11:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHHKY9plRudrAM8VtduSOHgC4C+s5VO1zNktqEC3J7c/nKDgiuertTayR78pXo2Ab32GhjGSg== X-Received: by 2002:a5d:47af:0:b0:367:434f:caa2 with SMTP id ffacd0b85a97d-36775627d4dmr7446113f8f.0.1719929466091; Tue, 02 Jul 2024 07:11:06 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0cd6a6sm13530534f8f.24.2024.07.02.07.11.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:11:05 -0700 (PDT) Date: Tue, 2 Jul 2024 10:11:03 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Markus Armbruster , Eric Blake , Fan Ni Subject: [PULL 79/91] hw/cxl/events: Mark cxl-add-dynamic-capacity and cxl-release-dynamic-capcity unstable 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Jonathan Cameron Markus suggested that we make the unstable. I don't expect these interfaces to change because of their tight coupling to the Compute Express Link (CXL) Specification, Revision 3.1 Fabric Management API definitions which can only be extended in backwards compatible way. However, there seems little disadvantage in taking a cautious path for now and marking them as unstable interfaces. Suggested-by: Markus Armbruster Signed-off-by: Jonathan Cameron Message-Id: <20240625170805.359278-3-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- qapi/cxl.json | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/qapi/cxl.json b/qapi/cxl.json index a38622a0d1..bdfac67c47 100644 --- a/qapi/cxl.json +++ b/qapi/cxl.json @@ -453,6 +453,10 @@ # @extents: The "Extent List" field as defined in Compute Express Link # (CXL) Specification, Revision 3.1, Table 7-70. # +# Features: +# +# @unstable: For now this command is subject to change. +# # Since : 9.1 ## { 'command': 'cxl-add-dynamic-capacity', @@ -462,7 +466,8 @@ 'region': 'uint8', '*tag': 'str', 'extents': [ 'CxlDynamicCapacityExtent' ] - } + }, + 'features': [ 'unstable' ] } ## @@ -527,6 +532,10 @@ # @extents: The "Extent List" field as defined in Compute Express # Link (CXL) Specification, Revision 3.1, Table 7-71. # +# Features: +# +# @unstable: For now this command is subject to change. +# # Since : 9.1 ## { 'command': 'cxl-release-dynamic-capacity', @@ -538,5 +547,6 @@ 'region': 'uint8', '*tag': 'str', 'extents': [ 'CxlDynamicCapacityExtent' ] - } + }, + 'features': [ 'unstable' ] } From patchwork Tue Jul 2 14:11:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719843 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C6F7FC3064D for ; Tue, 2 Jul 2024 14:28:25 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeEN-0006ks-4f; Tue, 02 Jul 2024 10:11: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 1sOeE0-0005Qj-EL for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11: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 1sOeDx-0000Sf-1q for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929472; 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=YWXH9YhJGBTUPtLIg1EJaieR/oMq54SMMzeEyf0UDBU=; b=he3z1wNg8IJZhKH/NOiIMXHL9ieV9fUrH9BEVf7AVV4FXRDT/rP09FSogJsvXcXHG8edZL 2CQV2+fFxx5AfxuPIQjWdtb+IcCQPuMipa/ES134DpXRstYuYghkJSUd+d+2wlXn25BXxL 7goUWmE7mgxv8ETbW0tORdFHPBseo2c= 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-679-nKzbKYCBNK6vvN7P2zsauw-1; Tue, 02 Jul 2024 10:11:11 -0400 X-MC-Unique: nKzbKYCBNK6vvN7P2zsauw-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-42490ae735dso39307985e9.0 for ; Tue, 02 Jul 2024 07:11:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929469; x=1720534269; 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=YWXH9YhJGBTUPtLIg1EJaieR/oMq54SMMzeEyf0UDBU=; b=jeH2BbrpBsesM6IAyomOZL2mx9+uMa2Id2mIkETqb7XgNMVK4Smzs6gMFDmw5sysMB 90M4pkokvbHssk+0qRfEtnV8KJsKLi1JZa80BOykAHbbiwIfZNbX9RCDouJmkg5NRaXQ dit6b5ibFwN2MSqlb1Zl+fcKbUeYJG3/K0vSPNEB7r98+yZ6gQKNuRv9J5npibhGFPmB 36Kqi/orTV8U0xzSY2ivkfneSOvmAFLTW7CG9JCXbz0rUyvWbJFptjpS6opTsW/bfZkG FtxbjNwOvtVj8wH2yiJzoj6b+70sYfuyJ9vJw4UJRtd6kxgSpHvk+YbHWLDrdT0QDFed cjHA== X-Gm-Message-State: AOJu0YzZw0A0Kz/1tTgDRGJWsD7prNaN1AhXtPrgJkofTlXd4ZANWnFm LLYHHzFHv5BPY+QavZnDj2uNiEt5JsDZeRV18pdI/ZwSxrpjU9yneXkkFSP+7wXFN/q1veAnO5m sRvbZjXRfChAEYBgMxFik5y/Y79P6lj7fKRv+lskbBdnf3Zs0HuXKX0n2MzY6yDPe7Mxcfdav55 2v3i06sTttz35NmUVf3BWkzrFxSIqWZA== X-Received: by 2002:adf:f18b:0:b0:361:dd0c:678 with SMTP id ffacd0b85a97d-367756bc471mr6554379f8f.36.1719929469638; Tue, 02 Jul 2024 07:11:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGFkW784N+QYRpKZGuvfSqwvMm0SkFb2EIMkyD6K8g1BQsf04aP1J9tDnDwBxPlOGqHd6nUWg== X-Received: by 2002:adf:f18b:0:b0:361:dd0c:678 with SMTP id ffacd0b85a97d-367756bc471mr6554348f8f.36.1719929468985; Tue, 02 Jul 2024 07:11:08 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3678e5c2b08sm805506f8f.71.2024.07.02.07.11.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:11:08 -0700 (PDT) Date: Tue, 2 Jul 2024 10:11:06 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefano Garzarella , jasowang@redhat.com, qemu-stable@nongnu.org, Xoykie , Eugenio =?utf-8?b?UMOp?= =?utf-8?b?cmV6?= Subject: [PULL 80/91] virtio: remove virtio_tswap16s() call in vring_packed_event_read() Message-ID: <5f9b2cdb0e4bc7eab026bd5ee8ab120f327b86a8.1719929191.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Stefano Garzarella Commit d152cdd6f6 ("virtio: use virtio accessor to access packed event") switched using of address_space_read_cached() to virito_lduw_phys_cached() to access packed descriptor event. When we used address_space_read_cached(), we needed to call virtio_tswap16s() to handle the endianess of the field, but virito_lduw_phys_cached() already handles it internally, so we no longer need to call virtio_tswap16s() (as the commit had done for `off_wrap`, but forgot for `flags`). Fixes: d152cdd6f6 ("virtio: use virtio accessor to access packed event") Cc: jasowang@redhat.com Cc: qemu-stable@nongnu.org Reported-by: Xoykie Link: https://lore.kernel.org/qemu-devel/CAFU8RB_pjr77zMLsM0Unf9xPNxfr_--Tjr49F_eX32ZBc5o2zQ@mail.gmail.com Signed-off-by: Stefano Garzarella Message-Id: <20240701075208.19634-1-sgarzare@redhat.com> Acked-by: Jason Wang Reviewed-by: Peter Maydell Reviewed-by: Eugenio Pérez Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 3678ec2f88..583a224163 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -323,7 +323,6 @@ static void vring_packed_event_read(VirtIODevice *vdev, /* Make sure flags is seen before off_wrap */ smp_rmb(); e->off_wrap = virtio_lduw_phys_cached(vdev, cache, off_off); - virtio_tswap16s(vdev, &e->flags); } static void vring_packed_off_wrap_write(VirtIODevice *vdev, From patchwork Tue Jul 2 14:11:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719783 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A839DC3064D for ; Tue, 2 Jul 2024 14:21:10 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeEI-0006In-E7; Tue, 02 Jul 2024 10:11:34 -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 1sOeE5-0005Rb-PY for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11: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 1sOeE2-0000TY-W0 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929478; 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=sYzP7D9xykWeqZt2i0B3IIaPj2W0maOmrsq57DCD/d0=; b=JF7Sn9Y/mWLskAS+wPmc+NnJt06ITJwkC+aoNNa6AkkNaEJBP7DlDQspgu+ria+j4vU+ZG FTxpfi+F74rME1hBIz2RgIiliYzwHlrEFOarNMAfwUghD5CfCNPqd+KR4BfayEvUOgICHQ xrtf7l0neQCQSmJQ7IhHRGvq04m2Xm8= 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-99-n8i54DblPqqukQ-NG6Yj7Q-1; Tue, 02 Jul 2024 10:11:14 -0400 X-MC-Unique: n8i54DblPqqukQ-NG6Yj7Q-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-424fb2df2bdso39082975e9.3 for ; Tue, 02 Jul 2024 07:11:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929473; x=1720534273; 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=sYzP7D9xykWeqZt2i0B3IIaPj2W0maOmrsq57DCD/d0=; b=J7+P/MHVL+vo1rP1EtJJFye+M2GQ9EZmxHVRZIP+MHJL2xPhkhrgnLuYI9OmfaNKcq qK4GfarD6Q4bG8PpSJTxh2HWWTQBUVjP1mzwyT8cIbbqX6FO9LLDLoOVNrMIzFoTiEzs eLh+u92VHm1AiEccq7GXbfllXX1Hy5AzaXyU15uTqhlumWffXeTg4R5K+/uz6K9dYQfa mdIMuczZS+2+AxkKQKnLX24Xue6Vspph66KPFlK3B6kl2U5basrNRhGQUm8twtbnK4YB T0bSVX1GYsUrOGfwnZ5EfoYn3cCg4m341RPrMblZU9qz3Dg7LJv9t5kUbayI3Kq4ia8j 7Xjg== X-Gm-Message-State: AOJu0YxEVlH8YmKeA2NsY6BpLjCg+FZJ1JDRN3WKoR5XMIkg/UdJEr7+ 2BvVINfyAcLbX55hV1FGY+bh3JlTVPd1N8S1TxanwO4nikCLFrI5z85bUkYSUhYA+SutEXcpU2d or4M2v4L94Dl9MFcHNyJyqQ67iMAlm3ilM78fCkTgkXX+Uy0kSkr5ckymOKClZ5dPiVXanr+P70 M32pJllaTtGeJ2CCOQ6jlSPDJVrLosVA== X-Received: by 2002:a05:600c:4248:b0:424:a31d:a046 with SMTP id 5b1f17b1804b1-4257a007deemr85342405e9.15.1719929472786; Tue, 02 Jul 2024 07:11:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEpMqCqcJp5KEfmR3ilNy0ETjMvahMtiG9//cBNzPatDFzvgcGDFDwuX/iFB5OAW0+lN+hFOQ== X-Received: by 2002:a05:600c:4248:b0:424:a31d:a046 with SMTP id 5b1f17b1804b1-4257a007deemr85342035e9.15.1719929472133; Tue, 02 Jul 2024 07:11:12 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b098426sm198287055e9.32.2024.07.02.07.11.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:11:11 -0700 (PDT) Date: Tue, 2 Jul 2024 10:11:09 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?C=C3=A9dric?= Le Goater , Eric Auger Subject: [PULL 81/91] virtio-iommu: Clear IOMMUDevice when VFIO device is unplugged Message-ID: <35fb409a47c4ac0ce9fca2a7f695ecf84c962228.1719929191.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Cédric Le Goater When a VFIO device is hoplugged in a VM using virtio-iommu, IOMMUPciBus and IOMMUDevice cache entries are created in the .get_address_space() handler of the machine IOMMU device. However, these entries are never destroyed, not even when the VFIO device is detached from the machine. This can lead to an assert if the device is reattached again. When reattached, the .get_address_space() handler reuses an IOMMUDevice entry allocated when the VFIO device was first attached. virtio_iommu_set_host_iova_ranges() is called later on from the .set_iommu_device() handler an fails with an assert on 'probe_done' because the device appears to have been already probed when this is not the case. The IOMMUDevice entry is allocated in pci_device_iommu_address_space() called from under vfio_realize(), the VFIO PCI realize handler. Since pci_device_unset_iommu_device() is called from vfio_exitfn(), a sub function of the PCIDevice unrealize() handler, it seems that the .unset_iommu_device() handler is the best place to release resources allocated at realize time. Clear the IOMMUDevice cache entry there to fix hotplug. Fixes: 817ef10da23c ("virtio-iommu: Implement set|unset]_iommu_device() callbacks") Signed-off-by: Cédric Le Goater Message-Id: <20240701101453.203985-1-clg@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-iommu.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c index ed7426afc7..7c54c6b5e2 100644 --- a/hw/virtio/virtio-iommu.c +++ b/hw/virtio/virtio-iommu.c @@ -467,6 +467,26 @@ static AddressSpace *virtio_iommu_find_add_as(PCIBus *bus, void *opaque, return &sdev->as; } +static void virtio_iommu_device_clear(VirtIOIOMMU *s, PCIBus *bus, int devfn) +{ + IOMMUPciBus *sbus = g_hash_table_lookup(s->as_by_busptr, bus); + IOMMUDevice *sdev; + + if (!sbus) { + return; + } + + sdev = sbus->pbdev[devfn]; + if (!sdev) { + return; + } + + g_list_free_full(sdev->resv_regions, g_free); + sdev->resv_regions = NULL; + g_free(sdev); + sbus->pbdev[devfn] = NULL; +} + static gboolean hiod_equal(gconstpointer v1, gconstpointer v2) { const struct hiod_key *key1 = v1; @@ -650,6 +670,7 @@ virtio_iommu_unset_iommu_device(PCIBus *bus, void *opaque, int devfn) } g_hash_table_remove(viommu->host_iommu_devices, &key); + virtio_iommu_device_clear(viommu, bus, devfn); } static const PCIIOMMUOps virtio_iommu_ops = { From patchwork Tue Jul 2 14:11:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719842 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1DEE1C30658 for ; Tue, 2 Jul 2024 14:27:52 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeEN-0006ki-4C; Tue, 02 Jul 2024 10:11: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 1sOeE9-0005Tl-Sn for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11: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 1sOeE7-0000Tz-Vh for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929482; 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=PtAXW6LVwA3P89VkFVi94GjAlNMJ1XHCqV5FMloDGgI=; b=HSIHvboQuSHCe9BOuzye0Z1dXutLFTvTL3HuTRLHhQG54W6Qd0u5Kl36trUa4kApkZ/urV /E+bIN+85kHnTHXpecyFbYQ4DnyGMmbREm4aBh0At4Oq+3e4a60C9KlzhNxmihdL2XnYNO kskCRz6qiV8CEGV/KW3zl2IrG2hFB4g= 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-68-VMy5Z14dMxuADzGGNAT3ig-1; Tue, 02 Jul 2024 10:11:18 -0400 X-MC-Unique: VMy5Z14dMxuADzGGNAT3ig-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-367879e8395so428490f8f.0 for ; Tue, 02 Jul 2024 07:11:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929477; x=1720534277; 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=PtAXW6LVwA3P89VkFVi94GjAlNMJ1XHCqV5FMloDGgI=; b=NHEAseyU8YMGP8QgDIIWSrmDZ1nU1w0OTM7gjYH3VG+s9OApxTwgnQ6xJx2m5sFaLL EpZdN+Vh4UCsVBzb1Qgxd9eUJMFDK/1TN5eDkL8ls9k6fQXfMz/Jxg0qnOKIkQKc7uRW OXPiX3KZzN3lGoMIUgYYK2+mogE4Zaj1neHP31AQN+K/2TYPCLrM1ReLd1oUNmlb8jQ2 0FQJkPBJdzHMrlKfw2pRJ7zCxbauhW04BjRIXX0G1Lhjs1zXQeaXZtPfZffPko0qC9G7 MAbHrYW3EO+96utoBQrutv4wXBDbTVlA2vT5LqbHbOh1dgr0zHN/S69rG0ZZYHlaBZ0I X5zg== X-Gm-Message-State: AOJu0YxqpAiRyI0xQksQwbEMb5eEmHdYF5zXq56XfDeM65zZQMGzlFG5 Irye6lyckNyky4ZcMYDkZnkfRZ+qDqRyMA4cjneueK2dOuWfbY4znG0/OLfVw/zdNRDfHAUBWhX dwx6bI/ljLS/QVhTwjZLFvkWE7y2JXD5199fF7pCDqXjH2WXh4fZqEqN8ylMEpI8NDtXg6AX1xu b1cALPUaqf8LcYwywHGXcazQQKzxHeow== X-Received: by 2002:a5d:6e65:0:b0:366:f41f:8cc7 with SMTP id ffacd0b85a97d-367757249e9mr6984223f8f.46.1719929475675; Tue, 02 Jul 2024 07:11:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHtbvwUarQo8T83+h7CkvuHaP0Rh47QhEy/C0CW/HAD5LHdyGe4lNp58kWe28JSQo8Q9fZNKw== X-Received: by 2002:a5d:6e65:0:b0:366:f41f:8cc7 with SMTP id ffacd0b85a97d-367757249e9mr6984194f8f.46.1719929474973; Tue, 02 Jul 2024 07:11:14 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a10305fsm13265723f8f.96.2024.07.02.07.11.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:11:14 -0700 (PDT) Date: Tue, 2 Jul 2024 10:11:12 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Akihiko Odaki , Marcel Apfelbaum Subject: [PULL 82/91] hw/pci: Rename has_power to enabled Message-ID: <1aabc8bbf3bf63c1a37af9771a0d4c80cb170ea4.1719929191.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Akihiko Odaki The renamed state will not only represent powering state of PFs, but also represent SR-IOV VF enablement in the future. Signed-off-by: Akihiko Odaki Message-Id: <20240627-reuse-v10-1-7ca0b8ed3d9f@daynix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/pci/pci.h | 7 ++++++- include/hw/pci/pci_device.h | 2 +- hw/pci/pci.c | 14 +++++++------- hw/pci/pci_host.c | 4 ++-- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index eb26cac810..fe04b4fafd 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -678,6 +678,11 @@ static inline void pci_irq_pulse(PCIDevice *pci_dev) } MSIMessage pci_get_msi_message(PCIDevice *dev, int vector); -void pci_set_power(PCIDevice *pci_dev, bool state); +void pci_set_enabled(PCIDevice *pci_dev, bool state); + +static inline void pci_set_power(PCIDevice *pci_dev, bool state) +{ + pci_set_enabled(pci_dev, state); +} #endif diff --git a/include/hw/pci/pci_device.h b/include/hw/pci/pci_device.h index d3dd0f64b2..d57f9ce838 100644 --- a/include/hw/pci/pci_device.h +++ b/include/hw/pci/pci_device.h @@ -56,7 +56,7 @@ typedef struct PCIReqIDCache PCIReqIDCache; struct PCIDevice { DeviceState qdev; bool partially_hotplugged; - bool has_power; + bool enabled; /* PCI config space */ uint8_t *config; diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 50b86d5790..68d30feb86 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1525,7 +1525,7 @@ static void pci_update_mappings(PCIDevice *d) continue; new_addr = pci_bar_address(d, i, r->type, r->size); - if (!d->has_power) { + if (!d->enabled) { new_addr = PCI_BAR_UNMAPPED; } @@ -1613,7 +1613,7 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val_in, int pci_update_irq_disabled(d, was_irq_disabled); memory_region_set_enabled(&d->bus_master_enable_region, (pci_get_word(d->config + PCI_COMMAND) - & PCI_COMMAND_MASTER) && d->has_power); + & PCI_COMMAND_MASTER) && d->enabled); } msi_write_config(d, addr, val_in, l); @@ -2884,18 +2884,18 @@ MSIMessage pci_get_msi_message(PCIDevice *dev, int vector) return msg; } -void pci_set_power(PCIDevice *d, bool state) +void pci_set_enabled(PCIDevice *d, bool state) { - if (d->has_power == state) { + if (d->enabled == state) { return; } - d->has_power = state; + d->enabled = state; pci_update_mappings(d); memory_region_set_enabled(&d->bus_master_enable_region, (pci_get_word(d->config + PCI_COMMAND) - & PCI_COMMAND_MASTER) && d->has_power); - if (!d->has_power) { + & PCI_COMMAND_MASTER) && d->enabled); + if (!d->enabled) { pci_device_reset(d); } } diff --git a/hw/pci/pci_host.c b/hw/pci/pci_host.c index dfe6fe6184..0d82727cc9 100644 --- a/hw/pci/pci_host.c +++ b/hw/pci/pci_host.c @@ -86,7 +86,7 @@ void pci_host_config_write_common(PCIDevice *pci_dev, uint32_t addr, * allowing direct removal of unexposed functions. */ if ((pci_dev->qdev.hotplugged && !pci_get_function_0(pci_dev)) || - !pci_dev->has_power || is_pci_dev_ejected(pci_dev)) { + !pci_dev->enabled || is_pci_dev_ejected(pci_dev)) { return; } @@ -111,7 +111,7 @@ uint32_t pci_host_config_read_common(PCIDevice *pci_dev, uint32_t addr, * allowing direct removal of unexposed functions. */ if ((pci_dev->qdev.hotplugged && !pci_get_function_0(pci_dev)) || - !pci_dev->has_power || is_pci_dev_ejected(pci_dev)) { + !pci_dev->enabled || is_pci_dev_ejected(pci_dev)) { return ~0x0; } From patchwork Tue Jul 2 14:11:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719751 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A6302C30658 for ; Tue, 2 Jul 2024 14:13:55 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeEJ-0006PW-9v; Tue, 02 Jul 2024 10:11: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 1sOeEC-0005mw-5A for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11: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 1sOeE7-0000UB-W5 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929483; 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=actUboiQ+IrTgCsdz18KhXUIoDAvYkrEhXUsAIxh/Nc=; b=azpd1l0JiInCl3Jsp3ANWXbjT8oZgO2rkVrkOugnZ/IqaiVRTKVjCfnN9rqxwh13BiJYHL PljPiJgiuzobSyFwdhYGQ42U37s1G18D7B8HGAHzJCnNjR4JBjcvxU1XWRleQg9y/AsQ+y knMgCqOTSmQYObiaQzSUhn9KCiGPEjk= 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-65-YsTsPej4Nvy9YM0AuGNC-A-1; Tue, 02 Jul 2024 10:11:20 -0400 X-MC-Unique: YsTsPej4Nvy9YM0AuGNC-A-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4257db9d71fso16894895e9.2 for ; Tue, 02 Jul 2024 07:11:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929479; x=1720534279; 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=actUboiQ+IrTgCsdz18KhXUIoDAvYkrEhXUsAIxh/Nc=; b=HbYTlvOkvz6FxSFDxdr4S+2r7wwX2NNMuWgKfYy2Q1oZOGkLvrb2rOQa8udkd+WywU kMG0GUJKem+FUpVfpouDVBQZy/hNUdsKsF2sBt49Q2msAnaE5llE2snmnHUnwR3bZ9qZ t/7QVS1iGFqhfBNP60a4999pVMzN5UcfL0qTW6BRE+DxgdfbihMW78+p+IgNJVAu50ah 7Lt/yKQJd7NktuLfdDrfi5Y2RM2bPgjiY18zraiQytYgNSVY9jPb0VW3p1OsaSYhlA3F tJjDYkIbWLOZyv9a/6MPGrF7c+ioksKncgtUrPAlBrpLO4gcAG74383id1UQ9ImlFJv7 zVgg== X-Gm-Message-State: AOJu0YyNIA6NhgriCcK4NFIbyqHf8Zx593D3vbp9/kjzCBxlT3PC4pxt YNb/9rp/aSnelD3cslsr4jJUg1wzSU/77adYm1mPQL8EudbsLCQtn1M6bKCe2JtHO6IBZsFlrGS mUy2e9ITwPKDQOI9LktS/fllMuHkSD4A/v+DhPUALSzngGr/FEUaZxvYPFjnyKJJAnqQQxBXc/r Zu0ZMIa45J0aMMqzkek5aZ0h87C2rQEg== X-Received: by 2002:a05:6000:2cc:b0:366:eb45:6d55 with SMTP id ffacd0b85a97d-367757215a5mr7036351f8f.49.1719929479414; Tue, 02 Jul 2024 07:11:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGuoZUZAxFLi6xOWmUDcw8ZAvIjY+5z3b4et2gwHpUkVjDAM9ED8sWHRmDpZMBQ2aClDMBVjA== X-Received: by 2002:a05:6000:2cc:b0:366:eb45:6d55 with SMTP id ffacd0b85a97d-367757215a5mr7036294f8f.49.1719929478487; Tue, 02 Jul 2024 07:11:18 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0d9b12sm13315259f8f.44.2024.07.02.07.11.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:11:17 -0700 (PDT) Date: Tue, 2 Jul 2024 10:11:15 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Akihiko Odaki , Nicholas Piggin , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , qemu-ppc@nongnu.org Subject: [PULL 83/91] hw/ppc/spapr_pci: Do not create DT for disabled PCI 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Akihiko Odaki Disabled means it is a disabled SR-IOV VF or it is powered off, and hidden from the guest. Signed-off-by: Akihiko Odaki Message-Id: <20240627-reuse-v10-2-7ca0b8ed3d9f@daynix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/ppc/spapr_pci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 7cf9904c35..f63182a03c 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -1296,6 +1296,10 @@ static void spapr_dt_pci_device_cb(PCIBus *bus, PCIDevice *pdev, return; } + if (!pdev->enabled) { + return; + } + err = spapr_dt_pci_device(p->sphb, pdev, p->fdt, p->offset); if (err < 0) { p->err = err; From patchwork Tue Jul 2 14:11:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719797 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5CEC9C41513 for ; Tue, 2 Jul 2024 14:24:18 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeEW-00086s-BT; Tue, 02 Jul 2024 10:11:48 -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 1sOeEN-0006pI-DI for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:39 -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 1sOeED-0000UH-11 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929484; 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=DMkazJvXlCFuPVFo5zwsqgTLcz0EAKKfqUw3BcILaOs=; b=TMgR6j9ZiVL5cCpFe+m3zetmMe87J/RuelLOxoXxjgk/+bI5/57RmVzE3CqWLnpFVZWXUM bhw1ML+66KtaJpd8Cmwwm7+EKYODheU4qB382OTD2hLtlyQjDZ9VtEbBzJjNO+cFnrtrR9 ++CfNJ4MWbCfliLTv0OrR1eLZYkwcBA= 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-18-xryIpZtAOsCAo4wgJVp4wg-1; Tue, 02 Jul 2024 10:11:23 -0400 X-MC-Unique: xryIpZtAOsCAo4wgJVp4wg-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-425739141c2so27428985e9.2 for ; Tue, 02 Jul 2024 07:11:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929481; x=1720534281; 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=DMkazJvXlCFuPVFo5zwsqgTLcz0EAKKfqUw3BcILaOs=; b=BzF6p/Mp529MeKyduDcsiUzkQ395e0y7vBCSgZNFNYFYLpEaHqu+IllGiOcOCJ65Fi 4EywgLpXDCHvIyaH/XiI1wccv+zOYOpmvGVqzGv9HAdyOvlb16V4g/Q5jAVR1WJfgreF dcKIiYxIzTCr2J0OmmbJ1oIh7sM4UfWBlTHorxuWqr+ir7Q9RCCS4na+p+5wknAhmp1Y L8cb3O7O4VYcIvhK1XgI4zRHya8QFONiaRP/HRIrML5+XxT9oXKcESgzMA66luuF0O5Y SZ7GDKb743thAHSMCuSBbQIfi5Gscl35Z40KEM8nUkg5+QSNjKiJ6JgB1kL0o+YR8Wcy haCA== X-Gm-Message-State: AOJu0YzLcmwRVlTdUAykbvmoH1fb2rJXGRRg0lUmo2G90GcKr0OtpPhf fKuSoxrBDp1Yhzc/mjERyUTUCvowy7Azh8jMVcewQz+lQJNCBKgTc57/QBXIspctVLgD9H27LDy 8VsvmCvDE8Mp46fSaImCG3VQXQsJzxvJbWlLJZqj+yxdy5IlwtSwo69OjLnFsTgHe6XPwn2Mvn0 pdKx7MTJkG+b9nL25xg9yEPXv8wGJBTQ== X-Received: by 2002:a5d:69c8:0:b0:367:8a72:b8b4 with SMTP id ffacd0b85a97d-3678a72ba4emr886275f8f.33.1719929481763; Tue, 02 Jul 2024 07:11:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYxAuttfnTxopd9weeQrALkLr81tt4e5N16qWnGw/1xYosbp5grhiwDHHcZaOVB4BMH40KMA== X-Received: by 2002:a5d:69c8:0:b0:367:8a72:b8b4 with SMTP id ffacd0b85a97d-3678a72ba4emr886250f8f.33.1719929481221; Tue, 02 Jul 2024 07:11:21 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0e12e2sm13316329f8f.50.2024.07.02.07.11.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:11:20 -0700 (PDT) Date: Tue, 2 Jul 2024 10:11:18 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Akihiko Odaki , Nicholas Piggin , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , qemu-ppc@nongnu.org Subject: [PULL 84/91] hw/ppc/spapr_pci: Do not reject VFs created after a PF 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Akihiko Odaki A PF may automatically create VFs and the PF may be function 0. Signed-off-by: Akihiko Odaki Message-Id: <20240627-reuse-v10-3-7ca0b8ed3d9f@daynix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/ppc/spapr_pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index f63182a03c..ed4454bbf7 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -1573,7 +1573,9 @@ static void spapr_pci_pre_plug(HotplugHandler *plug_handler, * hotplug, we do not allow functions to be hotplugged to a * slot that already has function 0 present */ - if (plugged_dev->hotplugged && bus->devices[PCI_DEVFN(slotnr, 0)] && + if (plugged_dev->hotplugged && + !pci_is_vf(pdev) && + bus->devices[PCI_DEVFN(slotnr, 0)] && PCI_FUNC(pdev->devfn) != 0) { error_setg(errp, "PCI: slot %d function 0 already occupied by %s," " additional functions can no longer be exposed to guest.", From patchwork Tue Jul 2 14:11:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719773 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C33C0C30658 for ; Tue, 2 Jul 2024 14:19:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeET-0007jc-Gt; Tue, 02 Jul 2024 10:11:45 -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 1sOeEF-000675-T5 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11: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 1sOeED-0000V2-DG for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929488; 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=6T5wYohIMyfJ7zfD4BymibarRz8jk6tb2fFAczZH0qE=; b=Bpw8fRhBkNXXgd9AGyUyLhFfUCA2Lb1zj+O8C+NljigKhcT3fFiXnxzPkbe/NqV1Vtwymo sHNM9R1Q/gNmQD90y7h9efEG12xObTTwROBESK8g38QeW7881Ld064zF4MW3iiCNxcq5wR nFudDMQyMWte6PyvKANychAJpW3WwAQ= 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-547-rukY6QQ2OqKRmKhWxvcrBw-1; Tue, 02 Jul 2024 10:11:27 -0400 X-MC-Unique: rukY6QQ2OqKRmKhWxvcrBw-1 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-52ce7a15a62so4647907e87.3 for ; Tue, 02 Jul 2024 07:11:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929485; x=1720534285; 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=6T5wYohIMyfJ7zfD4BymibarRz8jk6tb2fFAczZH0qE=; b=Pp2O1hMawcPeMmrA6LaDxB2ivJJ3a8k1bYQtOZqseygtBlvzPOAEXYOGq1nK1myRsY ZX5AV8IICb31nPlQ5AsjE3jWb5qs0Wz0wfp/sTQaCXSZwNN+s2seOdmPcGiAdmkqZTbx l21SAVZ3+NHsMxqAOFZ6liUWxSpjI5zdTy8wDKewCQsjPXqtPo4QnDQsZokrSwnCLqPO 2P41atPdyAjAxqUm9EQe7QZ8TdYRgn/WOwb9lVbBMt+ADoPh2ESBke3G9qFX6f8hQIyL dCXfd+E9asJShyZA1SJuTBdQa0yB1w40Jh7LJ16qDVsx9aMeCA3Luqs7JIhdf+l/n8wb qLNA== X-Gm-Message-State: AOJu0Yx+WOAmnp8tFJaqakQVWpp3Rw/0K4SkDwNLaJEq9vPOw3eN7eBY FlGpf5a1mPVn1hev17MfwAsDxBMpyNWI8+R1K75J21cdKXb5NCX2ApubmmvISiFoN5dT2Sv3AWO fSapxk4A4xwCcYcEmqMspnJ/3uukJj6MgH+6y2t6vKYCS3ZMtx/IDxweT8Q8JqXhSeMb4rt8CMc iHUwuqu5ZFT20OotbV9KCW/u07JALaMA== X-Received: by 2002:a05:6512:3b0d:b0:52e:73a2:4415 with SMTP id 2adb3069b0e04-52e8270adecmr7084391e87.46.1719929485006; Tue, 02 Jul 2024 07:11:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFM5HYxHFGNBmB92gJijyddIVKu4mN02lMpyH6Q+TbiBXWLbuPRpq6Dl+sLLM5e0ZQihkGSQg== X-Received: by 2002:a05:6512:3b0d:b0:52e:73a2:4415 with SMTP id 2adb3069b0e04-52e8270adecmr7084364e87.46.1719929484337; Tue, 02 Jul 2024 07:11:24 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42588492b4fsm59555655e9.4.2024.07.02.07.11.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:11:23 -0700 (PDT) Date: Tue, 2 Jul 2024 10:11:21 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Akihiko Odaki , Marcel Apfelbaum Subject: [PULL 85/91] pcie_sriov: Do not manually unrealize Message-ID: <2f9bcba626116c645f51c91f3fd5d98fadcb8d0b.1719929191.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Akihiko Odaki A device gets automatically unrealized when being unparented. Signed-off-by: Akihiko Odaki Message-Id: <20240627-reuse-v10-4-7ca0b8ed3d9f@daynix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci/pcie_sriov.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index e9b23221d7..499becd527 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -204,11 +204,7 @@ static void unregister_vfs(PCIDevice *dev) trace_sriov_unregister_vfs(dev->name, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), num_vfs); for (i = 0; i < num_vfs; i++) { - Error *err = NULL; PCIDevice *vf = dev->exp.sriov_pf.vf[i]; - if (!object_property_set_bool(OBJECT(vf), "realized", false, &err)) { - error_reportf_err(err, "Failed to unplug: "); - } object_unparent(OBJECT(vf)); object_unref(OBJECT(vf)); } From patchwork Tue Jul 2 14:11:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719840 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 09B28C3064D for ; Tue, 2 Jul 2024 14:27:12 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeEX-0008AH-07; Tue, 02 Jul 2024 10:11: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 1sOeEL-0006dA-KP for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:37 -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 1sOeEG-0000VT-Db for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929491; 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=30vtT+Bk+aBG/k9psr6e7+phVupnPVIwCqnHm1QF2rI=; b=W3FmgLEe5RNJTIkmcpx+y/bql5IWzYdjm6a88nhaHgzak6XNUVUoPe/k71m/FgE/gxHuOM 1Yg6YuL9VxB4Nzi1NP4Jlak6SzCM+yllyiKmSoOqoF/cHRYJdK6qTM5vwNhhbaFmvIxI0O IN2F4f1ZHBE8LjXWp6LbZjTgR/YO62w= 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-567-pDZ8CvyzNfi9TknvQcXeYw-1; Tue, 02 Jul 2024 10:11:30 -0400 X-MC-Unique: pDZ8CvyzNfi9TknvQcXeYw-1 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-52cd67cee83so4073022e87.2 for ; Tue, 02 Jul 2024 07:11:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929488; x=1720534288; 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=30vtT+Bk+aBG/k9psr6e7+phVupnPVIwCqnHm1QF2rI=; b=J/7ONwjpbGKhDrDc5TzfUGz5J5/xHUUgbkbRijuf1uGcW2Sbz8yp59jMeZe/bsdlga Q0msspjRg2JS4vPb+ghlPhAzYCpohlj8rEAS7jQFZNlSgz5PgzRmE6JT3xGFrfL6tYDE /dfViktP5Wi9Twp3/Dgzt19E6cLdekXCv/VbBGAnDZ94ebDJdJDSTBJsHV3uLl12gPZA TMAvNSZ3CgLwN6V8COI7nLm4xJbIvifPh5P+EJ4ddnpf4kkOvJTAprLt4817SfMoxvZ1 4jXPtIbKvwtpITaS21MJ198RcXCvYKmZrMNkAr7xwPsf/lQR0EaOpArguqsw38MreMt2 zNjg== X-Gm-Message-State: AOJu0YyDXHrgCaEEA17gSZxT54VDiS8WAsQN1nE3fi8KMRP0g+mdkLpN qTpr5YgSCJlwcrmtbSdMVFgLwdhyFVCfoOasE3/Ui9hUQqH60KY11JeLqrRZtFOFp18w6XqqbAB TvuhypkKaGyOzcQdShgtqs2WhH7S4VVyvtm3ZNrC/hYXYPjEEluOoBZylNbLCDtKbBRPV71QRp3 4JxTDRc+SuBDn1zK7iJfNVV2Q5NT6gvA== X-Received: by 2002:a05:6512:110d:b0:52c:d8ce:c323 with SMTP id 2adb3069b0e04-52e8268d891mr6638306e87.35.1719929488362; Tue, 02 Jul 2024 07:11:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEEINwpP7OSLBrzw4kz7cZjG5BfwRTxdHJOJtzkCPwoB9/B8SmPLU+cbtMRtoMscyVkRPv8Ow== X-Received: by 2002:a05:6512:110d:b0:52c:d8ce:c323 with SMTP id 2adb3069b0e04-52e8268d891mr6638249e87.35.1719929487528; Tue, 02 Jul 2024 07:11:27 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b09a828sm201949865e9.37.2024.07.02.07.11.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:11:27 -0700 (PDT) Date: Tue, 2 Jul 2024 10:11:24 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Akihiko Odaki , Marcel Apfelbaum , Sriram Yagnaraman , Jason Wang , Keith Busch , Klaus Jensen , Jesper Devantier , qemu-block@nongnu.org Subject: [PULL 86/91] pcie_sriov: Ensure VF function number does not overflow 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=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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Akihiko Odaki pci_new() aborts when creating a VF with a function number equals to or is greater than PCI_DEVFN_MAX. Signed-off-by: Akihiko Odaki Message-Id: <20240627-reuse-v10-5-7ca0b8ed3d9f@daynix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- docs/pcie_sriov.txt | 8 +++++--- include/hw/pci/pcie_sriov.h | 5 +++-- hw/net/igb.c | 13 ++++++++++--- hw/nvme/ctrl.c | 24 ++++++++++++++++-------- hw/pci/pcie_sriov.c | 19 +++++++++++++++++-- 5 files changed, 51 insertions(+), 18 deletions(-) diff --git a/docs/pcie_sriov.txt b/docs/pcie_sriov.txt index a47aad0bfa..ab2142807f 100644 --- a/docs/pcie_sriov.txt +++ b/docs/pcie_sriov.txt @@ -52,9 +52,11 @@ setting up a BAR for a VF. ... /* Add and initialize the SR/IOV capability */ - pcie_sriov_pf_init(d, 0x200, "your_virtual_dev", - vf_devid, initial_vfs, total_vfs, - fun_offset, stride); + if (!pcie_sriov_pf_init(d, 0x200, "your_virtual_dev", + vf_devid, initial_vfs, total_vfs, + fun_offset, stride, errp)) { + return; + } /* Set up individual VF BARs (parameters as for normal BARs) */ pcie_sriov_pf_init_vf_bar( ... ) diff --git a/include/hw/pci/pcie_sriov.h b/include/hw/pci/pcie_sriov.h index 450cbef6c2..aa704e8f9d 100644 --- a/include/hw/pci/pcie_sriov.h +++ b/include/hw/pci/pcie_sriov.h @@ -27,10 +27,11 @@ typedef struct PCIESriovVF { uint16_t vf_number; /* Logical VF number of this function */ } PCIESriovVF; -void pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, +bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, const char *vfname, uint16_t vf_dev_id, uint16_t init_vfs, uint16_t total_vfs, - uint16_t vf_offset, uint16_t vf_stride); + uint16_t vf_offset, uint16_t vf_stride, + Error **errp); void pcie_sriov_pf_exit(PCIDevice *dev); /* Set up a VF bar in the SR/IOV bar area */ diff --git a/hw/net/igb.c b/hw/net/igb.c index b92bba402e..b6ca2f1b8a 100644 --- a/hw/net/igb.c +++ b/hw/net/igb.c @@ -446,9 +446,16 @@ static void igb_pci_realize(PCIDevice *pci_dev, Error **errp) pcie_ari_init(pci_dev, 0x150); - pcie_sriov_pf_init(pci_dev, IGB_CAP_SRIOV_OFFSET, TYPE_IGBVF, - IGB_82576_VF_DEV_ID, IGB_MAX_VF_FUNCTIONS, IGB_MAX_VF_FUNCTIONS, - IGB_VF_OFFSET, IGB_VF_STRIDE); + if (!pcie_sriov_pf_init(pci_dev, IGB_CAP_SRIOV_OFFSET, + TYPE_IGBVF, IGB_82576_VF_DEV_ID, + IGB_MAX_VF_FUNCTIONS, IGB_MAX_VF_FUNCTIONS, + IGB_VF_OFFSET, IGB_VF_STRIDE, + errp)) { + pcie_cap_exit(pci_dev); + igb_cleanup_msix(s); + msi_uninit(pci_dev); + return; + } pcie_sriov_pf_init_vf_bar(pci_dev, IGBVF_MMIO_BAR_IDX, PCI_BASE_ADDRESS_MEM_TYPE_64 | PCI_BASE_ADDRESS_MEM_PREFETCH, diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 127c3d2383..066389e391 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -8048,7 +8048,8 @@ out: return pow2ceil(bar_size); } -static void nvme_init_sriov(NvmeCtrl *n, PCIDevice *pci_dev, uint16_t offset) +static bool nvme_init_sriov(NvmeCtrl *n, PCIDevice *pci_dev, uint16_t offset, + Error **errp) { uint16_t vf_dev_id = n->params.use_intel_id ? PCI_DEVICE_ID_INTEL_NVME : PCI_DEVICE_ID_REDHAT_NVME; @@ -8057,12 +8058,17 @@ static void nvme_init_sriov(NvmeCtrl *n, PCIDevice *pci_dev, uint16_t offset) le16_to_cpu(cap->vifrsm), NULL, NULL); - pcie_sriov_pf_init(pci_dev, offset, "nvme", vf_dev_id, - n->params.sriov_max_vfs, n->params.sriov_max_vfs, - NVME_VF_OFFSET, NVME_VF_STRIDE); + if (!pcie_sriov_pf_init(pci_dev, offset, "nvme", vf_dev_id, + n->params.sriov_max_vfs, n->params.sriov_max_vfs, + NVME_VF_OFFSET, NVME_VF_STRIDE, + errp)) { + return false; + } pcie_sriov_pf_init_vf_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64, bar_size); + + return true; } static int nvme_add_pm_capability(PCIDevice *pci_dev, uint8_t offset) @@ -8155,6 +8161,12 @@ static bool nvme_init_pci(NvmeCtrl *n, PCIDevice *pci_dev, Error **errp) return false; } + if (!pci_is_vf(pci_dev) && n->params.sriov_max_vfs && + !nvme_init_sriov(n, pci_dev, 0x120, errp)) { + msix_uninit(pci_dev, &n->bar0, &n->bar0); + return false; + } + nvme_update_msixcap_ts(pci_dev, n->conf_msix_qsize); if (n->params.cmb_size_mb) { @@ -8165,10 +8177,6 @@ static bool nvme_init_pci(NvmeCtrl *n, PCIDevice *pci_dev, Error **errp) nvme_init_pmr(n, pci_dev); } - if (!pci_is_vf(pci_dev) && n->params.sriov_max_vfs) { - nvme_init_sriov(n, pci_dev, 0x120); - } - return true; } diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index 499becd527..f0bde0d3fc 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -24,14 +24,27 @@ static PCIDevice *register_vf(PCIDevice *pf, int devfn, const char *name, uint16_t vf_num); static void unregister_vfs(PCIDevice *dev); -void pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, +bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, const char *vfname, uint16_t vf_dev_id, uint16_t init_vfs, uint16_t total_vfs, - uint16_t vf_offset, uint16_t vf_stride) + uint16_t vf_offset, uint16_t vf_stride, + Error **errp) { uint8_t *cfg = dev->config + offset; uint8_t *wmask; + if (total_vfs) { + uint16_t ari_cap = pcie_find_capability(dev, PCI_EXT_CAP_ID_ARI); + uint16_t first_vf_devfn = dev->devfn + vf_offset; + uint16_t last_vf_devfn = first_vf_devfn + vf_stride * (total_vfs - 1); + + if ((!ari_cap && PCI_SLOT(dev->devfn) != PCI_SLOT(last_vf_devfn)) || + last_vf_devfn >= PCI_DEVFN_MAX) { + error_setg(errp, "VF function number overflows"); + return false; + } + } + pcie_add_capability(dev, PCI_EXT_CAP_ID_SRIOV, 1, offset, PCI_EXT_CAP_SRIOV_SIZEOF); dev->exp.sriov_cap = offset; @@ -69,6 +82,8 @@ void pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, pci_set_word(wmask + PCI_SRIOV_SYS_PGSIZE, 0x553); qdev_prop_set_bit(&dev->qdev, "multifunction", true); + + return true; } void pcie_sriov_pf_exit(PCIDevice *dev) From patchwork Tue Jul 2 14:11:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719745 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9EA0FC30658 for ; Tue, 2 Jul 2024 14:13:12 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeEU-0007oW-17; Tue, 02 Jul 2024 10:11: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 1sOeEN-0006s6-NI for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:39 -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 1sOeEK-0000cd-R3 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929494; 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=L4UFSErF8Ci7X9ojGTRrl+PVA8jTE90RlPCAhdXfrho=; b=TZ/u/mj0j3nXPFPC5B2pwRHg1+abOJCNxvm9ooLCUTvF/LbvpILprvIT1C6gYP8Oyx97G2 sE3oY3dLPu5Sb7YqfND2xPJlGIwStbqa8N/KX2Qekozq9MA4QBxksudtJ9RNv3K73HKI+/ Xx5v+55Oxarzda6itVmLLPB5yyzdxVc= 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-663-amKuVEL6Nx2zsH5pkuHHpA-1; Tue, 02 Jul 2024 10:11:33 -0400 X-MC-Unique: amKuVEL6Nx2zsH5pkuHHpA-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-36279cf642cso2160454f8f.3 for ; Tue, 02 Jul 2024 07:11:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929491; x=1720534291; 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=L4UFSErF8Ci7X9ojGTRrl+PVA8jTE90RlPCAhdXfrho=; b=Vq9dZQgEAknR/KrXMKFSsmVbM/Xq7JMyX1Ez//PhGiU5DZnlg6H/SRsLKZrcEpClHs xSRVNmcq2Zr1hKrSRJglyaX8gJsrd/uy6LsfmOSY1ugOX2WATm4vbtXcwnBReFgXTNwF 6LUyQaAGRc6F4D8oiVyDAQNm74tF23TdeN8NsmT+mkWyVPNWPQNHolIYPJTajTgWj8wq M6jcEJ1S6/bCtsNmY9cHTncHkmB1E7TIm0LPnuYEsvfmm8AR9ogI8nTXh/hRYg7Hno0K mKmZq/ZRRB+U/RTbUHmsGShVcpxDwluib5/YGvH0ha2zsd7knDehqFgRf6QhB3YI34PD grMQ== X-Gm-Message-State: AOJu0YydeYCWUt1cZJU7Dnp5Kl6pszlq4jsHUv2K58OQ7YW7FEvneM3f 9kHsdeMVN89uISl7CYqcV04aK3ji7/kCP1BPsvozQYE67xjdisA93ExkDHoJ+NnfF6ILK9marZi hhxYDDSTxZ4qo/zI0nvg1SxaStLzmaSG1Dxjaz6ScaJMwBa4px1xEfnTeO8P2Gc0v34Fc9tNj1h PNNvqfuIBPnkaaIyTvNn8JaCFa+HdcUg== X-Received: by 2002:a5d:66c8:0:b0:367:8c22:5b7a with SMTP id ffacd0b85a97d-3678c22645emr792832f8f.22.1719929491514; Tue, 02 Jul 2024 07:11:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IExwerySZhpZP1ol3VxszbAhnZjfdNlALrYLM4q7bRC5+L41CCLzNMf3/3YApsSrTz8H6xTVA== X-Received: by 2002:a5d:66c8:0:b0:367:8c22:5b7a with SMTP id ffacd0b85a97d-3678c22645emr792806f8f.22.1719929490842; Tue, 02 Jul 2024 07:11:30 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-367898c64c1sm1693896f8f.23.2024.07.02.07.11.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:11:30 -0700 (PDT) Date: Tue, 2 Jul 2024 10:11:27 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Akihiko Odaki , Marcel Apfelbaum Subject: [PULL 87/91] pcie_sriov: Reuse SR-IOV VF device instances Message-ID: <9a9243d0cfb5d28b1978b328888bad0edcb5fb10.1719929191.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Akihiko Odaki Disable SR-IOV VF devices by reusing code to power down PCI devices instead of removing them when the guest requests to disable VFs. This allows to realize devices and report VF realization errors at PF realization time. Signed-off-by: Akihiko Odaki Message-Id: <20240627-reuse-v10-6-7ca0b8ed3d9f@daynix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/pci/pci.h | 5 -- include/hw/pci/pci_device.h | 15 ++++++ include/hw/pci/pcie_sriov.h | 1 - hw/pci/pci.c | 2 +- hw/pci/pcie_sriov.c | 95 ++++++++++++++++--------------------- 5 files changed, 56 insertions(+), 62 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index fe04b4fafd..14a869eeaa 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -680,9 +680,4 @@ static inline void pci_irq_pulse(PCIDevice *pci_dev) MSIMessage pci_get_msi_message(PCIDevice *dev, int vector); void pci_set_enabled(PCIDevice *pci_dev, bool state); -static inline void pci_set_power(PCIDevice *pci_dev, bool state) -{ - pci_set_enabled(pci_dev, state); -} - #endif diff --git a/include/hw/pci/pci_device.h b/include/hw/pci/pci_device.h index d57f9ce838..ca15132508 100644 --- a/include/hw/pci/pci_device.h +++ b/include/hw/pci/pci_device.h @@ -205,6 +205,21 @@ static inline uint16_t pci_get_bdf(PCIDevice *dev) return PCI_BUILD_BDF(pci_bus_num(pci_get_bus(dev)), dev->devfn); } +static inline void pci_set_power(PCIDevice *pci_dev, bool state) +{ + /* + * Don't change the enabled state of VFs when powering on/off the device. + * + * When powering on, VFs must not be enabled immediately but they must + * wait until the guest configures SR-IOV. + * When powering off, their corresponding PFs will be reset and disable + * VFs. + */ + if (!pci_is_vf(pci_dev)) { + pci_set_enabled(pci_dev, state); + } +} + uint16_t pci_requester_id(PCIDevice *dev); /* DMA access functions */ diff --git a/include/hw/pci/pcie_sriov.h b/include/hw/pci/pcie_sriov.h index aa704e8f9d..70649236c1 100644 --- a/include/hw/pci/pcie_sriov.h +++ b/include/hw/pci/pcie_sriov.h @@ -18,7 +18,6 @@ typedef struct PCIESriovPF { uint16_t num_vfs; /* Number of virtual functions created */ uint8_t vf_bar_type[PCI_NUM_REGIONS]; /* Store type for each VF bar */ - const char *vfname; /* Reference to the device type used for the VFs */ PCIDevice **vf; /* Pointer to an array of num_vfs VF devices */ } PCIESriovPF; diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 68d30feb86..e32a69f3fa 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2895,7 +2895,7 @@ void pci_set_enabled(PCIDevice *d, bool state) memory_region_set_enabled(&d->bus_master_enable_region, (pci_get_word(d->config + PCI_COMMAND) & PCI_COMMAND_MASTER) && d->enabled); - if (!d->enabled) { + if (d->qdev.realized) { pci_device_reset(d); } } diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index f0bde0d3fc..faadb0d2ea 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -20,9 +20,16 @@ #include "qapi/error.h" #include "trace.h" -static PCIDevice *register_vf(PCIDevice *pf, int devfn, - const char *name, uint16_t vf_num); -static void unregister_vfs(PCIDevice *dev); +static void unparent_vfs(PCIDevice *dev, uint16_t total_vfs) +{ + for (uint16_t i = 0; i < total_vfs; i++) { + PCIDevice *vf = dev->exp.sriov_pf.vf[i]; + object_unparent(OBJECT(vf)); + object_unref(OBJECT(vf)); + } + g_free(dev->exp.sriov_pf.vf); + dev->exp.sriov_pf.vf = NULL; +} bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, const char *vfname, uint16_t vf_dev_id, @@ -30,6 +37,8 @@ bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, uint16_t vf_offset, uint16_t vf_stride, Error **errp) { + BusState *bus = qdev_get_parent_bus(&dev->qdev); + int32_t devfn = dev->devfn + vf_offset; uint8_t *cfg = dev->config + offset; uint8_t *wmask; @@ -49,7 +58,6 @@ bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, offset, PCI_EXT_CAP_SRIOV_SIZEOF); dev->exp.sriov_cap = offset; dev->exp.sriov_pf.num_vfs = 0; - dev->exp.sriov_pf.vfname = g_strdup(vfname); dev->exp.sriov_pf.vf = NULL; pci_set_word(cfg + PCI_SRIOV_VF_OFFSET, vf_offset); @@ -83,14 +91,34 @@ bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, qdev_prop_set_bit(&dev->qdev, "multifunction", true); + dev->exp.sriov_pf.vf = g_new(PCIDevice *, total_vfs); + + for (uint16_t i = 0; i < total_vfs; i++) { + PCIDevice *vf = pci_new(devfn, vfname); + vf->exp.sriov_vf.pf = dev; + vf->exp.sriov_vf.vf_number = i; + + if (!qdev_realize(&vf->qdev, bus, errp)) { + unparent_vfs(dev, i); + return false; + } + + /* set vid/did according to sr/iov spec - they are not used */ + pci_config_set_vendor_id(vf->config, 0xffff); + pci_config_set_device_id(vf->config, 0xffff); + + dev->exp.sriov_pf.vf[i] = vf; + devfn += vf_stride; + } + return true; } void pcie_sriov_pf_exit(PCIDevice *dev) { - unregister_vfs(dev); - g_free((char *)dev->exp.sriov_pf.vfname); - dev->exp.sriov_pf.vfname = NULL; + uint8_t *cfg = dev->config + dev->exp.sriov_cap; + + unparent_vfs(dev, pci_get_word(cfg + PCI_SRIOV_TOTAL_VF)); } void pcie_sriov_pf_init_vf_bar(PCIDevice *dev, int region_num, @@ -156,38 +184,11 @@ void pcie_sriov_vf_register_bar(PCIDevice *dev, int region_num, } } -static PCIDevice *register_vf(PCIDevice *pf, int devfn, const char *name, - uint16_t vf_num) -{ - PCIDevice *dev = pci_new(devfn, name); - dev->exp.sriov_vf.pf = pf; - dev->exp.sriov_vf.vf_number = vf_num; - PCIBus *bus = pci_get_bus(pf); - Error *local_err = NULL; - - qdev_realize(&dev->qdev, &bus->qbus, &local_err); - if (local_err) { - error_report_err(local_err); - return NULL; - } - - /* set vid/did according to sr/iov spec - they are not used */ - pci_config_set_vendor_id(dev->config, 0xffff); - pci_config_set_device_id(dev->config, 0xffff); - - return dev; -} - static void register_vfs(PCIDevice *dev) { uint16_t num_vfs; uint16_t i; uint16_t sriov_cap = dev->exp.sriov_cap; - uint16_t vf_offset = - pci_get_word(dev->config + sriov_cap + PCI_SRIOV_VF_OFFSET); - uint16_t vf_stride = - pci_get_word(dev->config + sriov_cap + PCI_SRIOV_VF_STRIDE); - int32_t devfn = dev->devfn + vf_offset; assert(sriov_cap > 0); num_vfs = pci_get_word(dev->config + sriov_cap + PCI_SRIOV_NUM_VF); @@ -195,18 +196,10 @@ static void register_vfs(PCIDevice *dev) return; } - dev->exp.sriov_pf.vf = g_new(PCIDevice *, num_vfs); - trace_sriov_register_vfs(dev->name, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), num_vfs); for (i = 0; i < num_vfs; i++) { - dev->exp.sriov_pf.vf[i] = register_vf(dev, devfn, - dev->exp.sriov_pf.vfname, i); - if (!dev->exp.sriov_pf.vf[i]) { - num_vfs = i; - break; - } - devfn += vf_stride; + pci_set_enabled(dev->exp.sriov_pf.vf[i], true); } dev->exp.sriov_pf.num_vfs = num_vfs; } @@ -219,12 +212,8 @@ static void unregister_vfs(PCIDevice *dev) trace_sriov_unregister_vfs(dev->name, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), num_vfs); for (i = 0; i < num_vfs; i++) { - PCIDevice *vf = dev->exp.sriov_pf.vf[i]; - object_unparent(OBJECT(vf)); - object_unref(OBJECT(vf)); + pci_set_enabled(dev->exp.sriov_pf.vf[i], false); } - g_free(dev->exp.sriov_pf.vf); - dev->exp.sriov_pf.vf = NULL; dev->exp.sriov_pf.num_vfs = 0; } @@ -246,14 +235,10 @@ void pcie_sriov_config_write(PCIDevice *dev, uint32_t address, PCI_FUNC(dev->devfn), off, val, len); if (range_covers_byte(off, len, PCI_SRIOV_CTRL)) { - if (dev->exp.sriov_pf.num_vfs) { - if (!(val & PCI_SRIOV_CTRL_VFE)) { - unregister_vfs(dev); - } + if (val & PCI_SRIOV_CTRL_VFE) { + register_vfs(dev); } else { - if (val & PCI_SRIOV_CTRL_VFE) { - register_vfs(dev); - } + unregister_vfs(dev); } } } From patchwork Tue Jul 2 14:11:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719753 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F293C30658 for ; Tue, 2 Jul 2024 14:14:37 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeES-0007d0-Mu; Tue, 02 Jul 2024 10:11: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 1sOeEN-0006pG-Eo for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:39 -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 1sOeEL-0000kM-Dz for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929496; 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=fFIfkLYWXfsdkRs/ADDmSifhmh+YyxsrJ8fplItaj14=; b=Z38KRAQuQQPMCPzvi8rP9btZC5VljfTUepDSetgo7g1zXdsk8gFJ7oizNYYgZFZ0YhmvRJ Swr4KEpmBqOzbyl7qEF21jiNfGW1SgHIS2w8x8OCgHkHzrD82i7sknqmp3d+PoPtc8oTOS xSXlOINoRSh3ZR0LC+PxiIMW9PFp0cM= 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-558-mmDdIWY6ME6bo80ERQjblg-1; Tue, 02 Jul 2024 10:11:35 -0400 X-MC-Unique: mmDdIWY6ME6bo80ERQjblg-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4257a75193aso19249435e9.1 for ; Tue, 02 Jul 2024 07:11:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929494; x=1720534294; 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=fFIfkLYWXfsdkRs/ADDmSifhmh+YyxsrJ8fplItaj14=; b=WbaSI7y3XL9v//fVnYDXeXiv/jsrkH45v8A32j5EXFeNRAiLnj/GBGTM2xHgsL7oPg thrDFb1d/5ZdMBnFguRUQcQIT9EeTo2PmZbtycPrLP0dNA1rV/vKKV3qWBjCqB8YEzZV O3tvaAscxv9tHcWNpbSSUlMKhebQ87Zx/A5Nqt/EbMkWr7gx1tvXg1S2IglYx70PZgfS iwGb8fyNYzOyGszfUB11lAb41tL5CQLmTh2KiL7jpD7o0UJRHhKQ0teuBOzx46S992J+ 9XuDQkKoMHdPFMoFKv2kHZ9h+mit3VsTL6Bf17tUy9D9wJUJSjUbLSrI2rl+7CQXp6cM f75Q== X-Gm-Message-State: AOJu0YzrfbJy4KWDRauG/PQEq5ZkwWnq1aCYg7Stkj+hRiUq+Lg2ZWk8 0zQADgWyeWF8+gOaRDwSMAfh0mgUn9Ej53UX/ocNPUasj7xF3Rj1audxiobQkUSV+0gBEDaFVrG ccha7IZhWk2yE7A2KqaVicaDnAH5ZmFzMTRI6QYoXPb/9PuvUwy7yc22uR0SaC5LABeTIcMSo7P IwiDMtGJYKCEpBngJ5ooA5GSsw46RxQQ== X-Received: by 2002:a5d:56c5:0:b0:360:81f8:698 with SMTP id ffacd0b85a97d-367757296demr5085099f8f.58.1719929494073; Tue, 02 Jul 2024 07:11:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHkigKak7HA1EhoF1ixzVyZ/5HuRrU8zK7z8MiVLW72Qh+BOcJh/KRn6KERZXUDa6vfCrLa2Q== X-Received: by 2002:a5d:56c5:0:b0:360:81f8:698 with SMTP id ffacd0b85a97d-367757296demr5085078f8f.58.1719929493545; Tue, 02 Jul 2024 07:11:33 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a1030dfsm13289261f8f.100.2024.07.02.07.11.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:11:33 -0700 (PDT) Date: Tue, 2 Jul 2024 10:11:31 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Akihiko Odaki , Marcel Apfelbaum Subject: [PULL 88/91] pcie_sriov: Release VFs failed to 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.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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Akihiko Odaki Release VFs failed to realize just as we do in unregister_vfs(). Fixes: 7c0fa8dff811 ("pcie: Add support for Single Root I/O Virtualization (SR/IOV)") Signed-off-by: Akihiko Odaki Message-Id: <20240627-reuse-v10-7-7ca0b8ed3d9f@daynix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci/pcie_sriov.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index faadb0d2ea..9bd7f8acc3 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -99,6 +99,8 @@ bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, vf->exp.sriov_vf.vf_number = i; if (!qdev_realize(&vf->qdev, bus, errp)) { + object_unparent(OBJECT(vf)); + object_unref(vf); unparent_vfs(dev, i); return false; } From patchwork Tue Jul 2 14:11:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719777 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E33E8C3065C for ; Tue, 2 Jul 2024 14:19:52 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeEl-0001BO-2G; Tue, 02 Jul 2024 10:12:03 -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 1sOeEi-0000vc-5h for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:12:00 -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 1sOeES-000161-Js for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929503; 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=7pMoBjPNl8oUEg5zlwInizxqA4Nbo5A/7NGMCDnRaVI=; b=IGfhsfr7DbegstpGF+4AazIPZmWfB2FjcRedkONW2c4BWfvVlD20/JwrlawzAoA12EaEQU vmxvOSpS2Fh9aojXohbI4ekOyCrOUFIplVfrFDtqrGtCnyLZkN4JYWs4OWs9NqLQgopDhp 2GO9eKS4WyOxSA8Wq/YU65QJNW17jn8= 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-460-RfHDw3LzOXivKUezinyriw-1; Tue, 02 Jul 2024 10:11:39 -0400 X-MC-Unique: RfHDw3LzOXivKUezinyriw-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4257db9d71fso16896985e9.2 for ; Tue, 02 Jul 2024 07:11:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929497; x=1720534297; 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=7pMoBjPNl8oUEg5zlwInizxqA4Nbo5A/7NGMCDnRaVI=; b=mjXE2eB775RCvKYdGTAROxnpP5nkAgcj+ovMS3XGyjI7cyE9cX5bIwmfNAMZRt3u4H pk9iSak5/eP+Ibpmku4EehH3WIO4xR0Sq5oLfpiA6EJX5UZbqKTrClUQCwUXEdpdcul3 j3vosJfutWIxKa6BFi5QhFmcHXPIDijhzxv37KzurjCdUipE8PmTe07gtdMP7stf7cc7 JH8e70W8P2OX6mpRQAIm2GSdhutuXjG4Gl8jd8NktVJHOaKnN8jpZC3qXrSCbGle2uez k+AjkJiAjy/rrT8y6UcmvAqwY0imL90f7imBWpZOfJLP7FTMjuvm1YlPiPJQDBCUTezm gEUw== X-Gm-Message-State: AOJu0YyBOb9CI7jIqxdSimUi+5mhXUH2kfGbGgaslnqYeMyfeNjScv7q KDHOFayKKpxnnzztFQT0Ache+3SzUgnM8B/1rSYDyfxPf/o0q0/3bHds5dRdw3ozQzhMucloiPj 7UjcHdPtwbWAP+xgD7a5Huh+43Wgzdx8tifzJolXhjDPRzJclrm5BL62aWH0OgSr/aIq+zqcnVb t6yHFaqxQT6fvm3HJ3517oBdmUG81dig== X-Received: by 2002:a05:600c:4fc5:b0:425:73a8:2fa3 with SMTP id 5b1f17b1804b1-4257a04fe4emr52593235e9.30.1719929497638; Tue, 02 Jul 2024 07:11:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGbppqAY4yFRHz3xxAanAETUBxCuOyKH406RquA2nRbW4xIm506aXVMuxJMxO5n6hXq/PS8jg== X-Received: by 2002:a05:600c:4fc5:b0:425:73a8:2fa3 with SMTP id 5b1f17b1804b1-4257a04fe4emr52592985e9.30.1719929497082; Tue, 02 Jul 2024 07:11:37 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0cd66fsm13543766f8f.8.2024.07.02.07.11.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:11:36 -0700 (PDT) Date: Tue, 2 Jul 2024 10:11:33 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Akihiko Odaki , Marcel Apfelbaum Subject: [PULL 89/91] pcie_sriov: Remove num_vfs from PCIESriovPF Message-ID: <09379acf8955487df1e48a1ab37ae774d9e791c5.1719929191.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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Akihiko Odaki num_vfs is not migrated so use PCI_SRIOV_CTRL_VFE and PCI_SRIOV_NUM_VF instead. Signed-off-by: Akihiko Odaki Message-Id: <20240627-reuse-v10-8-7ca0b8ed3d9f@daynix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/pci/pcie_sriov.h | 1 - hw/pci/pcie_sriov.c | 28 ++++++++++++++++++++-------- hw/pci/trace-events | 2 +- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/include/hw/pci/pcie_sriov.h b/include/hw/pci/pcie_sriov.h index 70649236c1..5148c5b77d 100644 --- a/include/hw/pci/pcie_sriov.h +++ b/include/hw/pci/pcie_sriov.h @@ -16,7 +16,6 @@ #include "hw/pci/pci.h" typedef struct PCIESriovPF { - uint16_t num_vfs; /* Number of virtual functions created */ uint8_t vf_bar_type[PCI_NUM_REGIONS]; /* Store type for each VF bar */ PCIDevice **vf; /* Pointer to an array of num_vfs VF devices */ } PCIESriovPF; diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index 9bd7f8acc3..fae6acea4a 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -57,7 +57,6 @@ bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, pcie_add_capability(dev, PCI_EXT_CAP_ID_SRIOV, 1, offset, PCI_EXT_CAP_SRIOV_SIZEOF); dev->exp.sriov_cap = offset; - dev->exp.sriov_pf.num_vfs = 0; dev->exp.sriov_pf.vf = NULL; pci_set_word(cfg + PCI_SRIOV_VF_OFFSET, vf_offset); @@ -186,6 +185,12 @@ void pcie_sriov_vf_register_bar(PCIDevice *dev, int region_num, } } +static void clear_ctrl_vfe(PCIDevice *dev) +{ + uint8_t *ctrl = dev->config + dev->exp.sriov_cap + PCI_SRIOV_CTRL; + pci_set_word(ctrl, pci_get_word(ctrl) & ~PCI_SRIOV_CTRL_VFE); +} + static void register_vfs(PCIDevice *dev) { uint16_t num_vfs; @@ -195,6 +200,7 @@ static void register_vfs(PCIDevice *dev) assert(sriov_cap > 0); num_vfs = pci_get_word(dev->config + sriov_cap + PCI_SRIOV_NUM_VF); if (num_vfs > pci_get_word(dev->config + sriov_cap + PCI_SRIOV_TOTAL_VF)) { + clear_ctrl_vfe(dev); return; } @@ -203,20 +209,18 @@ static void register_vfs(PCIDevice *dev) for (i = 0; i < num_vfs; i++) { pci_set_enabled(dev->exp.sriov_pf.vf[i], true); } - dev->exp.sriov_pf.num_vfs = num_vfs; } static void unregister_vfs(PCIDevice *dev) { - uint16_t num_vfs = dev->exp.sriov_pf.num_vfs; uint16_t i; + uint8_t *cfg = dev->config + dev->exp.sriov_cap; trace_sriov_unregister_vfs(dev->name, PCI_SLOT(dev->devfn), - PCI_FUNC(dev->devfn), num_vfs); - for (i = 0; i < num_vfs; i++) { + PCI_FUNC(dev->devfn)); + for (i = 0; i < pci_get_word(cfg + PCI_SRIOV_TOTAL_VF); i++) { pci_set_enabled(dev->exp.sriov_pf.vf[i], false); } - dev->exp.sriov_pf.num_vfs = 0; } void pcie_sriov_config_write(PCIDevice *dev, uint32_t address, @@ -242,6 +246,9 @@ void pcie_sriov_config_write(PCIDevice *dev, uint32_t address, } else { unregister_vfs(dev); } + } else if (range_covers_byte(off, len, PCI_SRIOV_NUM_VF)) { + clear_ctrl_vfe(dev); + unregister_vfs(dev); } } @@ -304,7 +311,7 @@ PCIDevice *pcie_sriov_get_pf(PCIDevice *dev) PCIDevice *pcie_sriov_get_vf_at_index(PCIDevice *dev, int n) { assert(!pci_is_vf(dev)); - if (n < dev->exp.sriov_pf.num_vfs) { + if (n < pcie_sriov_num_vfs(dev)) { return dev->exp.sriov_pf.vf[n]; } return NULL; @@ -312,5 +319,10 @@ PCIDevice *pcie_sriov_get_vf_at_index(PCIDevice *dev, int n) uint16_t pcie_sriov_num_vfs(PCIDevice *dev) { - return dev->exp.sriov_pf.num_vfs; + uint16_t sriov_cap = dev->exp.sriov_cap; + uint8_t *cfg = dev->config + sriov_cap; + + return sriov_cap && + (pci_get_word(cfg + PCI_SRIOV_CTRL) & PCI_SRIOV_CTRL_VFE) ? + pci_get_word(cfg + PCI_SRIOV_NUM_VF) : 0; } diff --git a/hw/pci/trace-events b/hw/pci/trace-events index 19643aa8c6..e98f575a9d 100644 --- a/hw/pci/trace-events +++ b/hw/pci/trace-events @@ -14,7 +14,7 @@ msix_write_config(char *name, bool enabled, bool masked) "dev %s enabled %d mask # hw/pci/pcie_sriov.c sriov_register_vfs(const char *name, int slot, int function, int num_vfs) "%s %02x:%x: creating %d vf devs" -sriov_unregister_vfs(const char *name, int slot, int function, int num_vfs) "%s %02x:%x: Unregistering %d vf devs" +sriov_unregister_vfs(const char *name, int slot, int function) "%s %02x:%x: Unregistering vf devs" sriov_config_write(const char *name, int slot, int fun, uint32_t offset, uint32_t val, uint32_t len) "%s %02x:%x: sriov offset 0x%x val 0x%x len %d" # pcie.c From patchwork Tue Jul 2 14:11:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719794 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D3F41C3064D for ; Tue, 2 Jul 2024 14:23:09 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeEb-0008UQ-SW; Tue, 02 Jul 2024 10:11: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 1sOeEZ-0008NB-OD for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11: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 1sOeET-000166-06 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929504; 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=H7aKbBLrPfQyo8uVQsyzpZUHAgZT+25N0abSYuF1Pc4=; b=Y9YcmC2ah/Hj8+KpJGxBKp+N3Lr06vZapcXG6AcOTEYnuJw3xn1QnuFVtkVFRo1XHGSRpC Mb/qoTUJlgh54KLsvNlwg+dcpEZMFlTE5C7e4I7zBwnbfmMtco7R0hb5VjnhLXTQh1TMz0 ENSyNjP/OV+X9gv8RrP7aawQ4Gjz6Io= 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-133-2D-uLXTLOPmdAc_6wl1mhw-1; Tue, 02 Jul 2024 10:11:42 -0400 X-MC-Unique: 2D-uLXTLOPmdAc_6wl1mhw-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-3642cc54bbfso2565048f8f.0 for ; Tue, 02 Jul 2024 07:11:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929500; x=1720534300; 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=H7aKbBLrPfQyo8uVQsyzpZUHAgZT+25N0abSYuF1Pc4=; b=cZ3PzAjDB/TDECRxSpkEo1JloyqEqAWYiC9h7FYahZUK/n/uFAp692a5oQXtobUCLi wvkY5x45DCYKQcCLjb1KDCK81HYDUYB9Z4IdzsLC/ZGBvAw3ZTIn3s0IJpEEaWUrpZVH r7py7qjSDS3MsWb4pEnb1jMfKFvyiRvl2DwOjhdM88vDs1CG3IQd6cdPwjXrLCy2fByQ J8jKwteTcdTE8UGx7mDX10ypCc0iRvPuw5B2xRKY/QXE8CfH8CQHymI61BSJID2gqw4p CpAdqIc0UreN1NhSiMzr8rpyYtNs6oSk3dTCSquLbAq0ZenX4cVVskYP/RwReyM2IltH bAgA== X-Gm-Message-State: AOJu0Yz4NpDomb3S0F9b5Hf5563wYVb5ODW17Czz80NUIOcKJL/D1c4D wqbwdF4dAsBzYgZxxc66jcMTTg4nHbIAO/t2GR79sFLAK4AKrdUjHZgbqirOOT5ziLxs20sL4+6 4cXwcAJ8+Nj9N89GovSg1j3kfj+3r0RlIQBYigYFIr5CueLhOl4f6Uinr/DnaZnJNgQjJB/jZdS u+pvSutg/aftCksz6ewhpBTBX6Cjcm/w== X-Received: by 2002:a5d:470b:0:b0:366:efab:2fb1 with SMTP id ffacd0b85a97d-367756c0143mr5616184f8f.38.1719929500631; Tue, 02 Jul 2024 07:11:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGDhsBPrbd+prKf0adDwinBYTnA0MySGgPStU0vXDOCe6tBZ+UOxLHLkkjtazwY+/qD0hJP+g== X-Received: by 2002:a5d:470b:0:b0:366:efab:2fb1 with SMTP id ffacd0b85a97d-367756c0143mr5616165f8f.38.1719929500038; Tue, 02 Jul 2024 07:11:40 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0cd687sm13405124f8f.14.2024.07.02.07.11.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:11:39 -0700 (PDT) Date: Tue, 2 Jul 2024 10:11:37 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Akihiko Odaki , Marcel Apfelbaum Subject: [PULL 90/91] pcie_sriov: Register VFs after migration Message-ID: <525d3951082842984945c8baff5b447279565fca.1719929191.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Akihiko Odaki pcie_sriov doesn't have code to restore its state after migration, but igb, which uses pcie_sriov, naively claimed its migration capability. Add code to register VFs after migration and fix igb migration. Fixes: 3a977deebe6b ("Intrdocue igb device emulation") Signed-off-by: Akihiko Odaki Message-Id: <20240627-reuse-v10-9-7ca0b8ed3d9f@daynix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/pci/pcie_sriov.h | 2 ++ hw/pci/pci.c | 7 +++++++ hw/pci/pcie_sriov.c | 7 +++++++ 3 files changed, 16 insertions(+) diff --git a/include/hw/pci/pcie_sriov.h b/include/hw/pci/pcie_sriov.h index 5148c5b77d..c5d2d318d3 100644 --- a/include/hw/pci/pcie_sriov.h +++ b/include/hw/pci/pcie_sriov.h @@ -57,6 +57,8 @@ void pcie_sriov_pf_add_sup_pgsize(PCIDevice *dev, uint16_t opt_sup_pgsize); void pcie_sriov_config_write(PCIDevice *dev, uint32_t address, uint32_t val, int len); +void pcie_sriov_pf_post_load(PCIDevice *dev); + /* Reset SR/IOV */ void pcie_sriov_pf_reset(PCIDevice *dev); diff --git a/hw/pci/pci.c b/hw/pci/pci.c index e32a69f3fa..fa85f87b1c 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -733,10 +733,17 @@ static bool migrate_is_not_pcie(void *opaque, int version_id) return !pci_is_express((PCIDevice *)opaque); } +static int pci_post_load(void *opaque, int version_id) +{ + pcie_sriov_pf_post_load(opaque); + return 0; +} + const VMStateDescription vmstate_pci_device = { .name = "PCIDevice", .version_id = 2, .minimum_version_id = 1, + .post_load = pci_post_load, .fields = (const VMStateField[]) { VMSTATE_INT32_POSITIVE_LE(version_id, PCIDevice), VMSTATE_BUFFER_UNSAFE_INFO_TEST(config, PCIDevice, diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index fae6acea4a..56523ab4e8 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -252,6 +252,13 @@ void pcie_sriov_config_write(PCIDevice *dev, uint32_t address, } } +void pcie_sriov_pf_post_load(PCIDevice *dev) +{ + if (dev->exp.sriov_cap) { + register_vfs(dev); + } +} + /* Reset SR/IOV */ void pcie_sriov_pf_reset(PCIDevice *dev) From patchwork Tue Jul 2 14:11:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13719761 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8F360C3064D for ; Tue, 2 Jul 2024 14:17:51 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOeEh-0000is-5j; Tue, 02 Jul 2024 10:11:59 -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 1sOeEe-0000KJ-3F for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11: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 1sOeEW-00016r-DG for qemu-devel@nongnu.org; Tue, 02 Jul 2024 10:11:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719929507; 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=bN0cTm8m+n/A4V5Tgbpm0TUAfWebEt6LcyWQbTcpz4g=; b=HWoTbjCoAMeyc5SVp8lpry52HFIurU/P8MaRgInvYe8PqRmXqH525ccjzkkmBtdI1YQCD9 a3zpfOzNx9SZ6oVnhaB6cbR/Oe1BlcPa8j0Jj/OMSskKC+FLC41yrMW1LAVO4Vbw4J9AEK GzZXtLU/MmHISIu6EUARPOB4OUSeoU4= 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-20-z9VTgEQgO5m9JpyaJg50Ug-1; Tue, 02 Jul 2024 10:11:45 -0400 X-MC-Unique: z9VTgEQgO5m9JpyaJg50Ug-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4257a75193aso19250555e9.1 for ; Tue, 02 Jul 2024 07:11:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719929504; x=1720534304; 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=bN0cTm8m+n/A4V5Tgbpm0TUAfWebEt6LcyWQbTcpz4g=; b=ihU4cNmjvDSe8WBsd6eF/2IBC492KFA2oIIgRKFY7XAiBOySnJzEmCjjvhm2MO2EF6 bfjTu6C6r1SMmXiNE7ZWOvRk804q4hOfCpj3n2oLlnudXpG3M4kaWJj+43ZZg+V3xP+7 ZvmqwFj75tO4Ry4s9d8EWLPDaCi3YVAXXkOjD8mF9l5tYWVkmc5NNOpeIU8/olNUbkJ5 wlb0NbmRP0qh1bCDehDxzFLFOtdxGW85FrvXI1WCNr4eS3yCqINRJ+DuRPHMKfmv4VSb nK197LYSXUxPuafA5cq0YM0TBGSncvwPyUaNGBRa0bf17WK1Oo2yhtBS0u/m7y0TcRiW O9ow== X-Gm-Message-State: AOJu0YwomhCROTt9nuS+nJLL9Urq/mG10jYGsCvrgMMlbEkNr/wAzguK 0p2AYc6YNnlEyeYpx2LA3x76SbXpD+HLxH44Po1qlCqtVPRVWXKqUIbjg2r56yN/4U40Chbh+hi 53r3o+z2ybgfYh0kV9tIJJ/Cxvv6cIsR6ETpA4MNjUOw2M66NH7EckaDVH1bcNzpab6Qwbz/qaE FxnDUVtSl0zDLhW92Nd3T78t5ZQJEHyg== X-Received: by 2002:a05:600c:47cf:b0:425:7c18:df9f with SMTP id 5b1f17b1804b1-4257c18e0dfmr38909175e9.40.1719929503731; Tue, 02 Jul 2024 07:11:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEF+bg8BPn83l1dihyVUeV27Pe6P0ZNHE/VD3ClUbZT2uoj6UcFuruOQIL6CEMxWRsrxnjA+g== X-Received: by 2002:a05:600c:47cf:b0:425:7c18:df9f with SMTP id 5b1f17b1804b1-4257c18e0dfmr38908905e9.40.1719929503038; Tue, 02 Jul 2024 07:11:43 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b061006sm197706495e9.22.2024.07.02.07.11.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 07:11:42 -0700 (PDT) Date: Tue, 2 Jul 2024 10:11:40 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Akihiko Odaki , Markus Armbruster , Marcel Apfelbaum , Stefano Stabellini , Anthony PERARD , Paul Durrant , xen-devel@lists.xenproject.org Subject: [PULL 91/91] hw/pci: Replace -1 with UINT32_MAX for romsize 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Akihiko Odaki romsize is an uint32_t variable. Specifying -1 as an uint32_t value is obscure way to denote UINT32_MAX. Worse, if int is wider than 32-bit, it will change the behavior of a construct like the following: romsize = -1; if (romsize != -1) { ... } When -1 is assigned to romsize, -1 will be implicitly casted into uint32_t, resulting in UINT32_MAX. On contrary, when evaluating romsize != -1, romsize will be casted into int, and it will be a comparison of UINT32_MAX and -1, and result in false. Replace -1 with UINT32_MAX for statements involving the variable to clarify the intent and prevent potential breakage. Signed-off-by: Akihiko Odaki Reviewed-by: Markus Armbruster Message-Id: <20240627-reuse-v10-10-7ca0b8ed3d9f@daynix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci/pci.c | 8 ++++---- hw/xen/xen_pt_load_rom.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index fa85f87b1c..4c7be52951 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -70,7 +70,7 @@ static bool pcie_has_upstream_port(PCIDevice *dev); static Property pci_props[] = { DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1), DEFINE_PROP_STRING("romfile", PCIDevice, romfile), - DEFINE_PROP_UINT32("romsize", PCIDevice, romsize, -1), + DEFINE_PROP_UINT32("romsize", PCIDevice, romsize, UINT32_MAX), DEFINE_PROP_UINT32("rombar", PCIDevice, rom_bar, 1), DEFINE_PROP_BIT("multifunction", PCIDevice, cap_present, QEMU_PCI_CAP_MULTIFUNCTION_BITNR, false), @@ -2073,7 +2073,7 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp) g_cmp_uint32, NULL); } - if (pci_dev->romsize != -1 && !is_power_of_2(pci_dev->romsize)) { + if (pci_dev->romsize != UINT32_MAX && !is_power_of_2(pci_dev->romsize)) { error_setg(errp, "ROM size %u is not a power of two", pci_dev->romsize); return; } @@ -2359,7 +2359,7 @@ static void pci_add_option_rom(PCIDevice *pdev, bool is_default_rom, return; } - if (load_file || pdev->romsize == -1) { + if (load_file || pdev->romsize == UINT32_MAX) { path = qemu_find_file(QEMU_FILE_TYPE_BIOS, pdev->romfile); if (path == NULL) { path = g_strdup(pdev->romfile); @@ -2378,7 +2378,7 @@ static void pci_add_option_rom(PCIDevice *pdev, bool is_default_rom, pdev->romfile); return; } - if (pdev->romsize != -1) { + if (pdev->romsize != UINT_MAX) { if (size > pdev->romsize) { error_setg(errp, "romfile \"%s\" (%u bytes) " "is too large for ROM size %u", diff --git a/hw/xen/xen_pt_load_rom.c b/hw/xen/xen_pt_load_rom.c index 03422a8a71..6bc64acd33 100644 --- a/hw/xen/xen_pt_load_rom.c +++ b/hw/xen/xen_pt_load_rom.c @@ -53,7 +53,7 @@ void *pci_assign_dev_load_option_rom(PCIDevice *dev, } fseek(fp, 0, SEEK_SET); - if (dev->romsize != -1) { + if (dev->romsize != UINT_MAX) { if (st.st_size > dev->romsize) { error_report("ROM BAR \"%s\" (%ld bytes) is too large for ROM size %u", rom_file, (long) st.st_size, dev->romsize);