From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684507815; cv=none; d=zohomail.com; s=zohoarc; b=Om8pz64fAI9QqtVUhf5RclffR6KfqIusjFb/hoxlivxBg83/GKGKlVjEHPwjfyjpd8Sg2JWGKemV2oAwH/GIltgse9cYQwEZ6jCgDFIUjqLyME9H01jEIfyXpfL+zGlnw8LRjVQgGImRvMkL8XuYYGoMW0YM02jY6Gi2XqnH5IA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684507815; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=m8H3lZKDwI3mjSVXnoAagyvh6l6UiwvzrfJKVsJ59EM=; b=HgXKSBB2G8lWPGAO+GfWIi6aRMe5whEOIR1Jtb9T0V/S7ENT0gEiaZG+F7cFcRUffot1fNSxgNe+GpctLxUJSXgCr3iC8iD8VzGDU4OsZQWabArzSNbxXx0BlnZe7vdI3+Rhh4+lueoBnwyweqj/JSw9kG0U6nZl6yY6jmtabAw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684507815617947.4372873783939; Fri, 19 May 2023 07:50:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01QU-0006ze-W2; Fri, 19 May 2023 10:49:51 -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 1q01QS-0006zF-OD for qemu-devel@nongnu.org; Fri, 19 May 2023 10:49: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 1q01QR-0003Gg-1W for qemu-devel@nongnu.org; Fri, 19 May 2023 10:49:48 -0400 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-373-2iedybBcOt-DLJ0i7Q0hKA-1; Fri, 19 May 2023 10:49:44 -0400 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-4f13b1c06aaso2237693e87.1 for ; Fri, 19 May 2023 07:49:43 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id v26-20020a056512049a00b004efff420b11sm622508lfq.181.2023.05.19.07.49.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:49:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507786; h=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=m8H3lZKDwI3mjSVXnoAagyvh6l6UiwvzrfJKVsJ59EM=; b=YECQE4VOhYUC0fMKqwk8+UwXLa9w+5y3FAyiaYLTS+39AFrJ62BfuUZ5qSckjJ9wFL4YN5 gR22depUVqNezuaT/o/f7mgGGJ7uXTK/3okT1JBox/NO0frn6E2rq4v5EpYYsqFvJvwJx9 D65fAX+YNECdKYSUkM0bieKU9Zt5WRA= X-MC-Unique: 2iedybBcOt-DLJ0i7Q0hKA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507782; x=1687099782; 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=m8H3lZKDwI3mjSVXnoAagyvh6l6UiwvzrfJKVsJ59EM=; b=ljgAoY1/xHWfyg3hOrCK7wMTQR7iLo+WlB+WHJZ0VlGeapOlwA+g8LHPDnxqgPrzrA to8Pp9ipde6EZvvmkYqbaiA+u4bSwtoYkxRNpomyj2pSAfV73wcciwCA6GOsOef+Tyxd c8CIyeLexL2ueOQDNJRZqT5jcgOoIAM7I4vp99SpjgXSwHN2sNmS7/D9ca72j6HqtlaH iaDyqhwMEzFBOJgZiMXnS+Q8sUiI4Y0Lik1FWI7hzP+cqOKn6cfmlawNlfLeA0vKH6JX yrChLy7vR27ggEFq1FLZvn9UJxkmxcm8jbPQ4aiXqrdbDbQWmc+JTjRRC+929XzA5UuL OWOg== X-Gm-Message-State: AC+VfDxtpJcmEgAQjpYISp9Bf73SeNevriI6sbs2OH9LTKw5nUW9AhZ3 c40Ba1+k6tJ62rauS8Hfl1AjwTfN2E7SEoi7ziK6z+mjwhlPtgR0wfd4NjjeuRK44JeLOkYq0S0 54HtY1i2dKkASqpL0mL/SYjPUDIkiFf5wg7wILQ9h4iSX1MWofGYgrymI8VWCy0dEmz5f X-Received: by 2002:ac2:4350:0:b0:4f3:91ee:3b73 with SMTP id o16-20020ac24350000000b004f391ee3b73mr763649lfl.30.1684507782124; Fri, 19 May 2023 07:49:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7KyHMrBRXp+ODGCDRdQ7k8O3ycOiCEFjjFMJcYYFNWbDmQ/tq34Glr4iEsK89QdZBLoCcaKg== X-Received: by 2002:ac2:4350:0:b0:4f3:91ee:3b73 with SMTP id o16-20020ac24350000000b004f391ee3b73mr763640lfl.30.1684507781799; Fri, 19 May 2023 07:49:41 -0700 (PDT) Date: Fri, 19 May 2023 10:49:36 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Hawkins Jiawei , Eugenio =?utf-8?B?UMOpcmV6?= , Lei Yang Subject: [PULL 01/40] vhost: fix possible wrap in SVQ descriptor ring Message-ID: <5d410557dea452f6231a7c66155e29a37e168528.1684507742.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684507817279100003 From: Hawkins Jiawei QEMU invokes vhost_svq_add() when adding a guest's element into SVQ. In vhost_svq_add(), it uses vhost_svq_available_slots() to check whether QEMU can add the element into SVQ. If there is enough space, then QEMU combines some out descriptors and some in descriptors into one descriptor chain, and adds it into `svq->vring.desc` by vhost_svq_vring_write_descs(). Yet the problem is that, `svq->shadow_avail_idx - svq->shadow_used_idx` in vhost_svq_available_slots() returns the number of occupied elements, or the number of descriptor chains, instead of the number of occupied descriptors, which may cause wrapping in SVQ descriptor ring. Here is an example. In vhost_handle_guest_kick(), QEMU forwards as many available buffers to device by virtqueue_pop() and vhost_svq_add_element(). virtqueue_pop() returns a guest's element, and then this element is added into SVQ by vhost_svq_add_element(), a wrapper to vhost_svq_add(). If QEMU invokes virtqueue_pop() and vhost_svq_add_element() `svq->vring.num` times, vhost_svq_available_slots() thinks QEMU just ran out of slots and everything should work fine. But in fact, virtqueue_pop() returns `svq->vring.num` elements or descriptor chains, more than `svq->vring.num` descriptors due to guest memory fragmentation, and this causes wrapping in SVQ descriptor ring. This bug is valid even before marking the descriptors used. If the guest memory is fragmented, SVQ must add chains so it can try to add more descriptors than possible. This patch solves it by adding `num_free` field in VhostShadowVirtqueue structure and updating this field in vhost_svq_add() and vhost_svq_get_buf(), to record the number of free descriptors. Fixes: 100890f7ca ("vhost: Shadow virtqueue buffers forwarding") Signed-off-by: Hawkins Jiawei Acked-by: Eugenio P=C3=A9rez Message-Id: <20230509084817.3973-1-yin31149@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Tested-by: Lei Yang --- hw/virtio/vhost-shadow-virtqueue.h | 3 +++ hw/virtio/vhost-shadow-virtqueue.c | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-shadow-virtqueue.h b/hw/virtio/vhost-shadow-vi= rtqueue.h index 926a4897b1..6efe051a70 100644 --- a/hw/virtio/vhost-shadow-virtqueue.h +++ b/hw/virtio/vhost-shadow-virtqueue.h @@ -107,6 +107,9 @@ typedef struct VhostShadowVirtqueue { =20 /* Next head to consume from the device */ uint16_t last_used_idx; + + /* Size of SVQ vring free descriptors */ + uint16_t num_free; } VhostShadowVirtqueue; =20 bool vhost_svq_valid_features(uint64_t features, Error **errp); diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vhost-shadow-vi= rtqueue.c index 8361e70d1b..bd7c12b6d3 100644 --- a/hw/virtio/vhost-shadow-virtqueue.c +++ b/hw/virtio/vhost-shadow-virtqueue.c @@ -68,7 +68,7 @@ bool vhost_svq_valid_features(uint64_t features, Error **= errp) */ static uint16_t vhost_svq_available_slots(const VhostShadowVirtqueue *svq) { - return svq->vring.num - (svq->shadow_avail_idx - svq->shadow_used_idx); + return svq->num_free; } =20 /** @@ -263,6 +263,7 @@ int vhost_svq_add(VhostShadowVirtqueue *svq, const stru= ct iovec *out_sg, return -EINVAL; } =20 + svq->num_free -=3D ndescs; svq->desc_state[qemu_head].elem =3D elem; svq->desc_state[qemu_head].ndescs =3D ndescs; vhost_svq_kick(svq); @@ -449,6 +450,7 @@ static VirtQueueElement *vhost_svq_get_buf(VhostShadowV= irtqueue *svq, last_used_chain =3D vhost_svq_last_desc_of_chain(svq, num, used_elem.i= d); svq->desc_next[last_used_chain] =3D svq->free_head; svq->free_head =3D used_elem.id; + svq->num_free +=3D num; =20 *len =3D used_elem.len; return g_steal_pointer(&svq->desc_state[used_elem.id].elem); @@ -659,6 +661,7 @@ void vhost_svq_start(VhostShadowVirtqueue *svq, VirtIOD= evice *vdev, svq->iova_tree =3D iova_tree; =20 svq->vring.num =3D virtio_queue_get_num(vdev, virtio_get_queue_index(v= q)); + svq->num_free =3D svq->vring.num; driver_size =3D vhost_svq_driver_area_size(svq); device_size =3D vhost_svq_device_area_size(svq); svq->vring.desc =3D qemu_memalign(qemu_real_host_page_size(), driver_s= ize); --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508117; cv=none; d=zohomail.com; s=zohoarc; b=BJR6D5MoOIEu+7we1grQY1/dS0eEBFT0E3/5RAfkNt6XO4/nqgtomxw4UoqsF8mBD+Oe7ql7Qg0jTU7T5yREuzSkJwPqAwFa5iZyYvgi8vJrM0KEn1RUa/bX/s9Chy4V4pqyAtgh6tx8uuVeueaBtQATKNvslpwfdE01beT0LBs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508117; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NRIzHJtQJ7HpA10667EVr72jRlizLm0GWgvFozTLp40=; b=kCjeiFsjvo+KZvCDbh8HicQlVbvgLZ8HyhFAhL4QzTENrccHZ4utV2e67ZWRNWugTwmBW1WxPEZ4nuBNgwJtkLaXmbTqY8CRzts2WR8o8IGIc+kF/3UT+pF3QPaAIgxzLVL10AhiAtFpzyzBckZXeLNxrRk+6hYNEoeOtRW2pbE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508117783473.9558389145908; Fri, 19 May 2023 07:55:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01QZ-00070f-4L; Fri, 19 May 2023 10:49: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 1q01QX-000709-By for qemu-devel@nongnu.org; Fri, 19 May 2023 10:49:53 -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 1q01QV-0003Gx-UT for qemu-devel@nongnu.org; Fri, 19 May 2023 10:49:53 -0400 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-32-aRpN0gqkNFmuojEGPWDecw-1; Fri, 19 May 2023 10:49:49 -0400 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2af1ed9514bso9184391fa.0 for ; Fri, 19 May 2023 07:49:49 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id l6-20020ac25546000000b004f37a541f0csm553711lfk.270.2023.05.19.07.49.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:49:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507791; h=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=NRIzHJtQJ7HpA10667EVr72jRlizLm0GWgvFozTLp40=; b=OmzNgpwkkq8zbf2bIIHs25D0SLZdrQcu3qOLyXFjfi6ZL6LvelO9Ys3aMe6n9eFlBjB3KQ JVYqvHP/EpdTaSDIfhU9KOX1TWHNldfyVkJiv1xP6idvjQdyaZ/ubpPHrPQwziYGocHS5Q HfQaSPA9Em2Vb+uo9bch7LUnH2T+OqM= X-MC-Unique: aRpN0gqkNFmuojEGPWDecw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507788; x=1687099788; 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=NRIzHJtQJ7HpA10667EVr72jRlizLm0GWgvFozTLp40=; b=awUZAYmrYplbZehovGSPpUdim/d1+2vbiSG3hiFX8sCQLb5LwjB4NY5TRttLTq6N1O /ImNUySDpegQg4ua57q6qxM8Qov5ESkwllO1tEzi5sRlHdQkfbbRQHcyujDH6ROfgrKu SP9UjFn/NxGgl8JTjVkAfe7e8tYXzqgTfehUhLMr7LhkyjakJlfLz27ZWRGx25lRgV2f ZZ3V76SeH5UY4TQ25jYDqnKTyFLnSocE1SZK/jtfjbE+ICnKogFqB2tkbwWG0zTLCcAT aGdjJRqOyFRFMRpvw0MaMV7XvfT52EcdRWFskTL0sOkpbqgU7c7OjmxZz+IsEMk7WJLz K6Ag== X-Gm-Message-State: AC+VfDx4xlGCeVDaRTGz8rIQ+b99lbBkVTQGFvb2l6MDYX3LHXQg7Y/z NsfqfuCIPNSl15QEVo4rrieAnpEygeFcn7qVyau6gJ+8ujD3aqusF1r4R6YbhCzFJl8ZFCR8oDt HA4SxUQiZfURWPqjeN8PI9rVXDqfvNwUY3EFrUgAx13lxStBqy0klxtNdy0aNysH65pdV X-Received: by 2002:ac2:485c:0:b0:4f2:40dd:e2cf with SMTP id 28-20020ac2485c000000b004f240dde2cfmr850802lfy.55.1684507787948; Fri, 19 May 2023 07:49:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ75DCQVoeaWOvT0MknfmWM9sAQdeMgKnBwv7tprv/81SWe28d45CA6WNvBHRAg0LumxCkmgBQ== X-Received: by 2002:ac2:485c:0:b0:4f2:40dd:e2cf with SMTP id 28-20020ac2485c000000b004f240dde2cfmr850786lfy.55.1684507787552; Fri, 19 May 2023 07:49:47 -0700 (PDT) Date: Fri, 19 May 2023 10:49:42 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Hao Zeng , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Jonathan Cameron , Fan Ni Subject: [PULL 02/40] hw/cxl: cdat: Fix open file not closed in ct3_load_cdat() Message-ID: <71ba92f3488b64bd5c81e2872c56e88cea21bb95.1684507742.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508118853100002 From: Hao Zeng Open file descriptor not closed in error paths. Fix by replace open coded handling of read of whole file into a buffer with g_file_get_contents() Fixes: aba578bdac ("hw/cxl: CDAT Data Object Exchange implementation") Signed-off-by: Zeng Hao Suggested-by: Philippe Mathieu-Daud=C3=A9 Suggested-by: Peter Maydell Suggested-by: Jonathan Cameron via Signed-off-by: Jonathan Cameron -- Changes since v5: - Drop if guard on g_free() as per checkpatch warning. Message-Id: <20230421132020.7408-2-Jonathan.Cameron@huawei.com> Reviewed-by: Fan Ni Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/cxl/cxl-cdat.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/hw/cxl/cxl-cdat.c b/hw/cxl/cxl-cdat.c index 137abd0992..056711d63d 100644 --- a/hw/cxl/cxl-cdat.c +++ b/hw/cxl/cxl-cdat.c @@ -110,29 +110,18 @@ static void ct3_load_cdat(CDATObject *cdat, Error **e= rrp) g_autofree CDATEntry *cdat_st =3D NULL; uint8_t sum =3D 0; int num_ent; - int i =3D 0, ent =3D 1, file_size =3D 0; + int i =3D 0, ent =3D 1; + gsize file_size =3D 0; CDATSubHeader *hdr; - FILE *fp =3D NULL; + GError *error =3D NULL; =20 /* Read CDAT file and create its cache */ - fp =3D fopen(cdat->filename, "r"); - if (!fp) { - error_setg(errp, "CDAT: Unable to open file"); + if (!g_file_get_contents(cdat->filename, (gchar **)&cdat->buf, + &file_size, &error)) { + error_setg(errp, "CDAT: File read failed: %s", error->message); + g_error_free(error); return; } - - fseek(fp, 0, SEEK_END); - file_size =3D ftell(fp); - fseek(fp, 0, SEEK_SET); - cdat->buf =3D g_malloc0(file_size); - - if (fread(cdat->buf, file_size, 1, fp) =3D=3D 0) { - error_setg(errp, "CDAT: File read failed"); - return; - } - - fclose(fp); - if (file_size < sizeof(CDATTableHeader)) { error_setg(errp, "CDAT: File too short"); return; @@ -218,7 +207,5 @@ void cxl_doe_cdat_release(CXLComponentState *cxl_cstate) cdat->free_cdat_table(cdat->built_buf, cdat->built_buf_len, cdat->private); } - if (cdat->buf) { - free(cdat->buf); - } + g_free(cdat->buf); } --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684507878; cv=none; d=zohomail.com; s=zohoarc; b=bmbKvXWmbDMZ3oK7qbHixjaVVAkn8wrYRoECcRoiEmup4BvKVkwHGphk66TYGpYlCy4KbJvSWOMNUuBrHWcptPZrxyGVlNPfMMLlcGXwDYQ7pRzqk0FXGIWpj3vexAVdJjheUIUrp/HYnXwEgRwGDy41lb6GjjasTIE7Jc09eh8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684507878; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5VdNdbQRJpORKwXC8FXaaYafZ5Xc2CoK9u2rcDHW7X8=; b=AXwte/tiCjn8wRjYMil7EvgegMZTKzZHIQdBuYSAfL/5X03pNNj/XCeTS3hfUwI0cNLEg0+x/jII3nEhUcCJ6sU/hhyLVvklCSAP1DpZM7ljBxgtR/dnYLYr2UBjLYWJI7i9c86/E/fmgld4k+nXIDMpO3CwWqsU++vOIwekgOw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684507878751303.8538172555461; Fri, 19 May 2023 07:51:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01Qk-00071A-F8; Fri, 19 May 2023 10:50: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 1q01Qc-000712-TD for qemu-devel@nongnu.org; Fri, 19 May 2023 10:49:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q01Qb-0003Hg-69 for qemu-devel@nongnu.org; Fri, 19 May 2023 10:49:58 -0400 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-168-8qcT5AyOMMe_zQILUacFqg-1; Fri, 19 May 2023 10:49:55 -0400 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-4f0176dcc1eso603520e87.1 for ; Fri, 19 May 2023 07:49:55 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id p3-20020a05651238c300b004f13f4ec267sm617369lft.186.2023.05.19.07.49.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:49:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507796; h=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=5VdNdbQRJpORKwXC8FXaaYafZ5Xc2CoK9u2rcDHW7X8=; b=APFAXQqLt4687LSQ6pNuIIglfeRGQNHLxoPNQ9ituVBQpLeT/62DWkzOaGRPo8DAca/vrX DKOtUtfqra+Y1xkHT4eCWy4YOE3NXMgV/083ajiCxBfsaDo3YDioLcLZnCg5LOGAq5z98A 0meYyzKnxQSWjCycRqvXu2NrqJ+fmRQ= X-MC-Unique: 8qcT5AyOMMe_zQILUacFqg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507793; x=1687099793; 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=5VdNdbQRJpORKwXC8FXaaYafZ5Xc2CoK9u2rcDHW7X8=; b=VLwqTgvOGZTuFmGgf6yUyO6nJmN/zzUhPNkAIue1xM0qMLb3m4G5vOJs+MqVB0K7ny +ofBP61+2j+/i4lnXl7YjeKI6yHIiVSMMXe89u7QLduOLiSkDdoIGn+Ci1s3UUrQLsW8 gN9GiHiWu1p3O3g2VWT4yieE1j083oY9X6meHKY44fnFQbybuepJDKMIIHRd33ZQQehg ayO+rrz5UtWvGisOv2CfyZkO3viL0k8oeWQ1IP1C9d9QDtmV8aMnAl/mS+ftr3824BTd +NqxwwKqjT4aVxi+/6M2qRV6Z/+AODYalUI+vCcHvzlWiMCxlsU1/yRC7cJMIwdmlLzw MeuA== X-Gm-Message-State: AC+VfDxVmOndWEkqSq201o2vuQZOruDEG3YgqGi/UIs5Cz4nypqI5qWe Z8gsh1fT/QYdz5lb/oHpuvmdIVuRPRgmobU962noAz+n6XS2dmce92Tu9It2DhewXyouk1j6MtQ bUbAc2pDrGPdns4yFrWku5gnSWx7SMVXHkH+OLUDEIsvphExIAhaMRYGe84lIqsI09juD X-Received: by 2002:a05:6512:3f1e:b0:4f3:a763:ccb7 with SMTP id y30-20020a0565123f1e00b004f3a763ccb7mr1154079lfa.2.1684507793340; Fri, 19 May 2023 07:49:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5TVlYDCbZERNbTu+/Qvfer3SJSsfdECDaHf089xi6FI7iDmeg0j7n62BQ7QdB2CXNfjyeaXQ== X-Received: by 2002:a05:6512:3f1e:b0:4f3:a763:ccb7 with SMTP id y30-20020a0565123f1e00b004f3a763ccb7mr1154069lfa.2.1684507793041; Fri, 19 May 2023 07:49:53 -0700 (PDT) Date: Fri, 19 May 2023 10:49:47 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Fan Ni , Marcel Apfelbaum Subject: [PULL 03/40] hw/cxl: cdat: Fix failure to free buffer in erorr paths Message-ID: <7b22a3218ad0b8388c8bf20d394e3220b2fc8798.1684507742.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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684507880221100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jonathan Cameron The failure paths in CDAT file loading did not clear up properly. Change to using g_auto_free and a local pointer for the buffer to ensure this function has no side effects on error. Also drop some unnecessary checks that can not fail. Cleanup properly after a failure to load a CDAT file. Suggested-by: Peter Maydell Signed-off-by: Jonathan Cameron Message-Id: <20230421132020.7408-3-Jonathan.Cameron@huawei.com> Reviewed-by: Fan Ni Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/cxl/cxl-cdat.c | 33 ++++++++++++++++++--------------- hw/mem/cxl_type3.c | 4 ++++ hw/pci-bridge/cxl_upstream.c | 3 +++ 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/hw/cxl/cxl-cdat.c b/hw/cxl/cxl-cdat.c index 056711d63d..d246d6885b 100644 --- a/hw/cxl/cxl-cdat.c +++ b/hw/cxl/cxl-cdat.c @@ -108,6 +108,7 @@ static void ct3_build_cdat(CDATObject *cdat, Error **er= rp) static void ct3_load_cdat(CDATObject *cdat, Error **errp) { g_autofree CDATEntry *cdat_st =3D NULL; + g_autofree char *buf =3D NULL; uint8_t sum =3D 0; int num_ent; int i =3D 0, ent =3D 1; @@ -116,7 +117,7 @@ static void ct3_load_cdat(CDATObject *cdat, Error **err= p) GError *error =3D NULL; =20 /* Read CDAT file and create its cache */ - if (!g_file_get_contents(cdat->filename, (gchar **)&cdat->buf, + if (!g_file_get_contents(cdat->filename, (gchar **)&buf, &file_size, &error)) { error_setg(errp, "CDAT: File read failed: %s", error->message); g_error_free(error); @@ -129,9 +130,17 @@ static void ct3_load_cdat(CDATObject *cdat, Error **er= rp) i =3D sizeof(CDATTableHeader); num_ent =3D 1; while (i < file_size) { - hdr =3D (CDATSubHeader *)(cdat->buf + i); + hdr =3D (CDATSubHeader *)(buf + i); + if (i + sizeof(CDATSubHeader) > file_size) { + error_setg(errp, "CDAT: Truncated table"); + return; + } cdat_len_check(hdr, errp); i +=3D hdr->length; + if (i > file_size) { + error_setg(errp, "CDAT: Truncated table"); + return; + } num_ent++; } if (i !=3D file_size) { @@ -139,33 +148,26 @@ static void ct3_load_cdat(CDATObject *cdat, Error **e= rrp) return; } =20 - cdat_st =3D g_malloc0(sizeof(*cdat_st) * num_ent); - if (!cdat_st) { - error_setg(errp, "CDAT: Failed to allocate entry array"); - return; - } + cdat_st =3D g_new0(CDATEntry, num_ent); =20 /* Set CDAT header, Entry =3D 0 */ - cdat_st[0].base =3D cdat->buf; + cdat_st[0].base =3D buf; cdat_st[0].length =3D sizeof(CDATTableHeader); i =3D 0; =20 while (i < cdat_st[0].length) { - sum +=3D cdat->buf[i++]; + sum +=3D buf[i++]; } =20 /* Read CDAT structures */ while (i < file_size) { - hdr =3D (CDATSubHeader *)(cdat->buf + i); - cdat_len_check(hdr, errp); - + hdr =3D (CDATSubHeader *)(buf + i); cdat_st[ent].base =3D hdr; cdat_st[ent].length =3D hdr->length; =20 - while (cdat->buf + i < - (uint8_t *)cdat_st[ent].base + cdat_st[ent].length) { + while (buf + i < (char *)cdat_st[ent].base + cdat_st[ent].length) { assert(i < file_size); - sum +=3D cdat->buf[i++]; + sum +=3D buf[i++]; } =20 ent++; @@ -176,6 +178,7 @@ static void ct3_load_cdat(CDATObject *cdat, Error **err= p) } cdat->entry_len =3D num_ent; cdat->entry =3D g_steal_pointer(&cdat_st); + cdat->buf =3D g_steal_pointer(&buf); } =20 void cxl_doe_cdat_init(CXLComponentState *cxl_cstate, Error **errp) diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index abe60b362c..7647122cc6 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -593,6 +593,9 @@ static void ct3_realize(PCIDevice *pci_dev, Error **err= p) cxl_cstate->cdat.free_cdat_table =3D ct3_free_cdat_table; cxl_cstate->cdat.private =3D ct3d; cxl_doe_cdat_init(cxl_cstate, errp); + if (*errp) { + goto err_free_special_ops; + } =20 pcie_cap_deverr_init(pci_dev); /* Leave a bit of room for expansion */ @@ -605,6 +608,7 @@ static void ct3_realize(PCIDevice *pci_dev, Error **err= p) =20 err_release_cdat: cxl_doe_cdat_release(cxl_cstate); +err_free_special_ops: g_free(regs->special_ops); err_address_space_free: address_space_destroy(&ct3d->hostmem_as); diff --git a/hw/pci-bridge/cxl_upstream.c b/hw/pci-bridge/cxl_upstream.c index 9df436cb73..ef47e5d625 100644 --- a/hw/pci-bridge/cxl_upstream.c +++ b/hw/pci-bridge/cxl_upstream.c @@ -346,6 +346,9 @@ static void cxl_usp_realize(PCIDevice *d, Error **errp) cxl_cstate->cdat.free_cdat_table =3D free_default_cdat_table; cxl_cstate->cdat.private =3D d; cxl_doe_cdat_init(cxl_cstate, errp); + if (*errp) { + goto err_cap; + } =20 return; =20 --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508003; cv=none; d=zohomail.com; s=zohoarc; b=NkYBpo91/TJMBduf1sgm9tJTgOIiF1T5Pi69ypwhHOxPYGGg9tMLoatJHqsfkdLtY69Be98Ti5eYlukj53scFknt34wsXdacN5YAmTv2z+SQogthYmQqgMgGHiNQ59lqg+64cZRALYKyCDLq07AAbvLWTk1NjZ3xA4O0IvnoXBY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508003; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8m/TvR9N88B9CWAayRXkVdTCBxjRBqiu8lXv0OP6qsE=; b=bwLDDaMAl7+tqbzH7w/jVmqxIyek7MW+TcCM21kPashOYJvDO4Uk+LV6AU2tSze3v25H4VT0IrDoinxC6Bf+0VW6K4oqHjG/EkYQrN4u0Y8wDlSR85ZUyF58dHXZaNygpe4wBfgteo23cCuOG+MbLJy0ni+1QHPvMa0Z2/6fJuo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508003445587.1605276459563; Fri, 19 May 2023 07:53:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01Qv-00075k-6y; Fri, 19 May 2023 10:50:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q01Qi-00071e-6f for qemu-devel@nongnu.org; Fri, 19 May 2023 10:50: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 1q01Qf-0003I6-BL for qemu-devel@nongnu.org; Fri, 19 May 2023 10:50:02 -0400 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-68-263HggwiOduxVYAOysRBLg-1; Fri, 19 May 2023 10:49:59 -0400 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2add1fdcef0so20893641fa.3 for ; Fri, 19 May 2023 07:49:59 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id o18-20020ac24352000000b004ec7c0f2178sm627588lfl.63.2023.05.19.07.49.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:49:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507800; h=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=8m/TvR9N88B9CWAayRXkVdTCBxjRBqiu8lXv0OP6qsE=; b=cl8vTge/ozE0+vQ3w3fta5bWF0DZM5h2NuiOWWTq45OZIy6lliu1HRwvIynvn7NxUSAsi9 vkNH9pmEt9IpY3dE0lRNvkLfW0zMuOYuGI/xSqkhOl+n4UoJTXjAHDXMN5cGkRztO0jTbA eF4mVHwS5+dYbNyQBBCJDiHnGnsx7s8= X-MC-Unique: 263HggwiOduxVYAOysRBLg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507797; x=1687099797; 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=8m/TvR9N88B9CWAayRXkVdTCBxjRBqiu8lXv0OP6qsE=; b=CCIk/HoljAm2Vk8aXjaGlE6NBDZF+Wx0sI4WeolGCfCViEllePtkJhR0knJawEWclW WsD3pKs0xgJ37h32pn3wypA0upgIs5Cxvx+EufkBtgq9pQ0b6cB7LOnyK2h0cLuC555n 0QYtlRUWJMf81Rc0b+rDSuvBT+A2KaDTgk7uMnebIOCEERTspyPWtkc6GjCYgTUMnJkH dGVLob3IksZgzQPoGt0QmAoKwk1uBTVO58S4VXSjmbzXKt9Q99UeIiFevR1C0OlRL1n3 3o21oaqcwZQOksRgfnFlvGoQuYtiKW1BjTgz8WltqAx0Dn5RNgfxJVr2Ai7v5CiX7suq dd2g== X-Gm-Message-State: AC+VfDyOCfq9zf/+jiWVOlMbOlxaHAAX25Izx00f/CilBAsM9zG2xcSL ATnrjRnNmpGpg1bJkVMwuOiPG+KQFYzUChpMzqJIzgJsNocOszeqmFad8TEulltI5IhdRWEoB9r 5GT6yO6H4mhqTuqREEDDqcKefsT7JwHKeqWSn6In/RRLGLE3KzgCx/4TqZC7CVBfR5/Mq X-Received: by 2002:ac2:5ed1:0:b0:4f3:a9d4:45ef with SMTP id d17-20020ac25ed1000000b004f3a9d445efmr890680lfq.22.1684507797799; Fri, 19 May 2023 07:49:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5IhH1xt85TGvGyHU2Or6RSiyUunRizj3vm8t3V/sX4PwGaHW28MHt87URzYf6S7t0BIfJDdA== X-Received: by 2002:ac2:5ed1:0:b0:4f3:a9d4:45ef with SMTP id d17-20020ac25ed1000000b004f3a9d445efmr890669lfq.22.1684507797495; Fri, 19 May 2023 07:49:57 -0700 (PDT) Date: Fri, 19 May 2023 10:49:53 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Brice Goglin , Jonathan Cameron , Stefan Weil , Thomas Huth Subject: [PULL 04/40] docs/cxl: fix some typos 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508004248100005 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Brice Goglin Signed-off-by: Brice Goglin Signed-off-by: Jonathan Cameron Message-Id: <20230421134507.26842-2-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- docs/system/devices/cxl.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/system/devices/cxl.rst b/docs/system/devices/cxl.rst index 4c38223069..9618becdab 100644 --- a/docs/system/devices/cxl.rst +++ b/docs/system/devices/cxl.rst @@ -162,7 +162,7 @@ Example system Topology. x marks the match in each deco= der level:: |<------------------SYSTEM PHYSICAL ADDRESS MAP (1)----------------->| | __________ __________________________________ __________ | | | | | | | | | - | | CFMW 0 | | CXL Fixed Memory Window 1 | | CFMW 1 | | + | | CFMW 0 | | CXL Fixed Memory Window 1 | | CFMW 2 | | | | HB0 only | | Configured to interleave memory | | HB1 only | | | | | | memory accesses across HB0/HB1 | | | | | |__________| |_____x____________________________| |__________| | @@ -208,8 +208,8 @@ Notes: (1) **3 CXL Fixed Memory Windows (CFMW)** corresponding to different ranges of the system physical address map. Each CFMW has particular interleave setup across the CXL Host Bridges (HB) - CFMW0 provides uninterleaved access to HB0, CFW2 provides - uninterleaved access to HB1. CFW1 provides interleaved memory access + CFMW0 provides uninterleaved access to HB0, CFMW2 provides + uninterleaved access to HB1. CFMW1 provides interleaved memory access across HB0 and HB1. =20 (2) **Two CXL Host Bridges**. Each of these has 2 CXL Root Ports and @@ -247,7 +247,7 @@ Example topology involving a switch:: |<------------------SYSTEM PHYSICAL ADDRESS MAP (1)----------------->| | __________ __________________________________ __________ | | | | | | | | | - | | CFMW 0 | | CXL Fixed Memory Window 1 | | CFMW 1 | | + | | CFMW 0 | | CXL Fixed Memory Window 1 | | CFMW 2 | | | | HB0 only | | Configured to interleave memory | | HB1 only | | | | | | memory accesses across HB0/HB1 | | | | | |____x_____| |__________________________________| |__________| | --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684507907; cv=none; d=zohomail.com; s=zohoarc; b=AzztIIm/aVwe7YjbPAPmcImDGlnhzl4UELJfO+skZoBQnGPaXlHIMHmCjlcVOQeXxpvOslzPoPTBZm7WcsU2/Eaj1XyvJsFN1J1obfYip0EjIkMwjgZhxnk9W81cWz+2vBx9Y3+0G3GFBxeBG3NOL9Y6GTDglkQgpJcmmUq7vJY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684507907; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3Uz+rubBMDavSXwC+q/q5QWww1PtBSrKQ33BgEKuCPk=; b=bfsZxXZdj9cZWhlGZWI31WxpHOyufFdOs9CrPZgPSVODG01eL0FiviXr33gxxgTPWTlxSF7wtSbaxgOjQL9QCSeCLdqBYdbKBLgiWmJIcbmGWubXlBjUKIPmS4II9YLR0bNBPeiwDiV9rPiEFLhjWGTKH+aYENdR1VCp4fP+htE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684507907433942.4706310784778; Fri, 19 May 2023 07:51:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01Qw-00076O-Bp; Fri, 19 May 2023 10:50: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 1q01Qt-00074D-BJ for qemu-devel@nongnu.org; Fri, 19 May 2023 10:50: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 1q01Ql-0003U6-JF for qemu-devel@nongnu.org; Fri, 19 May 2023 10:50:14 -0400 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-612-EumRFo64N_KPENZllNbbiw-1; Fri, 19 May 2023 10:50:04 -0400 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2af1a8b6c38so10036351fa.1 for ; Fri, 19 May 2023 07:50:04 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id u6-20020a2e8446000000b002ad333df101sm847534ljh.133.2023.05.19.07.49.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:50:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507805; h=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=3Uz+rubBMDavSXwC+q/q5QWww1PtBSrKQ33BgEKuCPk=; b=e2WyVN/qLHA0xd0GwTBXBHBw+yk/MLJKhg21GbsRTgUWnXg5GfWnOWykxJsy8o34eNo85P 5fcS8xjQuOPqKQDkzN3dEvVcJJCTIsiFxh+xGS7yUUGtBWkE5hbwNKIWQqTzTezoVXfJOI CJBCKOzyVSofA6RZPCZjI4OAhwW6/4A= X-MC-Unique: EumRFo64N_KPENZllNbbiw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507802; x=1687099802; 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=3Uz+rubBMDavSXwC+q/q5QWww1PtBSrKQ33BgEKuCPk=; b=ZxXXpvo5NesF4bkcGhAR9X1N8d4vR0+A+WE1bjT+UCQXlQ3m9EclYxaff4z6015+Rf A2O8/zaoeB1dRtiTXm0dofPBr08LHz8DSQoI4CsyAuuQqOOGe/qNHbqtHv/haNho7lwC cnTpLzQA54vMhQTjGPBY+HiKw3V8TYZvAWeeD4SD/OK7hY16+HUjVu3HE/2D4PABEzp6 PdQAwBXbORf9QRDipidrVzlfbF93oW7xJOMRpe5mGG+Ga5NNcbF0FzeK4k5GCcy7m3EY FRGf5d+QItFEz0F7bfNnGks+XjZOqXycDUJfQIPrJFeNJ6+xEeqJOkP4FfG2h3R2EQfI TwkA== X-Gm-Message-State: AC+VfDxoVx+J+GaWt/XVttD5cWxeDPgiYVqWlkCcac1UChFlOOfdCSqB EoupkrFYj4MXROJwK/7H5AJQocH+B27XDz7W7y9wT3cWzqYAKeQ3TuyBLJdDUML81CFJk3AHR7L Pd6EtUuxjd1XT71h+T5iuKJPntQ/qLr6RmR/azXePPJk/jU7iqx7OKDedGoOUkWG8aP+k X-Received: by 2002:a2e:8887:0:b0:2af:2686:65f1 with SMTP id k7-20020a2e8887000000b002af268665f1mr826970lji.7.1684507802778; Fri, 19 May 2023 07:50:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6BrApu1/3TH67DQntYWdC7bVmEWcNr2nWboJz2Xah4hAk9gmopfboALr09TaGfbN4T6sEVzg== X-Received: by 2002:a2e:8887:0:b0:2af:2686:65f1 with SMTP id k7-20020a2e8887000000b002af268665f1mr826956lji.7.1684507802428; Fri, 19 May 2023 07:50:02 -0700 (PDT) Date: Fri, 19 May 2023 10:49:57 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Raghu H , Jonathan Cameron , Stefan Weil Subject: [PULL 05/40] docs/cxl: Remove incorrect CXL type 3 size parameter Message-ID: <9830ea6126c6a3b3ea7af720d98aa7717dba59eb.1684507742.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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684507908062100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Raghu H cxl-type3 memory size is read directly from the provided memory backed end device. Remove non existent size option Signed-off-by: Raghu H Signed-off-by: Jonathan Cameron Message-Id: <20230421134507.26842-3-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- docs/system/devices/cxl.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/system/devices/cxl.rst b/docs/system/devices/cxl.rst index 9618becdab..dd1a62bd57 100644 --- a/docs/system/devices/cxl.rst +++ b/docs/system/devices/cxl.rst @@ -354,13 +354,13 @@ An example of 4 devices below a switch suitable for 1= , 2 or 4 way interleave:: -device cxl-rp,port=3D1,bus=3Dcxl.1,id=3Droot_port1,chassis=3D0,slot=3D1= \ -device cxl-upstream,bus=3Droot_port0,id=3Dus0 \ -device cxl-downstream,port=3D0,bus=3Dus0,id=3Dswport0,chassis=3D0,slot= =3D4 \ - -device cxl-type3,bus=3Dswport0,memdev=3Dcxl-mem0,lsa=3Dcxl-lsa0,id=3Dcx= l-pmem0,size=3D256M \ + -device cxl-type3,bus=3Dswport0,memdev=3Dcxl-mem0,lsa=3Dcxl-lsa0,id=3Dcx= l-pmem0 \ -device cxl-downstream,port=3D1,bus=3Dus0,id=3Dswport1,chassis=3D0,slot= =3D5 \ - -device cxl-type3,bus=3Dswport1,memdev=3Dcxl-mem1,lsa=3Dcxl-lsa1,id=3Dcx= l-pmem1,size=3D256M \ + -device cxl-type3,bus=3Dswport1,memdev=3Dcxl-mem1,lsa=3Dcxl-lsa1,id=3Dcx= l-pmem1 \ -device cxl-downstream,port=3D2,bus=3Dus0,id=3Dswport2,chassis=3D0,slot= =3D6 \ - -device cxl-type3,bus=3Dswport2,memdev=3Dcxl-mem2,lsa=3Dcxl-lsa2,id=3Dcx= l-pmem2,size=3D256M \ + -device cxl-type3,bus=3Dswport2,memdev=3Dcxl-mem2,lsa=3Dcxl-lsa2,id=3Dcx= l-pmem2 \ -device cxl-downstream,port=3D3,bus=3Dus0,id=3Dswport3,chassis=3D0,slot= =3D7 \ - -device cxl-type3,bus=3Dswport3,memdev=3Dcxl-mem3,lsa=3Dcxl-lsa3,id=3Dcx= l-pmem3,size=3D256M \ + -device cxl-type3,bus=3Dswport3,memdev=3Dcxl-mem3,lsa=3Dcxl-lsa3,id=3Dcx= l-pmem3 \ -M cxl-fmw.0.targets.0=3Dcxl.1,cxl-fmw.0.size=3D4G,cxl-fmw.0.interleave-= granularity=3D4k =20 Kernel Configuration Options --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508043; cv=none; d=zohomail.com; s=zohoarc; b=iYIGa3BSVAZMEndjX/7+iq7t0KiTbkpcQtVicFFhCd8uy0ExIvAxPVdhZ1TrWwO77+ChAEN5Ic0ve7MOYbCBixPQjuILNUiR+kqDzKGSmo4rfYYcuU3OOSxxhxqPDDgTDEwHfHmw4ASdq0i/DYatwt0VzoaCJGxfcsHTwsD3JMI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508043; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NojQDkxaiUz9/Fpnr3UOkUr9Gdhrk66biKkct4h/Eno=; b=nELnuAxqmdfiNc7hO86pNQ5kFcxrQ8xe0Pj8qdW5o8WduHh1jyv1j6Xy9jjzjvpxO9FFYBPEqxLW1K0tkm2M01cq2rmDT9xXIIML1D3QSzVikmtwvJETFw3oATcWoRhBhE5nmPAgy5J3O7H2nwFc4qyNNVLPVyFWn3+Pgje//Lw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508043813624.7990772212291; Fri, 19 May 2023 07:54:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01Qv-00076M-RJ; Fri, 19 May 2023 10:50:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q01Qt-00074C-3a for qemu-devel@nongnu.org; Fri, 19 May 2023 10:50: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 1q01Qr-0003Ui-Io for qemu-devel@nongnu.org; Fri, 19 May 2023 10:50:14 -0400 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-424-LN4YAPusO3KEXsP7qVx6kw-1; Fri, 19 May 2023 10:50:10 -0400 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2ab3e925512so5586531fa.1 for ; Fri, 19 May 2023 07:50:09 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id m11-20020ac24acb000000b004edb2cb3500sm615608lfp.279.2023.05.19.07.50.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:50:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507812; h=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=NojQDkxaiUz9/Fpnr3UOkUr9Gdhrk66biKkct4h/Eno=; b=frv73BYi2OtjunFaQAt3lu7+R6NJ2NIbnwvrC71n6gxI1cl4c+SYQbLs2NHGACPI1oHAVQ PpXJ1TeE1h6pz+hhSiItkV2vRJIcTXFD1Ar5SrtkDyfkSekGcnIpQz4vJ4rege4Q978Apf K4v9FJ+NydWIGD+4P7yUhSwu/bHs/tw= X-MC-Unique: LN4YAPusO3KEXsP7qVx6kw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507808; x=1687099808; 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=NojQDkxaiUz9/Fpnr3UOkUr9Gdhrk66biKkct4h/Eno=; b=XbzGx1YQaEgoz/8Zdj4vf/RKifW0cuenXAEfGgV/nmLbWghugAp8LbK6UPVuCGrnso k1RdfoeUFa4lXMbkMhRVMOxgUJOQOvKQZ6inVlhHy95ZUpQjmh/sattirMsg2KlxBbxb u3WOlJuxsJzKdneyD6r87MA5FMLDroOYDVhh9sraXEO/V3cvmnOk+fty722BxUB2Ie0v pquLgCkv7b4iywP5llpLJlXpxw95S9gthHI7fd3u/PG2OqkZev5zl00IfJV0s+UxFVYP KWfE6qveHUQjng+96N4okXZUGEh70EYZeCQjtn2jNOQ+DEToLeX5uIPS84t403CnM6o6 Blwg== X-Gm-Message-State: AC+VfDymZhar5uchTBAfiPX2AtiravqhfV6yjtRCPP5Wuy9d/SaVvInx pwLOqQKa8LGSwzLvMuPzDFhSozoyE2cH1cL4Z0do+zzVtNRdDelBPaFsxv4f5VkDA1CTCNkvWt8 4JvrEQY6Gatf27bUB5tCBgeScoFulszp3NNhMaUzxWnChNGhnQu7p+ZIrpof6sAbF0bxj X-Received: by 2002:a05:6512:3189:b0:4f1:21a2:9006 with SMTP id i9-20020a056512318900b004f121a29006mr994626lfe.18.1684507808202; Fri, 19 May 2023 07:50:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6zrgjjJhEtho2MaQ3xAkpOw4LaErI9e/NHoEw0YYkJzD5Ni1nzIwbNAiSEMHkKcuVXUwC+Bw== X-Received: by 2002:a05:6512:3189:b0:4f1:21a2:9006 with SMTP id i9-20020a056512318900b004f121a29006mr994612lfe.18.1684507807955; Fri, 19 May 2023 07:50:07 -0700 (PDT) Date: Fri, 19 May 2023 10:50:02 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Raghu H , Jonathan Cameron , Stefan Weil , Davidlohr Bueso Subject: [PULL 06/40] docs/cxl: Replace unsupported AARCH64 with x86_64 Message-ID: <0795b98f096b876a36e2c45adb42c2004655011e.1684507742.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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508044961100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Raghu H Currently Qemu CXL emulation support is not availabe on AARCH64 but its available with qemu x86_64 architecture, updating the document to reflect the supported platform. Signed-off-by: Raghu H Signed-off-by: Jonathan Cameron Message-Id: <20230421134507.26842-4-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- docs/system/devices/cxl.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/system/devices/cxl.rst b/docs/system/devices/cxl.rst index dd1a62bd57..8f2885aba1 100644 --- a/docs/system/devices/cxl.rst +++ b/docs/system/devices/cxl.rst @@ -302,7 +302,7 @@ Example command lines --------------------- A very simple setup with just one directly attached CXL Type 3 device:: =20 - qemu-system-aarch64 -M virt,gic-version=3D3,cxl=3Don -m 4g,maxmem=3D8G,s= lots=3D8 -cpu max \ + qemu-system-x86_64 -M q35,cxl=3Don -m 4G,maxmem=3D8G,slots=3D8 -smp 4 \ ... -object memory-backend-file,id=3Dcxl-mem1,share=3Don,mem-path=3D/tmp/cxl= test.raw,size=3D256M \ -object memory-backend-file,id=3Dcxl-lsa1,share=3Don,mem-path=3D/tmp/lsa= .raw,size=3D256M \ @@ -315,7 +315,7 @@ A setup suitable for 4 way interleave. Only one fixed w= indow provided, to enable interleave across 2 CXL host bridges. Each host bridge has 2 CXL Root Por= ts, with the CXL Type3 device directly attached (no switches).:: =20 - qemu-system-aarch64 -M virt,gic-version=3D3,cxl=3Don -m 4g,maxmem=3D8G,s= lots=3D8 -cpu max \ + qemu-system-x86_64 -M q35,cxl=3Don -m 4G,maxmem=3D8G,slots=3D8 -smp 4 \ ... -object memory-backend-file,id=3Dcxl-mem1,share=3Don,mem-path=3D/tmp/cxl= test.raw,size=3D256M \ -object memory-backend-file,id=3Dcxl-mem2,share=3Don,mem-path=3D/tmp/cxl= test2.raw,size=3D256M \ @@ -339,7 +339,7 @@ the CXL Type3 device directly attached (no switches).:: =20 An example of 4 devices below a switch suitable for 1, 2 or 4 way interlea= ve:: =20 - qemu-system-aarch64 -M virt,gic-version=3D3,cxl=3Don -m 4g,maxmem=3D8G,s= lots=3D8 -cpu max \ + qemu-system-x86_64 -M q35,cxl=3Don -m 4G,maxmem=3D8G,slots=3D8 -smp 4 \ ... -object memory-backend-file,id=3Dcxl-mem0,share=3Don,mem-path=3D/tmp/cxl= test.raw,size=3D256M \ -object memory-backend-file,id=3Dcxl-mem1,share=3Don,mem-path=3D/tmp/cxl= test1.raw,size=3D256M \ --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684507900; cv=none; d=zohomail.com; s=zohoarc; b=Ylk1jpgs6gEsT1w/+5YkUTsMVtSQDW2Ozu7XrhQG/6d8109tvA9TAH+NJt3a48kFc1Rdi6n7j/yIm19yEsnU1GfyjZ339fD7LE5o4wZnPhDffhoWZBcrEAHmrwLH+PbZ/NlRb/7ut0WJYxCz4RhemSQugyE+wAyCWJiv2bAZmlk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684507900; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dcZFU9WEz6IBrpIZ1MKLxB7FV3fbWZxqDG0kHJf8q0c=; b=GY9eILZUowi899M1edZedaphFLw3U1fMMm9xa1Eug6RQB8LyJQBzhXsSKvXt2DI3M6AgAmwtwvqI0m1Og+aibZZwci70ag4a/I9fds/pQvQSQrnDRPckwJxJZkv9mImObEIlyUQLw5PYASCKt10nyXXXpr6phbWI3WoBl6BtTyM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684507900645141.5928494178662; Fri, 19 May 2023 07:51:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01Qy-0007AW-U4; Fri, 19 May 2023 10:50: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 1q01Qw-00076P-IX for qemu-devel@nongnu.org; Fri, 19 May 2023 10:50:18 -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 1q01Qv-0003Vk-6X for qemu-devel@nongnu.org; Fri, 19 May 2023 10:50:18 -0400 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-675-Je0_I5r5M32YnwAd3Gl-CQ-1; Fri, 19 May 2023 10:50:15 -0400 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-4f38f48be8bso2237616e87.2 for ; Fri, 19 May 2023 07:50:15 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id a15-20020ac2520f000000b004f393d4b51fsm620629lfl.190.2023.05.19.07.50.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:50:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507816; h=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=dcZFU9WEz6IBrpIZ1MKLxB7FV3fbWZxqDG0kHJf8q0c=; b=XYNXSfol/PfV/cg2jlvchq3DgQLYUc3O7ph6ubNILMjj8Nl4eUm21cJXX2YleK2qqOI0Vs JWu6kJrH4M+mwtfvqlN5VZxDPL51hjUmQrkoX/08NcEyyT0f2WoHUkmGX2Oo0x6Q/NePHi zIWrIe2N5PJs7l+4GT72LBPgxo0bDWI= X-MC-Unique: Je0_I5r5M32YnwAd3Gl-CQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507813; x=1687099813; 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=dcZFU9WEz6IBrpIZ1MKLxB7FV3fbWZxqDG0kHJf8q0c=; b=l60q7NcniqLalCUGO+8itLYCRj/+P7LH4pc/y0TeYXVS9Tkz4MEMiyF2Ds606oBQxo 40gDEyWrJqZnMfbctEjHU+cze9h3wHNTllAATIBuZ0HoCBS8WgQVO5YC7NLXI7G3G/aH tUTRA7n4SBfhosaDhlYMeHiPlZgbC4Ke/TlemAc+plVFyDX+ygEi6A9rA6JKWaq06Zyo taNWqfyr8JYSBodQsJQLgdOY/3CI8xjFLZFf4PqvsEgRa/P8RPQrlBa2mRZK+MVp3jJy yqswssbb49NFKsvsYc5wqykp4w9Y8YsxplKRvM3a0tzUKZ1fsgq5AWfizv5zNmClzsp/ SNTQ== X-Gm-Message-State: AC+VfDxpC5UUePjJG80nMxOc46aMyKbU0+cqWeMZZTqmy8FOaxiJdLC2 3Huk41xDzTAYdQUd/4SBb9FOUQuexgDJqeWb8rYbH4zQ0wqwahk9TmfJhdUyt2qEvZEw3A/D/TV XRmgjOQvBNhDT8Wy+xdxGppyRl5mgNa820R/RH/IQ+0gPenmhQ1U8YiizGn/xsc2soSd7 X-Received: by 2002:a19:7413:0:b0:4f3:a99f:1ea7 with SMTP id v19-20020a197413000000b004f3a99f1ea7mr916257lfe.55.1684507813569; Fri, 19 May 2023 07:50:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4qANQQRUmSyE/TwtD2r+IpS9G0Y5O23eLP02MTZn+bsKqVBPJfgYaeWMubiwF/XkW+ruYQ9A== X-Received: by 2002:a19:7413:0:b0:4f3:a99f:1ea7 with SMTP id v19-20020a197413000000b004f3a99f1ea7mr916251lfe.55.1684507813323; Fri, 19 May 2023 07:50:13 -0700 (PDT) Date: Fri, 19 May 2023 10:50:08 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Fan Ni Subject: [PULL 07/40] hw/cxl: drop pointless memory_region_transaction_guards Message-ID: <23e1248d7e3cb7331a1cee13ff109a5c52471ec2.1684507742.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684507901003100001 From: Jonathan Cameron Not clear what intent was here, but probably based on a misunderstanding of what these guards are for. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Jonathan Cameron Message-Id: <20230421135906.3515-2-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/cxl/cxl-component-utils.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/hw/cxl/cxl-component-utils.c b/hw/cxl/cxl-component-utils.c index b665d4f565..324be79b11 100644 --- a/hw/cxl/cxl-component-utils.c +++ b/hw/cxl/cxl-component-utils.c @@ -47,14 +47,12 @@ static void dumb_hdm_handler(CXLComponentState *cxl_cst= ate, hwaddr offset, break; } =20 - memory_region_transaction_begin(); stl_le_p((uint8_t *)cache_mem + offset, value); if (should_commit) { ARRAY_FIELD_DP32(cache_mem, CXL_HDM_DECODER0_CTRL, COMMIT, 0); ARRAY_FIELD_DP32(cache_mem, CXL_HDM_DECODER0_CTRL, ERR, 0); ARRAY_FIELD_DP32(cache_mem, CXL_HDM_DECODER0_CTRL, COMMITTED, 1); } - memory_region_transaction_commit(); } =20 static void cxl_cache_mem_write_reg(void *opaque, hwaddr offset, uint64_t = value, --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684507881; cv=none; d=zohomail.com; s=zohoarc; b=T8pLaHq/8oIu7Ry9+8gz6X5bUE3aDGM0CIJr9qC77unNVEyrxEVHtFaCs45Rqp1SxCdXIwn6mB9lOMCBOJtAzwyYkOsZkuOVHQNBTjRO4aT+qfK1f7haR+1X+g+5/QMuftjLNQMpFEThx8q/TNFd87OKQHnE6h8dXw2QyhZn0fM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684507881; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SJKuAz/JWMsZ+1DzNWbmPjnID9bsDA/kvaU7AtGkj/E=; b=aX6V5/+9Lz70NzQ8MUimjflNNLFhtX1lyVbP4k7AmYJTR2ixC+KIheqbyaErPGILRgIwbnny0sdGaLBWdsnBUqqutK8MJrAPXUPqnpdqSZiwFBlYUAdjxvGleXDhUGWM5mixg/eatKRxz0B/fkc18qQUYL666Ii+sgQGpt64Z68= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684507881619618.9742058873744; Fri, 19 May 2023 07:51:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01R4-0007FJ-9e; Fri, 19 May 2023 10:50: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 1q01R2-0007Bj-HU for qemu-devel@nongnu.org; Fri, 19 May 2023 10:50:24 -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 1q01R1-0003WQ-16 for qemu-devel@nongnu.org; Fri, 19 May 2023 10:50:24 -0400 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-462-XowbH-SSNDqWIqs_y6BTgQ-1; Fri, 19 May 2023 10:50:20 -0400 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2af207a45bfso7173281fa.0 for ; Fri, 19 May 2023 07:50:20 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id q5-20020a2e9145000000b002addd80bc8csm831276ljg.66.2023.05.19.07.50.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:50:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507822; h=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=SJKuAz/JWMsZ+1DzNWbmPjnID9bsDA/kvaU7AtGkj/E=; b=feVv68OlFNzfnZYMHopd9KYcLXUjlqPYMTuJOZQ0ZXTbk4sz2wmUyQz0QVnrBgI85zUSzH 5aVRuZwpx6Otpen6A3vMplNSqkOC6ilmbeCZg1bGUH4ajISHyPLnw4ZtEE+LTaWBlNjh2z IYE6PMv8apDBlcujqgqdUCRxockFxf4= X-MC-Unique: XowbH-SSNDqWIqs_y6BTgQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507818; x=1687099818; 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=SJKuAz/JWMsZ+1DzNWbmPjnID9bsDA/kvaU7AtGkj/E=; b=CmTH4/6GPHBhe29lt2mqqFBIPalNDo28xhxNj8Zn0SpA0r+Y6aYMdBRXlBi6sATyyj fKAKFKee2ITkwhsvef0cvOdFu272RJ7cx8L03wOwWIHLTwpWODYGbkMY8G3qD+bsPSLz rhz5aM86tdubj2rBEolKYbGvNQCRJjwUwd5YNEIIPNMYTmKgYgWZyUHEJ4qF2MrwB/nJ z7tusl0GNO1OZhJjvclYBmMHAdDfeYnuVESxl9GLuzOa/+ikggsHcWTDPNDsceI8c1fd c6BbB/b4QgrQx1QSIB9Xs9oH9nJu0ExPwvCkd/Qt23mKknStAy0orviJXLzX4vALt4DM m8ww== X-Gm-Message-State: AC+VfDxjS+9J69lOXIIWJ9RLMpGNIim5ZSf7oIOlDtOiXM0sSPNt0lxG kLKX8YBdqfxHinFd8WaGqJdANRpHctYpVJRp8zLaWMmltRhGXD0vQyx3er3Q3qXneOyg9CNxb8z cHwI95Q9//LF+ZldJe9pG5I7tE6hYaEghpi2j2y6XmILQR9tdWlkops6/HRuPZJq39QqC X-Received: by 2002:a2e:320e:0:b0:2a6:1682:3a1e with SMTP id y14-20020a2e320e000000b002a616823a1emr903207ljy.31.1684507818716; Fri, 19 May 2023 07:50:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Awntf+GiRpdvXky++sABqbqKt+gwpgE8xRk8JtERdugO8JJfuCyRhrUMBNooKwTmrpVze6A== X-Received: by 2002:a2e:320e:0:b0:2a6:1682:3a1e with SMTP id y14-20020a2e320e000000b002a616823a1emr903198ljy.31.1684507818456; Fri, 19 May 2023 07:50:18 -0700 (PDT) Date: Fri, 19 May 2023 10:50:13 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Fan Ni Subject: [PULL 08/40] hw/cxl: Fix endian handling for decoder commit. Message-ID: <92ff7cabf97d9942ebaeafed6747dc18c8c1f697.1684507742.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684507882336100001 From: Jonathan Cameron Not a real problem yet as all supported architectures are little endian, but continue to tidy these up when touching code for other reasons. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Jonathan Cameron Message-Id: <20230421135906.3515-3-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/cxl/cxl-component-utils.c | 8 ++++---- hw/mem/cxl_type3.c | 9 ++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/hw/cxl/cxl-component-utils.c b/hw/cxl/cxl-component-utils.c index 324be79b11..a3e6cf75cf 100644 --- a/hw/cxl/cxl-component-utils.c +++ b/hw/cxl/cxl-component-utils.c @@ -47,12 +47,12 @@ static void dumb_hdm_handler(CXLComponentState *cxl_cst= ate, hwaddr offset, break; } =20 - stl_le_p((uint8_t *)cache_mem + offset, value); if (should_commit) { - ARRAY_FIELD_DP32(cache_mem, CXL_HDM_DECODER0_CTRL, COMMIT, 0); - ARRAY_FIELD_DP32(cache_mem, CXL_HDM_DECODER0_CTRL, ERR, 0); - ARRAY_FIELD_DP32(cache_mem, CXL_HDM_DECODER0_CTRL, COMMITTED, 1); + value =3D FIELD_DP32(value, CXL_HDM_DECODER0_CTRL, COMMIT, 0); + value =3D FIELD_DP32(value, CXL_HDM_DECODER0_CTRL, ERR, 0); + value =3D FIELD_DP32(value, CXL_HDM_DECODER0_CTRL, COMMITTED, 1); } + stl_le_p((uint8_t *)cache_mem + offset, value); } =20 static void cxl_cache_mem_write_reg(void *opaque, hwaddr offset, uint64_t = value, diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index 7647122cc6..a2a9b17dbb 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -314,14 +314,17 @@ static void hdm_decoder_commit(CXLType3Dev *ct3d, int= which) { ComponentRegisters *cregs =3D &ct3d->cxl_cstate.crb; uint32_t *cache_mem =3D cregs->cache_mem_registers; + uint32_t ctrl; =20 assert(which =3D=3D 0); =20 + ctrl =3D ldl_le_p(cache_mem + R_CXL_HDM_DECODER0_CTRL); /* TODO: Sanity checks that the decoder is possible */ - ARRAY_FIELD_DP32(cache_mem, CXL_HDM_DECODER0_CTRL, COMMIT, 0); - ARRAY_FIELD_DP32(cache_mem, CXL_HDM_DECODER0_CTRL, ERR, 0); + ctrl =3D FIELD_DP32(ctrl, CXL_HDM_DECODER0_CTRL, COMMIT, 0); + ctrl =3D FIELD_DP32(ctrl, CXL_HDM_DECODER0_CTRL, ERR, 0); + ctrl =3D FIELD_DP32(ctrl, CXL_HDM_DECODER0_CTRL, COMMITTED, 1); =20 - ARRAY_FIELD_DP32(cache_mem, CXL_HDM_DECODER0_CTRL, COMMITTED, 1); + stl_le_p(cache_mem + R_CXL_HDM_DECODER0_CTRL, ctrl); } =20 static int ct3d_qmp_uncor_err_to_cxl(CxlUncorErrorType qmp_err) --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508246; cv=none; d=zohomail.com; s=zohoarc; b=i5XFnzYa2rb/iFRks/bmyKJIGvrSU6LMG5lQPMWdvbPOdvMf9cx+c1FOm9GCMZh5R5FdSuHsB1UhGcRldnPORlxhzRz7qkNmrs5igytUPt0+IHSyeoJdjWBalpyemKoJauq+y7FO6WPS3QBeIq60/b1uZ33pMeg+OWFbKs5RehQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508246; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qFEsG82wdcWBrLH5mCcaWx1bEyowhZDMRDdFEaHzCA8=; b=IDn8VnswHFQcc3uVwkq7Dmw+SbEal6grJP1ivz7SQEWUjC0yNKEmlZaLj7qoWU4A/PRjE1KcMxwStewur4nlmA06AGnj9i+ZrHEwiQlJCYg3CZ6n3WJZUr86hotnjCCo/tbzetKolqFSGU4CoTM4CqKVf/A+iD1efb4wPzMtueI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508246788711.4008662602855; Fri, 19 May 2023 07:57:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01RM-0000Dv-71; Fri, 19 May 2023 10:50: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 1q01RF-0008LO-TU for qemu-devel@nongnu.org; Fri, 19 May 2023 10:50:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q01RE-0003YY-1k for qemu-devel@nongnu.org; Fri, 19 May 2023 10:50:37 -0400 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-520-v7qOT5QnMh2OcJAlmnqWYA-1; Fri, 19 May 2023 10:50:25 -0400 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2af27fa8bf2so2438261fa.2 for ; Fri, 19 May 2023 07:50:25 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id a6-20020a19f806000000b004f13bd73419sm631452lff.38.2023.05.19.07.50.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:50:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507835; h=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=qFEsG82wdcWBrLH5mCcaWx1bEyowhZDMRDdFEaHzCA8=; b=QPJ5HVCPq6mp7Dhkc2fQn39GoZJbGs0mxLnDJdcJlvY2CPrTOudcGpW0oqKxdLW4vHxi/c nEmQ1P0P1m/1htkEmdT70VzgP7astKHjFoQMoZzAb3kEzDoGqSgBuLAqstVyy1Om8sOwFJ ULdHYyAKeJ5NqQwA1GNYnKc9ieNUhBI= X-MC-Unique: v7qOT5QnMh2OcJAlmnqWYA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507824; x=1687099824; 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=qFEsG82wdcWBrLH5mCcaWx1bEyowhZDMRDdFEaHzCA8=; b=W9yP66yQTJcJu8msiTbTknpMAzqHzBwHl39xdkB+uC+DeoE0iqu7lhq1r377StGFYI 7nh+vlV85u1PBRyuK3vukcqUhoBaOn9NAaChy12UGjP9sm6vRLreP/xJg2mP5CHQhLTe p8gV0ityOzBpmggubjZyy6NpR8HZCtFbO1SkZw+pb8e3zah/wF+GVZxCios21MZltpqT 0lgGB/fCfob7EGsJR5OXyNEEzed1fAWLVOlxON0Wg6rgjDOoxq0GG0u1CJm62i4+kamP eWKJUNZkX3hmZHeq/YcZTWLul/9dm/y2tC+z1JXr6USDfGsIvZmDo5jTNrTl+4ziraEm zngQ== X-Gm-Message-State: AC+VfDxtHfsnWqt9JUeznXZF6FMqH24aTAcYmsqXufSV2Xe0wYEynGN6 Qh9t6ozvBmWkVVH3H74iaCP5jOvDoSxMyfEdWIfr8VGCFC9Z3vEOOCDFpYfxNJPy9usm/4EmGvb S1/Qu++2xAY6f6MYx/SVUdV09/ZqEL5Zxb1KylKC/ylgE8fPnuj61aN+SULdd3tckJloZ X-Received: by 2002:ac2:5991:0:b0:4f3:940d:abc with SMTP id w17-20020ac25991000000b004f3940d0abcmr869544lfn.0.1684507824022; Fri, 19 May 2023 07:50:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5n78MbVsxkWFsyu5rNdlpOSNk1bhknnKewoxEIrWN4dnDxl/oXonOddY2S7c9OUSzSgFhd8A== X-Received: by 2002:ac2:5991:0:b0:4f3:940d:abc with SMTP id w17-20020ac25991000000b004f3940d0abcmr869534lfn.0.1684507823752; Fri, 19 May 2023 07:50:23 -0700 (PDT) Date: Fri, 19 May 2023 10:50:18 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Fan Ni , Dave Jiang Subject: [PULL 09/40] hw/cxl: Fix incorrect reset of commit and associated clearing of committed. Message-ID: <823371a630599346fd04d541f19b52e72ee84f7e.1684507742.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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508248480100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jonathan Cameron The hardware clearing the commit bit is not spec compliant. Clearing of committed bit when commit is cleared is not specifically stated in the CXL spec, but is the expected (and simplest) permitted behaviour so use that for QEMU emulation. Reviewed-by: Fan Ni Tested-by: Fan Ni Reviewed-by: Dave Jiang Signed-off-by: Jonathan Cameron -- v2: Picked up tags. Message-Id: <20230421135906.3515-4-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/cxl/cxl-component-utils.c | 6 +++++- hw/mem/cxl_type3.c | 21 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/hw/cxl/cxl-component-utils.c b/hw/cxl/cxl-component-utils.c index a3e6cf75cf..378f1082ce 100644 --- a/hw/cxl/cxl-component-utils.c +++ b/hw/cxl/cxl-component-utils.c @@ -38,19 +38,23 @@ static void dumb_hdm_handler(CXLComponentState *cxl_cst= ate, hwaddr offset, ComponentRegisters *cregs =3D &cxl_cstate->crb; uint32_t *cache_mem =3D cregs->cache_mem_registers; bool should_commit =3D false; + bool should_uncommit =3D false; =20 switch (offset) { case A_CXL_HDM_DECODER0_CTRL: should_commit =3D FIELD_EX32(value, CXL_HDM_DECODER0_CTRL, COMMIT); + should_uncommit =3D !should_commit; break; default: break; } =20 if (should_commit) { - value =3D FIELD_DP32(value, CXL_HDM_DECODER0_CTRL, COMMIT, 0); value =3D FIELD_DP32(value, CXL_HDM_DECODER0_CTRL, ERR, 0); value =3D FIELD_DP32(value, CXL_HDM_DECODER0_CTRL, COMMITTED, 1); + } else if (should_uncommit) { + value =3D FIELD_DP32(value, CXL_HDM_DECODER0_CTRL, ERR, 0); + value =3D FIELD_DP32(value, CXL_HDM_DECODER0_CTRL, COMMITTED, 0); } stl_le_p((uint8_t *)cache_mem + offset, value); } diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index a2a9b17dbb..1bd5963a3f 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -320,13 +320,28 @@ static void hdm_decoder_commit(CXLType3Dev *ct3d, int= which) =20 ctrl =3D ldl_le_p(cache_mem + R_CXL_HDM_DECODER0_CTRL); /* TODO: Sanity checks that the decoder is possible */ - ctrl =3D FIELD_DP32(ctrl, CXL_HDM_DECODER0_CTRL, COMMIT, 0); ctrl =3D FIELD_DP32(ctrl, CXL_HDM_DECODER0_CTRL, ERR, 0); ctrl =3D FIELD_DP32(ctrl, CXL_HDM_DECODER0_CTRL, COMMITTED, 1); =20 stl_le_p(cache_mem + R_CXL_HDM_DECODER0_CTRL, ctrl); } =20 +static void hdm_decoder_uncommit(CXLType3Dev *ct3d, int which) +{ + ComponentRegisters *cregs =3D &ct3d->cxl_cstate.crb; + uint32_t *cache_mem =3D cregs->cache_mem_registers; + uint32_t ctrl; + + assert(which =3D=3D 0); + + ctrl =3D ldl_le_p(cache_mem + R_CXL_HDM_DECODER0_CTRL); + + ctrl =3D FIELD_DP32(ctrl, CXL_HDM_DECODER0_CTRL, ERR, 0); + ctrl =3D FIELD_DP32(ctrl, CXL_HDM_DECODER0_CTRL, COMMITTED, 0); + + stl_le_p(cache_mem + R_CXL_HDM_DECODER0_CTRL, ctrl); +} + static int ct3d_qmp_uncor_err_to_cxl(CxlUncorErrorType qmp_err) { switch (qmp_err) { @@ -395,6 +410,7 @@ static void ct3d_reg_write(void *opaque, hwaddr offset,= uint64_t value, CXLType3Dev *ct3d =3D container_of(cxl_cstate, CXLType3Dev, cxl_cstate= ); uint32_t *cache_mem =3D cregs->cache_mem_registers; bool should_commit =3D false; + bool should_uncommit =3D false; int which_hdm =3D -1; =20 assert(size =3D=3D 4); @@ -403,6 +419,7 @@ static void ct3d_reg_write(void *opaque, hwaddr offset,= uint64_t value, switch (offset) { case A_CXL_HDM_DECODER0_CTRL: should_commit =3D FIELD_EX32(value, CXL_HDM_DECODER0_CTRL, COMMIT); + should_uncommit =3D !should_commit; which_hdm =3D 0; break; case A_CXL_RAS_UNC_ERR_STATUS: @@ -489,6 +506,8 @@ static void ct3d_reg_write(void *opaque, hwaddr offset,= uint64_t value, stl_le_p((uint8_t *)cache_mem + offset, value); if (should_commit) { hdm_decoder_commit(ct3d, which_hdm); + } else if (should_uncommit) { + hdm_decoder_uncommit(ct3d, which_hdm); } } =20 --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684507956; cv=none; d=zohomail.com; s=zohoarc; b=ikmQ1P3mpMFXEMZ7/8KFQQJwxeMNTPaVW0LfMxnVb6N16OqegvhSSs0Hsi/l7XdPkJlIDemv05Jn8yzwgq9P7vpQYzwcQaHuseSQbN6YMLGiQJVn1zSoEaTWKVqLGqDQ/pn1nwk9FsQskgab7/4ZxYF8ccl+GfVyaVv4CiVvqYs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684507956; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OnZ6eLMzZsROly4VW6ysnh46XonOIPRp/Ia9O8cYqm8=; b=cKzt4wC+EahHIpIt7QgmlZwVfS4KSULlMjeMDLgGmqwAFruNDZm1ypn37+WGpzlYO4CdqSMHTazNTtkDeOACrtjSW9DZZs5ja+UlmZQ6xyO3FZqDBtMBiSGd/GKyD58oXAmkOff1d3JqPkqbTlJG6mPv/loTtVBKWSuW8TWouzE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684507956065832.8348740890945; Fri, 19 May 2023 07:52:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01RR-0000ov-5V; Fri, 19 May 2023 10:50: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 1q01RM-0000HE-JJ for qemu-devel@nongnu.org; Fri, 19 May 2023 10:50: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 1q01RK-0003ZO-4E for qemu-devel@nongnu.org; Fri, 19 May 2023 10:50:44 -0400 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-620-KSYbPigzO6mS6q07r73Csg-1; Fri, 19 May 2023 10:50:32 -0400 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-4f3b27050e7so174423e87.3 for ; Fri, 19 May 2023 07:50:32 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id v11-20020a056512096b00b004eefdd8b37fsm613067lft.194.2023.05.19.07.50.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:50:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507841; h=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=OnZ6eLMzZsROly4VW6ysnh46XonOIPRp/Ia9O8cYqm8=; b=bYHAq7m4GYk+4K9juhc1y2mE82kn0YXVUlgbUoXZK/xCsiJRvsrDdVBFWaUXiPamn9nOwW 0+6EXzHhj7/O3J1pHSjjWhYhaKssBISK7M7VGruoTviC7YLw2n8HOz3HPW0kn0j618ptqR s/IsL+YER6hkJMqIPvE+RGdx7vv26Ro= X-MC-Unique: KSYbPigzO6mS6q07r73Csg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507831; x=1687099831; 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=OnZ6eLMzZsROly4VW6ysnh46XonOIPRp/Ia9O8cYqm8=; b=fuhM8HoDisFT/PlQ0S6J85ggsHdIa1fXlw4hQ8NMofmBFZrKntxoZEXWu1DVIEwL+t rZC/Qab3nDqMK0F47vn/tXqnki03WNlpBoIrwkBAmVy9abXYeYYeQR7aLg4i6qftdGDI pkKsRrPboV+7Gv4SFeMGtfSxPa+rSlq+E+uoZcz9bES3izhYSgfQK4W85FmfntWURRkf WcA6s+qX4rLgXmC1WwKXEwsMrrx2/T8JsFyN7/TMooR07YKchHamNgPikRkO6Kng1jmB ibFfuBBc9DErclMggDT+FtenUrOGPFCaMgLZQkMIXhoARxeOW2RjW5v3jNJ1Kh7WXHCK IcHw== X-Gm-Message-State: AC+VfDx4KFq6zd1B7mLGGbE5nh650y96UY7Li8qjbPmoF0M14scsm493 jxGmVYwVgxEem+LFhLdr0xkvJfUrUDy7OIwGdu/SvjBq+PaRj5xsCMkXJ0SCBR8YUMix61e8OO2 uxTsVhsIN3sUvRrYtSFqLFZMdEzOb7O8SiKHSSSJpod2GDxp/QoI+e8d5QtJiWqVIOjko X-Received: by 2002:a05:6512:147:b0:4f1:4040:8143 with SMTP id m7-20020a056512014700b004f140408143mr910906lfo.60.1684507830730; Fri, 19 May 2023 07:50:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5RV4bZyW+fXhp+UglkWYSonB9HMDcdeGCQZ6otuMQvgmg0WN9fcp8yEh9C90zQZ+hcqJOWWQ== X-Received: by 2002:a05:6512:147:b0:4f1:4040:8143 with SMTP id m7-20020a056512014700b004f140408143mr910891lfo.60.1684507830450; Fri, 19 May 2023 07:50:30 -0700 (PDT) Date: Fri, 19 May 2023 10:50:24 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Gregory Price , Gregory Price , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Jonathan Cameron , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PULL 10/40] tests/qtest/cxl-test: whitespace, line ending cleanup Message-ID: <847ea4e746a1cac861ffe6b8256052131e8e3b93.1684507742.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684507957950100003 From: Gregory Price Defines are starting to exceed line length limits, align them for cleanliness before making modifications. Signed-off-by: Gregory Price Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Jonathan Cameron Message-Id: <20230421160827.2227-2-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/cxl-test.c | 78 +++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 35 deletions(-) diff --git a/tests/qtest/cxl-test.c b/tests/qtest/cxl-test.c index 61f25a72b6..eda2bbbbe6 100644 --- a/tests/qtest/cxl-test.c +++ b/tests/qtest/cxl-test.c @@ -8,50 +8,58 @@ #include "qemu/osdep.h" #include "libqtest-single.h" =20 -#define QEMU_PXB_CMD "-machine q35,cxl=3Don " \ - "-device pxb-cxl,id=3Dcxl.0,bus=3Dpcie.0,bus_nr=3D52 = " \ - "-M cxl-fmw.0.targets.0=3Dcxl.0,cxl-fmw.0.size=3D4G " +#define QEMU_PXB_CMD \ + "-machine q35,cxl=3Don " \ + "-device pxb-cxl,id=3Dcxl.0,bus=3Dpcie.0,bus_nr=3D52 " \ + "-M cxl-fmw.0.targets.0=3Dcxl.0,cxl-fmw.0.size=3D4G " =20 -#define QEMU_2PXB_CMD "-machine q35,cxl=3Don " \ - "-device pxb-cxl,id=3Dcxl.0,bus=3Dpcie.0,bus_nr=3D52= " \ - "-device pxb-cxl,id=3Dcxl.1,bus=3Dpcie.0,bus_nr=3D53= " \ - "-M cxl-fmw.0.targets.0=3Dcxl.0,cxl-fmw.0.targets.1= =3Dcxl.1,cxl-fmw.0.size=3D4G " +#define QEMU_2PXB_CMD \ + "-machine q35,cxl=3Don " \ + "-device pxb-cxl,id=3Dcxl.0,bus=3Dpcie.0,bus_nr=3D52 " \ + "-device pxb-cxl,id=3Dcxl.1,bus=3Dpcie.0,bus_nr=3D53 " \ + "-M cxl-fmw.0.targets.0=3Dcxl.0,cxl-fmw.0.targets.1=3Dcxl.1,cxl-fmw.0.= size=3D4G " =20 -#define QEMU_RP "-device cxl-rp,id=3Drp0,bus=3Dcxl.0,chassis=3D0,slot=3D0 " +#define QEMU_RP \ + "-device cxl-rp,id=3Drp0,bus=3Dcxl.0,chassis=3D0,slot=3D0 " =20 /* Dual ports on first pxb */ -#define QEMU_2RP "-device cxl-rp,id=3Drp0,bus=3Dcxl.0,chassis=3D0,slot=3D0= " \ - "-device cxl-rp,id=3Drp1,bus=3Dcxl.0,chassis=3D0,slot=3D1= " +#define QEMU_2RP \ + "-device cxl-rp,id=3Drp0,bus=3Dcxl.0,chassis=3D0,slot=3D0 " \ + "-device cxl-rp,id=3Drp1,bus=3Dcxl.0,chassis=3D0,slot=3D1 " =20 /* Dual ports on each of the pxb instances */ -#define QEMU_4RP "-device cxl-rp,id=3Drp0,bus=3Dcxl.0,chassis=3D0,slot=3D0= " \ - "-device cxl-rp,id=3Drp1,bus=3Dcxl.0,chassis=3D0,slot=3D1= " \ - "-device cxl-rp,id=3Drp2,bus=3Dcxl.1,chassis=3D0,slot=3D2= " \ - "-device cxl-rp,id=3Drp3,bus=3Dcxl.1,chassis=3D0,slot=3D3= " +#define QEMU_4RP \ + "-device cxl-rp,id=3Drp0,bus=3Dcxl.0,chassis=3D0,slot=3D0 " \ + "-device cxl-rp,id=3Drp1,bus=3Dcxl.0,chassis=3D0,slot=3D1 " \ + "-device cxl-rp,id=3Drp2,bus=3Dcxl.1,chassis=3D0,slot=3D2 " \ + "-device cxl-rp,id=3Drp3,bus=3Dcxl.1,chassis=3D0,slot=3D3 " =20 -#define QEMU_T3D "-object memory-backend-file,id=3Dcxl-mem0,mem-path=3D%s,= size=3D256M " \ - "-object memory-backend-file,id=3Dlsa0,mem-path=3D%s,size= =3D256M " \ - "-device cxl-type3,bus=3Drp0,memdev=3Dcxl-mem0,lsa=3Dlsa0= ,id=3Dcxl-pmem0 " +#define QEMU_T3D \ + "-object memory-backend-file,id=3Dcxl-mem0,mem-path=3D%s,size=3D256M "= \ + "-object memory-backend-file,id=3Dlsa0,mem-path=3D%s,size=3D256M " \ + "-device cxl-type3,bus=3Drp0,memdev=3Dcxl-mem0,lsa=3Dlsa0,id=3Dcxl-pme= m0 " =20 -#define QEMU_2T3D "-object memory-backend-file,id=3Dcxl-mem0,mem-path=3D%s= ,size=3D256M " \ - "-object memory-backend-file,id=3Dlsa0,mem-path=3D%s,siz= e=3D256M " \ - "-device cxl-type3,bus=3Drp0,memdev=3Dcxl-mem0,lsa=3Dlsa= 0,id=3Dcxl-pmem0 " \ - "-object memory-backend-file,id=3Dcxl-mem1,mem-path=3D%s= ,size=3D256M " \ - "-object memory-backend-file,id=3Dlsa1,mem-path=3D%s,siz= e=3D256M " \ - "-device cxl-type3,bus=3Drp1,memdev=3Dcxl-mem1,lsa=3Dlsa= 1,id=3Dcxl-pmem1 " +#define QEMU_2T3D \ + "-object memory-backend-file,id=3Dcxl-mem0,mem-path=3D%s,size=3D256M "= \ + "-object memory-backend-file,id=3Dlsa0,mem-path=3D%s,size=3D256M " \ + "-device cxl-type3,bus=3Drp0,memdev=3Dcxl-mem0,lsa=3Dlsa0,id=3Dcxl-pme= m0 " \ + "-object memory-backend-file,id=3Dcxl-mem1,mem-path=3D%s,size=3D256M "= \ + "-object memory-backend-file,id=3Dlsa1,mem-path=3D%s,size=3D256M " \ + "-device cxl-type3,bus=3Drp1,memdev=3Dcxl-mem1,lsa=3Dlsa1,id=3Dcxl-pme= m1 " =20 -#define QEMU_4T3D "-object memory-backend-file,id=3Dcxl-mem0,mem-path=3D%s= ,size=3D256M " \ - "-object memory-backend-file,id=3Dlsa0,mem-path=3D%s,siz= e=3D256M " \ - "-device cxl-type3,bus=3Drp0,memdev=3Dcxl-mem0,lsa=3Dlsa= 0,id=3Dcxl-pmem0 " \ - "-object memory-backend-file,id=3Dcxl-mem1,mem-path=3D%s= ,size=3D256M " \ - "-object memory-backend-file,id=3Dlsa1,mem-path=3D%s,siz= e=3D256M " \ - "-device cxl-type3,bus=3Drp1,memdev=3Dcxl-mem1,lsa=3Dlsa= 1,id=3Dcxl-pmem1 " \ - "-object memory-backend-file,id=3Dcxl-mem2,mem-path=3D%s= ,size=3D256M " \ - "-object memory-backend-file,id=3Dlsa2,mem-path=3D%s,siz= e=3D256M " \ - "-device cxl-type3,bus=3Drp2,memdev=3Dcxl-mem2,lsa=3Dlsa= 2,id=3Dcxl-pmem2 " \ - "-object memory-backend-file,id=3Dcxl-mem3,mem-path=3D%s= ,size=3D256M " \ - "-object memory-backend-file,id=3Dlsa3,mem-path=3D%s,siz= e=3D256M " \ - "-device cxl-type3,bus=3Drp3,memdev=3Dcxl-mem3,lsa=3Dlsa= 3,id=3Dcxl-pmem3 " +#define QEMU_4T3D \ + "-object memory-backend-file,id=3Dcxl-mem0,mem-path=3D%s,size=3D256M "= \ + "-object memory-backend-file,id=3Dlsa0,mem-path=3D%s,size=3D256M " \ + "-device cxl-type3,bus=3Drp0,memdev=3Dcxl-mem0,lsa=3Dlsa0,id=3Dcxl-pme= m0 " \ + "-object memory-backend-file,id=3Dcxl-mem1,mem-path=3D%s,size=3D256M "= \ + "-object memory-backend-file,id=3Dlsa1,mem-path=3D%s,size=3D256M " \ + "-device cxl-type3,bus=3Drp1,memdev=3Dcxl-mem1,lsa=3Dlsa1,id=3Dcxl-pme= m1 " \ + "-object memory-backend-file,id=3Dcxl-mem2,mem-path=3D%s,size=3D256M "= \ + "-object memory-backend-file,id=3Dlsa2,mem-path=3D%s,size=3D256M " \ + "-device cxl-type3,bus=3Drp2,memdev=3Dcxl-mem2,lsa=3Dlsa2,id=3Dcxl-pme= m2 " \ + "-object memory-backend-file,id=3Dcxl-mem3,mem-path=3D%s,size=3D256M "= \ + "-object memory-backend-file,id=3Dlsa3,mem-path=3D%s,size=3D256M " \ + "-device cxl-type3,bus=3Drp3,memdev=3Dcxl-mem3,lsa=3Dlsa3,id=3Dcxl-pme= m3 " =20 static void cxl_basic_hb(void) { --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684507882; cv=none; d=zohomail.com; s=zohoarc; b=M+WqbB3BcpBrJUSle41esCXsL60xYVqzbOWPzbZNhJVEVH7QMep/KSvXhUoLg8GFvA6jhi8PjdqGuc5lOC1p8mDxe35A2MLnFX7sCTXBg0BofdHHT4su1xv0plted2rQKmg3i+RPIVoEIXm1ud/wYVjzR8oQOL5GfIZiX1gdZEo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684507882; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=d8Vso+Qj5ywaim6O4xRNK9ALzOFtW4T9mhpU0PHW6Hs=; b=d6eD2ulMJLMZYHjPrVaVaj9J8X3wcRAIsn2Jyx54QVK4OD7hD9BjJ1T28+2Mj6WpX5nEAd9N/RgHe2vyCZnmaO1r9/JJOzcxbfLPTASvmTII7hHGBdgzbtKM6z3/fKBKYDgxF3nTkJ8dS0yECRsCrcTfvM62Kdf1mU+grh7RW+o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684507882898290.66176821597946; Fri, 19 May 2023 07:51:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01RM-0000H3-Mj; Fri, 19 May 2023 10:50: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 1q01RJ-0008Rk-Kb for qemu-devel@nongnu.org; Fri, 19 May 2023 10:50:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q01RI-0003Z5-0P for qemu-devel@nongnu.org; Fri, 19 May 2023 10:50:41 -0400 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-593-tc1rH6rmNYe7wOaycsHHQw-1; Fri, 19 May 2023 10:50:38 -0400 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2af1589c75aso13513011fa.2 for ; Fri, 19 May 2023 07:50:37 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id d26-20020a2e361a000000b002ab397f1b0bsm860993lja.3.2023.05.19.07.50.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:50:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507839; h=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=d8Vso+Qj5ywaim6O4xRNK9ALzOFtW4T9mhpU0PHW6Hs=; b=aJQHzbu2y7g3e+EJPy8PvWuKAJrMQBU3DRZmWC8CHlTLH+W+8nkCi1ywanrjlMohhwg1k1 NS0qVr3LDxrvGakEq3WsNyHKFukEYBng6S8dcz99GQURySxOBSgpqqrZd2+vjXkiXjJeSr YBgNWuYPgVweIdjZfigzk26jMYDFmVQ= X-MC-Unique: tc1rH6rmNYe7wOaycsHHQw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507836; x=1687099836; 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=d8Vso+Qj5ywaim6O4xRNK9ALzOFtW4T9mhpU0PHW6Hs=; b=Ow/O1THLAnY4nE12/sBJk9KJ34CltQvlFKU0OhJhUthlQFSEd7kySCzBVJYlajQn8O SQF8bduHLv0iX0I0Rkl6mULSGBpBBuUltDBk6eZQUVfKoWGDOcg2eIEtjkJm6dgF4f4q lSqiIk8Kfs3ck94Z7uCEIeM4PQw1RxqlXXd6zwQmIr5Lw/CNUthEpewd9FMso8x6fY/L Og//rpHo0Xxf52jtExWfVBPxNJyONeEL2GdNjtt67dTkVEAZHfOr0UJxgs0QjOMPWAsQ mKMaQGp8/JyLsqgJv2nXoWcds1zVhad7lEfG9hVPB6UZCHR54dXkaNjtSybeOiIueaZ1 u47w== X-Gm-Message-State: AC+VfDx7jcWgt2vH+uR1oLWQWlTE+fCmduyjTqAZBwLq4UmSQp/5A/0g 3/+uDbc4ROcuRqAAiskukjcoLMQoppLi7RrqNaJpLosIqSxq9gBTcYMPifitEjYU+/xycQzGInX DZkWPogZTZINLXlSAEi4Gewstr6vVw8J0WtJSpo5xxzmJ2r4G7FJxqP/o1c2dcEzFOAds X-Received: by 2002:a2e:8456:0:b0:2af:1d3b:accd with SMTP id u22-20020a2e8456000000b002af1d3baccdmr1040842ljh.33.1684507836175; Fri, 19 May 2023 07:50:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ799TimEDBb5fq5ccEJVcm8ehOqhOS7r4ow2oignp2+1Lieojm+y0PaGgmPyZk35vuLd1A35w== X-Received: by 2002:a2e:8456:0:b0:2af:1d3b:accd with SMTP id u22-20020a2e8456000000b002af1d3baccdmr1040833ljh.33.1684507835912; Fri, 19 May 2023 07:50:35 -0700 (PDT) Date: Fri, 19 May 2023 10:50:30 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Gregory Price , Fan Ni Subject: [PULL 11/40] hw/mem: Use memory_region_size() in cxl_type3 Message-ID: <3521176526a901bd2a8418ce6470df0e38ca4e11.1684507742.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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684507883926100007 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jonathan Cameron Accessors prefered over direct use of int128_get64() as they clamp out of range values. None are expected here but cleaner to always use the accessor than mix and match. Signed-off-by: Jonathan Cameron Message-Id: <20230421160827.2227-3-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Gregory Price --- hw/mem/cxl_type3.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index 1bd5963a3f..2db756851c 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -52,7 +52,7 @@ static int ct3_build_cdat_entries_for_mr(CDATSubHeader **= cdat_table, .DSMADhandle =3D dsmad_handle, .flags =3D CDAT_DSMAS_FLAG_NV, .DPA_base =3D 0, - .DPA_length =3D int128_get64(mr->size), + .DPA_length =3D memory_region_size(mr), }; =20 /* For now, no memory side cache, plausiblish numbers */ @@ -133,7 +133,7 @@ static int ct3_build_cdat_entries_for_mr(CDATSubHeader = **cdat_table, /* Reserved - the non volatile from DSMAS matters */ .EFI_memory_type_attr =3D 2, .DPA_offset =3D 0, - .DPA_length =3D int128_get64(mr->size), + .DPA_length =3D memory_region_size(mr), }; =20 /* Header always at start of structure */ @@ -698,7 +698,7 @@ MemTxResult cxl_type3_read(PCIDevice *d, hwaddr host_ad= dr, uint64_t *data, return MEMTX_ERROR; } =20 - if (dpa_offset > int128_get64(mr->size)) { + if (dpa_offset > memory_region_size(mr)) { return MEMTX_ERROR; } =20 @@ -721,7 +721,7 @@ MemTxResult cxl_type3_write(PCIDevice *d, hwaddr host_a= ddr, uint64_t data, return MEMTX_OK; } =20 - if (dpa_offset > int128_get64(mr->size)) { + if (dpa_offset > memory_region_size(mr)) { return MEMTX_OK; } return address_space_write(&ct3d->hostmem_as, dpa_offset, attrs, --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684507859; cv=none; d=zohomail.com; s=zohoarc; b=Yg3sLsQmsFZHgkC3Jg9KPw6T4yUwTfEnejb5XpfAbRmhq1LOC+7Ld0rL2J+QuIhwVFXIfAd9mkuvSPdpBnm6mKt2RA61hYQPsSCxWAXxZTuSBPReQmbmNo0miZuIKPY0S23svTAt+ESDDCCf/dW2f5AJleESs0NDhXT65cXcgyk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684507859; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4U/14sfZhlFfC8BaIVkdltDJxltfSQtXgLnD2+kk0Jc=; b=c3UsVoMXXII95gDFmylEKK8pauun5kDege9mIdPkvug60Fhi9r+JFuak1wApIE4M3K/doA/L1k+Jl4ucW4PvlWjqVCrvDuDSyKOzBxzdHfDCAilDiTFLTNyu9iVc4EFlUjkP3BCNDxFyOQEwGU/ebNPuRonBEuvSZXLnKghj3JA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1684507859577288.0755764419391; Fri, 19 May 2023 07:50:59 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-340-uRVyhx3GOcaVBjELiUJCTw-1; Fri, 19 May 2023 10:50:55 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 16489384CC62; Fri, 19 May 2023 14:50:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A847D7AF5; Fri, 19 May 2023 14:50:51 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 7F4C219465B2; Fri, 19 May 2023 14:50:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9443119465A4 for ; Fri, 19 May 2023 14:50:50 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 50683407DEC3; Fri, 19 May 2023 14:50:50 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4896E407DEC0 for ; Fri, 19 May 2023 14:50:50 +0000 (UTC) Received: from us-smtp-inbound-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 22541101A53B for ; Fri, 19 May 2023 14:50:50 +0000 (UTC) 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-67-9ujIXVd4N_ujiiiHhUO6Ig-1; Fri, 19 May 2023 10:50:46 -0400 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-4f256ddef3aso2210014e87.2 for ; Fri, 19 May 2023 07:50:46 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id u3-20020ac25183000000b004f13ca69dc8sm631164lfi.72.2023.05.19.07.50.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:50:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507858; h=from:from:sender:sender: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:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=4U/14sfZhlFfC8BaIVkdltDJxltfSQtXgLnD2+kk0Jc=; b=c9FDayrGlWUgT/kAPMoGbMvjFR+1fVwSzhMtophX+b30pxNiaayacqt+rjiCP3m1Tpgk1L Zg7rb74sqopWln5nA1jHX11dWq9LtZfTuPWh/X05ABglhAODURM8cN4UASsKjAjn2Tt+YG usoeJwKbLV+uOJwNGYV5ZH7NgbWVJ5M= X-MC-Unique: uRVyhx3GOcaVBjELiUJCTw-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: 9ujIXVd4N_ujiiiHhUO6Ig-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507845; x=1687099845; 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=4U/14sfZhlFfC8BaIVkdltDJxltfSQtXgLnD2+kk0Jc=; b=gMwnZKrpN/Lm6YukDIEBNjgJmuBqUrPsHFS2TY1DksSF8apnaPQZbfa5+zqmREE9BI qCMa6WrTfSuSQiZKjxp1rcahL4dPwXFNMU192ePEsza2yCQRKOD8JhEmkKPelybjYNPs QAq9VFDqHEpgRXZSCeIKzwawFoVqPCK8yjr0FUpRx4TMLwCNezop5dxI8DA9bJ9YNTo8 OHemgNnA39v5Vmz/X3ruUR6qESvdrEkVEED34L0EImF5C+FDa7lYAevLtmuQgDefyuGZ m6TmCHLbZ884Qiw/TXnbreG0qaVKLox4byEu/TRNoXfiB0DLCuOAbA62Z9fDnxS2ydh2 XJJg== X-Gm-Message-State: AC+VfDwiiCmf+kjA3H1I3LNFGpqxIkCgAHHvkNvfFPWRF6pyrlOnXqvY 8KK/YSltLljwb+SlQNxAXm+YrfVxl02Ww+11f7tJzLIr2rx5mmTv1oo8ej4Qln9uvK/DxHenEol /TfJed3Q85C375dmCEBc= X-Received: by 2002:ac2:5298:0:b0:4f3:b1dc:b46b with SMTP id q24-20020ac25298000000b004f3b1dcb46bmr427027lfm.1.1684507844513; Fri, 19 May 2023 07:50:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4aF194ASQYfgYz3pBdbvbdO2j6zPHcwBCWYfEJ3cho4nQtZ3kWa3qXWLLTDn01Sc3ls9WSoQ== X-Received: by 2002:ac2:5298:0:b0:4f3:b1dc:b46b with SMTP id q24-20020ac25298000000b004f3b1dcb46bmr427011lfm.1.1684507844022; Fri, 19 May 2023 07:50:44 -0700 (PDT) Date: Fri, 19 May 2023 10:50:36 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 12/40] hw/cxl: Multi-Region CXL Type-3 Devices (Volatile and Persistent) Message-ID: References: MIME-Version: 1.0 In-Reply-To: X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Davidlohr Bueso , libvir-list@redhat.com, Paolo Bonzini , Ani Sinha , Jonathan Cameron , Igor Mammedov , Gregory Price , Fan Ni Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684507860311100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Gregory Price This commit enables each CXL Type-3 device to contain one volatile memory region and one persistent region. Two new properties have been added to cxl-type3 device initialization: [volatile-memdev] and [persistent-memdev] The existing [memdev] property has been deprecated and will default the memory region to a persistent memory region (although a user may assign the region to a ram or file backed region). It cannot be used in combination with the new [persistent-memdev] property. Partitioning volatile memory from persistent memory is not yet supported. Volatile memory is mapped at DPA(0x0), while Persistent memory is mapped at DPA(vmem->size), per CXL Spec 8.2.9.8.2.0 - Get Partition Info. Signed-off-by: Gregory Price Reviewed-by: Davidlohr Bueso Reviewed-by: Fan Ni Tested-by: Fan Ni Signed-off-by: Jonathan Cameron Message-Id: <20230421160827.2227-4-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/cxl/cxl_device.h | 11 +- hw/cxl/cxl-mailbox-utils.c | 32 ++-- hw/mem/cxl_type3.c | 306 ++++++++++++++++++++++++--------- tests/qtest/bios-tables-test.c | 8 +- tests/qtest/cxl-test.c | 76 ++++++-- docs/about/deprecated.rst | 8 + docs/system/devices/cxl.rst | 49 ++++-- 7 files changed, 371 insertions(+), 119 deletions(-) diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h index d589f78202..edb9791bab 100644 --- a/include/hw/cxl/cxl_device.h +++ b/include/hw/cxl/cxl_device.h @@ -119,8 +119,10 @@ typedef struct cxl_device_state { uint64_t host_set; } timestamp; =20 - /* memory region for persistent memory, HDM */ + /* memory region size, HDM */ + uint64_t mem_size; uint64_t pmem_size; + uint64_t vmem_size; } CXLDeviceState; =20 /* Initialize the register block for a device */ @@ -245,12 +247,15 @@ struct CXLType3Dev { PCIDevice parent_obj; =20 /* Properties */ - HostMemoryBackend *hostmem; + HostMemoryBackend *hostmem; /* deprecated */ + HostMemoryBackend *hostvmem; + HostMemoryBackend *hostpmem; HostMemoryBackend *lsa; uint64_t sn; =20 /* State */ - AddressSpace hostmem_as; + AddressSpace hostvmem_as; + AddressSpace hostpmem_as; CXLComponentState cxl_cstate; CXLDeviceState cxl_dstate; =20 diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index 206e04a4b8..ed663cc04a 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -141,7 +141,8 @@ static ret_code cmd_firmware_update_get_info(struct cxl= _cmd *cmd, } QEMU_PACKED *fw_info; QEMU_BUILD_BUG_ON(sizeof(*fw_info) !=3D 0x50); =20 - if (cxl_dstate->pmem_size < CXL_CAPACITY_MULTIPLIER) { + if ((cxl_dstate->vmem_size < CXL_CAPACITY_MULTIPLIER) || + (cxl_dstate->pmem_size < CXL_CAPACITY_MULTIPLIER)) { return CXL_MBOX_INTERNAL_ERROR; } =20 @@ -288,21 +289,21 @@ static ret_code cmd_identify_memory_device(struct cxl= _cmd *cmd, =20 CXLType3Dev *ct3d =3D container_of(cxl_dstate, CXLType3Dev, cxl_dstate= ); CXLType3Class *cvc =3D CXL_TYPE3_GET_CLASS(ct3d); - uint64_t size =3D cxl_dstate->pmem_size; =20 - if (!QEMU_IS_ALIGNED(size, CXL_CAPACITY_MULTIPLIER)) { + if ((!QEMU_IS_ALIGNED(cxl_dstate->vmem_size, CXL_CAPACITY_MULTIPLIER))= || + (!QEMU_IS_ALIGNED(cxl_dstate->pmem_size, CXL_CAPACITY_MULTIPLIER))= ) { return CXL_MBOX_INTERNAL_ERROR; } =20 id =3D (void *)cmd->payload; memset(id, 0, sizeof(*id)); =20 - /* PMEM only */ snprintf(id->fw_revision, 0x10, "BWFW VERSION %02d", 0); =20 - id->total_capacity =3D size / CXL_CAPACITY_MULTIPLIER; - id->persistent_capacity =3D size / CXL_CAPACITY_MULTIPLIER; - id->lsa_size =3D cvc->get_lsa_size(ct3d); + stq_le_p(&id->total_capacity, cxl_dstate->mem_size / CXL_CAPACITY_MULT= IPLIER); + stq_le_p(&id->persistent_capacity, cxl_dstate->pmem_size / CXL_CAPACIT= Y_MULTIPLIER); + stq_le_p(&id->volatile_capacity, cxl_dstate->vmem_size / CXL_CAPACITY_= MULTIPLIER); + stl_le_p(&id->lsa_size, cvc->get_lsa_size(ct3d)); =20 *len =3D sizeof(*id); return CXL_MBOX_SUCCESS; @@ -319,17 +320,20 @@ static ret_code cmd_ccls_get_partition_info(struct cx= l_cmd *cmd, uint64_t next_pmem; } QEMU_PACKED *part_info =3D (void *)cmd->payload; QEMU_BUILD_BUG_ON(sizeof(*part_info) !=3D 0x20); - uint64_t size =3D cxl_dstate->pmem_size; =20 - if (!QEMU_IS_ALIGNED(size, CXL_CAPACITY_MULTIPLIER)) { + if ((!QEMU_IS_ALIGNED(cxl_dstate->vmem_size, CXL_CAPACITY_MULTIPLIER))= || + (!QEMU_IS_ALIGNED(cxl_dstate->pmem_size, CXL_CAPACITY_MULTIPLIER))= ) { return CXL_MBOX_INTERNAL_ERROR; } =20 - /* PMEM only */ - part_info->active_vmem =3D 0; - part_info->next_vmem =3D 0; - part_info->active_pmem =3D size / CXL_CAPACITY_MULTIPLIER; - part_info->next_pmem =3D 0; + stq_le_p(&part_info->active_vmem, cxl_dstate->vmem_size / CXL_CAPACITY= _MULTIPLIER); + /* + * When both next_vmem and next_pmem are 0, there is no pending change= to + * partitioning. + */ + stq_le_p(&part_info->next_vmem, 0); + stq_le_p(&part_info->active_pmem, cxl_dstate->pmem_size / CXL_CAPACITY= _MULTIPLIER); + stq_le_p(&part_info->next_pmem, 0); =20 *len =3D sizeof(*part_info); return CXL_MBOX_SUCCESS; diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index 2db756851c..2adacbd01b 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -31,7 +31,8 @@ enum { }; =20 static int ct3_build_cdat_entries_for_mr(CDATSubHeader **cdat_table, - int dsmad_handle, MemoryRegion *m= r) + int dsmad_handle, MemoryRegion *m= r, + bool is_pmem, uint64_t dpa_base) { g_autofree CDATDsmas *dsmas =3D NULL; g_autofree CDATDslbis *dslbis0 =3D NULL; @@ -50,8 +51,8 @@ static int ct3_build_cdat_entries_for_mr(CDATSubHeader **= cdat_table, .length =3D sizeof(*dsmas), }, .DSMADhandle =3D dsmad_handle, - .flags =3D CDAT_DSMAS_FLAG_NV, - .DPA_base =3D 0, + .flags =3D is_pmem ? CDAT_DSMAS_FLAG_NV : 0, + .DPA_base =3D dpa_base, .DPA_length =3D memory_region_size(mr), }; =20 @@ -130,8 +131,11 @@ static int ct3_build_cdat_entries_for_mr(CDATSubHeader= **cdat_table, .length =3D sizeof(*dsemts), }, .DSMAS_handle =3D dsmad_handle, - /* Reserved - the non volatile from DSMAS matters */ - .EFI_memory_type_attr =3D 2, + /* + * NV: Reserved - the non volatile from DSMAS matters + * V: EFI_MEMORY_SP + */ + .EFI_memory_type_attr =3D is_pmem ? 2 : 1, .DPA_offset =3D 0, .DPA_length =3D memory_region_size(mr), }; @@ -150,33 +154,68 @@ static int ct3_build_cdat_entries_for_mr(CDATSubHeade= r **cdat_table, static int ct3_build_cdat_table(CDATSubHeader ***cdat_table, void *priv) { g_autofree CDATSubHeader **table =3D NULL; - MemoryRegion *nonvolatile_mr; CXLType3Dev *ct3d =3D priv; + MemoryRegion *volatile_mr =3D NULL, *nonvolatile_mr =3D NULL; int dsmad_handle =3D 0; - int rc; + int cur_ent =3D 0; + int len =3D 0; + int rc, i; =20 - if (!ct3d->hostmem) { + if (!ct3d->hostpmem && !ct3d->hostvmem) { return 0; } =20 - nonvolatile_mr =3D host_memory_backend_get_memory(ct3d->hostmem); - if (!nonvolatile_mr) { - return -EINVAL; + if (ct3d->hostvmem) { + volatile_mr =3D host_memory_backend_get_memory(ct3d->hostvmem); + if (!volatile_mr) { + return -EINVAL; + } + len +=3D CT3_CDAT_NUM_ENTRIES; } =20 - table =3D g_malloc0(CT3_CDAT_NUM_ENTRIES * sizeof(*table)); + if (ct3d->hostpmem) { + nonvolatile_mr =3D host_memory_backend_get_memory(ct3d->hostpmem); + if (!nonvolatile_mr) { + return -EINVAL; + } + len +=3D CT3_CDAT_NUM_ENTRIES; + } + + table =3D g_malloc0(len * sizeof(*table)); if (!table) { return -ENOMEM; } =20 - rc =3D ct3_build_cdat_entries_for_mr(table, dsmad_handle++, nonvolatil= e_mr); - if (rc < 0) { - return rc; + /* Now fill them in */ + if (volatile_mr) { + rc =3D ct3_build_cdat_entries_for_mr(table, dsmad_handle++, volati= le_mr, + false, 0); + if (rc < 0) { + return rc; + } + cur_ent =3D CT3_CDAT_NUM_ENTRIES; } =20 + if (nonvolatile_mr) { + rc =3D ct3_build_cdat_entries_for_mr(&(table[cur_ent]), dsmad_hand= le++, + nonvolatile_mr, true, + (volatile_mr ? + memory_region_size(volatile_mr= ) : 0)); + if (rc < 0) { + goto error_cleanup; + } + cur_ent +=3D CT3_CDAT_NUM_ENTRIES; + } + assert(len =3D=3D cur_ent); + *cdat_table =3D g_steal_pointer(&table); =20 - return CT3_CDAT_NUM_ENTRIES; + return len; +error_cleanup: + for (i =3D 0; i < cur_ent; i++) { + g_free(table[i]); + } + return rc; } =20 static void ct3_free_cdat_table(CDATSubHeader **cdat_table, int num, void = *priv) @@ -264,16 +303,42 @@ static void build_dvsecs(CXLType3Dev *ct3d) { CXLComponentState *cxl_cstate =3D &ct3d->cxl_cstate; uint8_t *dvsec; + uint32_t range1_size_hi, range1_size_lo, + range1_base_hi =3D 0, range1_base_lo =3D 0, + range2_size_hi =3D 0, range2_size_lo =3D 0, + range2_base_hi =3D 0, range2_base_lo =3D 0; + + /* + * Volatile memory is mapped as (0x0) + * Persistent memory is mapped at (volatile->size) + */ + if (ct3d->hostvmem) { + range1_size_hi =3D ct3d->hostvmem->size >> 32; + range1_size_lo =3D (2 << 5) | (2 << 2) | 0x3 | + (ct3d->hostvmem->size & 0xF0000000); + if (ct3d->hostpmem) { + range2_size_hi =3D ct3d->hostpmem->size >> 32; + range2_size_lo =3D (2 << 5) | (2 << 2) | 0x3 | + (ct3d->hostpmem->size & 0xF0000000); + } + } else { + range1_size_hi =3D ct3d->hostpmem->size >> 32; + range1_size_lo =3D (2 << 5) | (2 << 2) | 0x3 | + (ct3d->hostpmem->size & 0xF0000000); + } =20 dvsec =3D (uint8_t *)&(CXLDVSECDevice){ .cap =3D 0x1e, .ctrl =3D 0x2, .status2 =3D 0x2, - .range1_size_hi =3D ct3d->hostmem->size >> 32, - .range1_size_lo =3D (2 << 5) | (2 << 2) | 0x3 | - (ct3d->hostmem->size & 0xF0000000), - .range1_base_hi =3D 0, - .range1_base_lo =3D 0, + .range1_size_hi =3D range1_size_hi, + .range1_size_lo =3D range1_size_lo, + .range1_base_hi =3D range1_base_hi, + .range1_base_lo =3D range1_base_lo, + .range2_size_hi =3D range2_size_hi, + .range2_size_lo =3D range2_size_lo, + .range2_base_hi =3D range2_base_hi, + .range2_base_lo =3D range2_base_lo, }; cxl_component_create_dvsec(cxl_cstate, CXL2_TYPE3_DEVICE, PCIE_CXL_DEVICE_DVSEC_LENGTH, @@ -514,36 +579,69 @@ static void ct3d_reg_write(void *opaque, hwaddr offse= t, uint64_t value, static bool cxl_setup_memory(CXLType3Dev *ct3d, Error **errp) { DeviceState *ds =3D DEVICE(ct3d); - MemoryRegion *mr; - char *name; =20 - if (!ct3d->hostmem) { - error_setg(errp, "memdev property must be set"); + if (!ct3d->hostmem && !ct3d->hostvmem && !ct3d->hostpmem) { + error_setg(errp, "at least one memdev property must be set"); + return false; + } else if (ct3d->hostmem && ct3d->hostpmem) { + error_setg(errp, "[memdev] cannot be used with new " + "[persistent-memdev] property"); + return false; + } else if (ct3d->hostmem) { + /* Use of hostmem property implies pmem */ + ct3d->hostpmem =3D ct3d->hostmem; + ct3d->hostmem =3D NULL; + } + + if (ct3d->hostpmem && !ct3d->lsa) { + error_setg(errp, "lsa property must be set for persistent devices"= ); return false; } =20 - mr =3D host_memory_backend_get_memory(ct3d->hostmem); - if (!mr) { - error_setg(errp, "memdev property must be set"); - return false; + if (ct3d->hostvmem) { + MemoryRegion *vmr; + char *v_name; + + vmr =3D host_memory_backend_get_memory(ct3d->hostvmem); + if (!vmr) { + error_setg(errp, "volatile memdev must have backing device"); + return false; + } + memory_region_set_nonvolatile(vmr, false); + memory_region_set_enabled(vmr, true); + host_memory_backend_set_mapped(ct3d->hostvmem, true); + if (ds->id) { + v_name =3D g_strdup_printf("cxl-type3-dpa-vmem-space:%s", ds->= id); + } else { + v_name =3D g_strdup("cxl-type3-dpa-vmem-space"); + } + address_space_init(&ct3d->hostvmem_as, vmr, v_name); + ct3d->cxl_dstate.vmem_size =3D memory_region_size(vmr); + ct3d->cxl_dstate.mem_size +=3D memory_region_size(vmr); + g_free(v_name); } - memory_region_set_nonvolatile(mr, true); - memory_region_set_enabled(mr, true); - host_memory_backend_set_mapped(ct3d->hostmem, true); =20 - if (ds->id) { - name =3D g_strdup_printf("cxl-type3-dpa-space:%s", ds->id); - } else { - name =3D g_strdup("cxl-type3-dpa-space"); - } - address_space_init(&ct3d->hostmem_as, mr, name); - g_free(name); + if (ct3d->hostpmem) { + MemoryRegion *pmr; + char *p_name; =20 - ct3d->cxl_dstate.pmem_size =3D ct3d->hostmem->size; - - if (!ct3d->lsa) { - error_setg(errp, "lsa property must be set"); - return false; + pmr =3D host_memory_backend_get_memory(ct3d->hostpmem); + if (!pmr) { + error_setg(errp, "persistent memdev must have backing device"); + return false; + } + memory_region_set_nonvolatile(pmr, true); + memory_region_set_enabled(pmr, true); + host_memory_backend_set_mapped(ct3d->hostpmem, true); + if (ds->id) { + p_name =3D g_strdup_printf("cxl-type3-dpa-pmem-space:%s", ds->= id); + } else { + p_name =3D g_strdup("cxl-type3-dpa-pmem-space"); + } + address_space_init(&ct3d->hostpmem_as, pmr, p_name); + ct3d->cxl_dstate.pmem_size =3D memory_region_size(pmr); + ct3d->cxl_dstate.mem_size +=3D memory_region_size(pmr); + g_free(p_name); } =20 return true; @@ -633,7 +731,12 @@ err_release_cdat: err_free_special_ops: g_free(regs->special_ops); err_address_space_free: - address_space_destroy(&ct3d->hostmem_as); + if (ct3d->hostpmem) { + address_space_destroy(&ct3d->hostpmem_as); + } + if (ct3d->hostvmem) { + address_space_destroy(&ct3d->hostvmem_as); + } return; } =20 @@ -646,7 +749,12 @@ static void ct3_exit(PCIDevice *pci_dev) pcie_aer_exit(pci_dev); cxl_doe_cdat_release(cxl_cstate); g_free(regs->special_ops); - address_space_destroy(&ct3d->hostmem_as); + if (ct3d->hostpmem) { + address_space_destroy(&ct3d->hostpmem_as); + } + if (ct3d->hostvmem) { + address_space_destroy(&ct3d->hostvmem_as); + } } =20 /* TODO: Support multiple HDM decoders and DPA skip */ @@ -681,51 +789,77 @@ static bool cxl_type3_dpa(CXLType3Dev *ct3d, hwaddr h= ost_addr, uint64_t *dpa) return true; } =20 +static int cxl_type3_hpa_to_as_and_dpa(CXLType3Dev *ct3d, + hwaddr host_addr, + unsigned int size, + AddressSpace **as, + uint64_t *dpa_offset) +{ + MemoryRegion *vmr =3D NULL, *pmr =3D NULL; + + if (ct3d->hostvmem) { + vmr =3D host_memory_backend_get_memory(ct3d->hostvmem); + } + if (ct3d->hostpmem) { + pmr =3D host_memory_backend_get_memory(ct3d->hostpmem); + } + + if (!vmr && !pmr) { + return -ENODEV; + } + + if (!cxl_type3_dpa(ct3d, host_addr, dpa_offset)) { + return -EINVAL; + } + + if (*dpa_offset > ct3d->cxl_dstate.mem_size) { + return -EINVAL; + } + + if (vmr) { + if (*dpa_offset < memory_region_size(vmr)) { + *as =3D &ct3d->hostvmem_as; + } else { + *as =3D &ct3d->hostpmem_as; + *dpa_offset -=3D memory_region_size(vmr); + } + } else { + *as =3D &ct3d->hostpmem_as; + } + + return 0; +} + MemTxResult cxl_type3_read(PCIDevice *d, hwaddr host_addr, uint64_t *data, unsigned size, MemTxAttrs attrs) { - CXLType3Dev *ct3d =3D CXL_TYPE3(d); - uint64_t dpa_offset; - MemoryRegion *mr; + uint64_t dpa_offset =3D 0; + AddressSpace *as =3D NULL; + int res; =20 - /* TODO support volatile region */ - mr =3D host_memory_backend_get_memory(ct3d->hostmem); - if (!mr) { + res =3D cxl_type3_hpa_to_as_and_dpa(CXL_TYPE3(d), host_addr, size, + &as, &dpa_offset); + if (res) { return MEMTX_ERROR; } =20 - if (!cxl_type3_dpa(ct3d, host_addr, &dpa_offset)) { - return MEMTX_ERROR; - } - - if (dpa_offset > memory_region_size(mr)) { - return MEMTX_ERROR; - } - - return address_space_read(&ct3d->hostmem_as, dpa_offset, attrs, data, = size); + return address_space_read(as, dpa_offset, attrs, data, size); } =20 MemTxResult cxl_type3_write(PCIDevice *d, hwaddr host_addr, uint64_t data, unsigned size, MemTxAttrs attrs) { - CXLType3Dev *ct3d =3D CXL_TYPE3(d); - uint64_t dpa_offset; - MemoryRegion *mr; + uint64_t dpa_offset =3D 0; + AddressSpace *as =3D NULL; + int res; =20 - mr =3D host_memory_backend_get_memory(ct3d->hostmem); - if (!mr) { - return MEMTX_OK; + res =3D cxl_type3_hpa_to_as_and_dpa(CXL_TYPE3(d), host_addr, size, + &as, &dpa_offset); + if (res) { + return MEMTX_ERROR; } =20 - if (!cxl_type3_dpa(ct3d, host_addr, &dpa_offset)) { - return MEMTX_OK; - } - - if (dpa_offset > memory_region_size(mr)) { - return MEMTX_OK; - } - return address_space_write(&ct3d->hostmem_as, dpa_offset, attrs, - &data, size); + return address_space_write(as, dpa_offset, attrs, &data, size); } =20 static void ct3d_reset(DeviceState *dev) @@ -740,7 +874,11 @@ static void ct3d_reset(DeviceState *dev) =20 static Property ct3_props[] =3D { DEFINE_PROP_LINK("memdev", CXLType3Dev, hostmem, TYPE_MEMORY_BACKEND, - HostMemoryBackend *), + HostMemoryBackend *), /* for backward compatibility */ + DEFINE_PROP_LINK("persistent-memdev", CXLType3Dev, hostpmem, + TYPE_MEMORY_BACKEND, HostMemoryBackend *), + DEFINE_PROP_LINK("volatile-memdev", CXLType3Dev, hostvmem, + TYPE_MEMORY_BACKEND, HostMemoryBackend *), DEFINE_PROP_LINK("lsa", CXLType3Dev, lsa, TYPE_MEMORY_BACKEND, HostMemoryBackend *), DEFINE_PROP_UINT64("sn", CXLType3Dev, sn, UI64_NULL), @@ -752,6 +890,10 @@ static uint64_t get_lsa_size(CXLType3Dev *ct3d) { MemoryRegion *mr; =20 + if (!ct3d->lsa) { + return 0; + } + mr =3D host_memory_backend_get_memory(ct3d->lsa); return memory_region_size(mr); } @@ -769,6 +911,10 @@ static uint64_t get_lsa(CXLType3Dev *ct3d, void *buf, = uint64_t size, MemoryRegion *mr; void *lsa; =20 + if (!ct3d->lsa) { + return 0; + } + mr =3D host_memory_backend_get_memory(ct3d->lsa); validate_lsa_access(mr, size, offset); =20 @@ -784,6 +930,10 @@ static void set_lsa(CXLType3Dev *ct3d, const void *buf= , uint64_t size, MemoryRegion *mr; void *lsa; =20 + if (!ct3d->lsa) { + return; + } + mr =3D host_memory_backend_get_memory(ct3d->lsa); validate_lsa_access(mr, size, offset); =20 @@ -955,7 +1105,7 @@ static void ct3_class_init(ObjectClass *oc, void *data) pc->config_read =3D ct3d_config_read; =20 set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); - dc->desc =3D "CXL PMEM Device (Type 3)"; + dc->desc =3D "CXL Memory Device (Type 3)"; dc->reset =3D ct3d_reset; device_class_set_props(dc, ct3_props); =20 diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 7fd88b0e9c..159e4edb8f 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -1867,13 +1867,13 @@ static void test_acpi_q35_cxl(void) " -device pxb-cxl,bus_nr=3D12,bus=3Dpcie.0,id= =3Dcxl.1" " -device pxb-cxl,bus_nr=3D222,bus=3Dpcie.0,i= d=3Dcxl.2" " -device cxl-rp,port=3D0,bus=3Dcxl.1,id=3Drp= 1,chassis=3D0,slot=3D2" - " -device cxl-type3,bus=3Drp1,memdev=3Dcxl-me= m1,lsa=3Dlsa1" + " -device cxl-type3,bus=3Drp1,persistent-memd= ev=3Dcxl-mem1,lsa=3Dlsa1" " -device cxl-rp,port=3D1,bus=3Dcxl.1,id=3Drp= 2,chassis=3D0,slot=3D3" - " -device cxl-type3,bus=3Drp2,memdev=3Dcxl-me= m2,lsa=3Dlsa2" + " -device cxl-type3,bus=3Drp2,persistent-memd= ev=3Dcxl-mem2,lsa=3Dlsa2" " -device cxl-rp,port=3D0,bus=3Dcxl.2,id=3Drp= 3,chassis=3D0,slot=3D5" - " -device cxl-type3,bus=3Drp3,memdev=3Dcxl-me= m3,lsa=3Dlsa3" + " -device cxl-type3,bus=3Drp3,persistent-memd= ev=3Dcxl-mem3,lsa=3Dlsa3" " -device cxl-rp,port=3D1,bus=3Dcxl.2,id=3Drp= 4,chassis=3D0,slot=3D6" - " -device cxl-type3,bus=3Drp4,memdev=3Dcxl-me= m4,lsa=3Dlsa4" + " -device cxl-type3,bus=3Drp4,persistent-memd= ev=3Dcxl-mem4,lsa=3Dlsa4" " -M cxl-fmw.0.targets.0=3Dcxl.1,cxl-fmw.0.si= ze=3D4G,cxl-fmw.0.interleave-granularity=3D8k," "cxl-fmw.1.targets.0=3Dcxl.1,cxl-fmw.1.target= s.1=3Dcxl.2,cxl-fmw.1.size=3D4G,cxl-fmw.1.interleave-granularity=3D8k", tmp_path, tmp_path, tmp_path, tmp_path, diff --git a/tests/qtest/cxl-test.c b/tests/qtest/cxl-test.c index eda2bbbbe6..edcad4a0ce 100644 --- a/tests/qtest/cxl-test.c +++ b/tests/qtest/cxl-test.c @@ -34,32 +34,46 @@ "-device cxl-rp,id=3Drp2,bus=3Dcxl.1,chassis=3D0,slot=3D2 " \ "-device cxl-rp,id=3Drp3,bus=3Dcxl.1,chassis=3D0,slot=3D3 " =20 -#define QEMU_T3D \ +#define QEMU_T3D_DEPRECATED \ "-object memory-backend-file,id=3Dcxl-mem0,mem-path=3D%s,size=3D256M "= \ "-object memory-backend-file,id=3Dlsa0,mem-path=3D%s,size=3D256M " \ "-device cxl-type3,bus=3Drp0,memdev=3Dcxl-mem0,lsa=3Dlsa0,id=3Dcxl-pme= m0 " =20 +#define QEMU_T3D_PMEM \ + "-object memory-backend-file,id=3Dcxl-mem0,mem-path=3D%s,size=3D256M "= \ + "-object memory-backend-file,id=3Dlsa0,mem-path=3D%s,size=3D256M " \ + "-device cxl-type3,bus=3Drp0,persistent-memdev=3Dcxl-mem0,lsa=3Dlsa0,i= d=3Dpmem0 " + +#define QEMU_T3D_VMEM \ + "-object memory-backend-ram,id=3Dcxl-mem0,size=3D256M " \ + "-device cxl-type3,bus=3Drp0,volatile-memdev=3Dcxl-mem0,id=3Dmem0 " + +#define QEMU_T3D_VMEM_LSA \ + "-object memory-backend-ram,id=3Dcxl-mem0,size=3D256M " \ + "-object memory-backend-file,id=3Dlsa0,mem-path=3D%s,size=3D256M " \ + "-device cxl-type3,bus=3Drp0,volatile-memdev=3Dcxl-mem0,lsa=3Dlsa0,id= =3Dmem0 " + #define QEMU_2T3D \ "-object memory-backend-file,id=3Dcxl-mem0,mem-path=3D%s,size=3D256M "= \ "-object memory-backend-file,id=3Dlsa0,mem-path=3D%s,size=3D256M " \ - "-device cxl-type3,bus=3Drp0,memdev=3Dcxl-mem0,lsa=3Dlsa0,id=3Dcxl-pme= m0 " \ + "-device cxl-type3,bus=3Drp0,persistent-memdev=3Dcxl-mem0,lsa=3Dlsa0,i= d=3Dpmem0 " \ "-object memory-backend-file,id=3Dcxl-mem1,mem-path=3D%s,size=3D256M "= \ "-object memory-backend-file,id=3Dlsa1,mem-path=3D%s,size=3D256M " \ - "-device cxl-type3,bus=3Drp1,memdev=3Dcxl-mem1,lsa=3Dlsa1,id=3Dcxl-pme= m1 " + "-device cxl-type3,bus=3Drp1,persistent-memdev=3Dcxl-mem1,lsa=3Dlsa1,i= d=3Dpmem1 " =20 #define QEMU_4T3D \ "-object memory-backend-file,id=3Dcxl-mem0,mem-path=3D%s,size=3D256M "= \ "-object memory-backend-file,id=3Dlsa0,mem-path=3D%s,size=3D256M " \ - "-device cxl-type3,bus=3Drp0,memdev=3Dcxl-mem0,lsa=3Dlsa0,id=3Dcxl-pme= m0 " \ + "-device cxl-type3,bus=3Drp0,persistent-memdev=3Dcxl-mem0,lsa=3Dlsa0,i= d=3Dpmem0 " \ "-object memory-backend-file,id=3Dcxl-mem1,mem-path=3D%s,size=3D256M "= \ "-object memory-backend-file,id=3Dlsa1,mem-path=3D%s,size=3D256M " \ - "-device cxl-type3,bus=3Drp1,memdev=3Dcxl-mem1,lsa=3Dlsa1,id=3Dcxl-pme= m1 " \ + "-device cxl-type3,bus=3Drp1,persistent-memdev=3Dcxl-mem1,lsa=3Dlsa1,i= d=3Dpmem1 " \ "-object memory-backend-file,id=3Dcxl-mem2,mem-path=3D%s,size=3D256M "= \ "-object memory-backend-file,id=3Dlsa2,mem-path=3D%s,size=3D256M " \ - "-device cxl-type3,bus=3Drp2,memdev=3Dcxl-mem2,lsa=3Dlsa2,id=3Dcxl-pme= m2 " \ + "-device cxl-type3,bus=3Drp2,persistent-memdev=3Dcxl-mem2,lsa=3Dlsa2,i= d=3Dpmem2 " \ "-object memory-backend-file,id=3Dcxl-mem3,mem-path=3D%s,size=3D256M "= \ "-object memory-backend-file,id=3Dlsa3,mem-path=3D%s,size=3D256M " \ - "-device cxl-type3,bus=3Drp3,memdev=3Dcxl-mem3,lsa=3Dlsa3,id=3Dcxl-pme= m3 " + "-device cxl-type3,bus=3Drp3,persistent-memdev=3Dcxl-mem3,lsa=3Dlsa3,i= d=3Dpmem3 " =20 static void cxl_basic_hb(void) { @@ -98,14 +112,53 @@ static void cxl_2root_port(void) } =20 #ifdef CONFIG_POSIX -static void cxl_t3d(void) +static void cxl_t3d_deprecated(void) { g_autoptr(GString) cmdline =3D g_string_new(NULL); g_autofree const char *tmpfs =3D NULL; =20 tmpfs =3D g_dir_make_tmp("cxl-test-XXXXXX", NULL); =20 - g_string_printf(cmdline, QEMU_PXB_CMD QEMU_RP QEMU_T3D, tmpfs, tmpfs); + g_string_printf(cmdline, QEMU_PXB_CMD QEMU_RP QEMU_T3D_DEPRECATED, + tmpfs, tmpfs); + + qtest_start(cmdline->str); + qtest_end(); +} + +static void cxl_t3d_persistent(void) +{ + g_autoptr(GString) cmdline =3D g_string_new(NULL); + g_autofree const char *tmpfs =3D NULL; + + tmpfs =3D g_dir_make_tmp("cxl-test-XXXXXX", NULL); + + g_string_printf(cmdline, QEMU_PXB_CMD QEMU_RP QEMU_T3D_PMEM, + tmpfs, tmpfs); + + qtest_start(cmdline->str); + qtest_end(); +} + +static void cxl_t3d_volatile(void) +{ + g_autoptr(GString) cmdline =3D g_string_new(NULL); + + g_string_printf(cmdline, QEMU_PXB_CMD QEMU_RP QEMU_T3D_VMEM); + + qtest_start(cmdline->str); + qtest_end(); +} + +static void cxl_t3d_volatile_lsa(void) +{ + g_autoptr(GString) cmdline =3D g_string_new(NULL); + g_autofree const char *tmpfs =3D NULL; + + tmpfs =3D g_dir_make_tmp("cxl-test-XXXXXX", NULL); + + g_string_printf(cmdline, QEMU_PXB_CMD QEMU_RP QEMU_T3D_VMEM_LSA, + tmpfs); =20 qtest_start(cmdline->str); qtest_end(); @@ -155,7 +208,10 @@ int main(int argc, char **argv) qtest_add_func("/pci/cxl/rp", cxl_root_port); qtest_add_func("/pci/cxl/rp_x2", cxl_2root_port); #ifdef CONFIG_POSIX - qtest_add_func("/pci/cxl/type3_device", cxl_t3d); + qtest_add_func("/pci/cxl/type3_device", cxl_t3d_deprecated); + qtest_add_func("/pci/cxl/type3_device_pmem", cxl_t3d_persistent); + qtest_add_func("/pci/cxl/type3_device_vmem", cxl_t3d_volatile); + qtest_add_func("/pci/cxl/type3_device_vmem_lsa", cxl_t3d_volatile_lsa); qtest_add_func("/pci/cxl/rp_x2_type3_x2", cxl_1pxb_2rp_2t3d); qtest_add_func("/pci/cxl/pxb_x2_root_port_x4_type3_x4", cxl_2pxb_4rp_4= t3d); #endif diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 7bb4d2f4f6..e934e0a13a 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -328,6 +328,14 @@ from Intel that was not properly allocated. Since vers= ion 5.2, the controller has used a properly allocated identifier. Deprecate the ``use-intel-id`` machine compatibility parameter. =20 +``-device cxl-type3,memdev=3Dxxxx`` (since 8.0) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The ``cxl-type3`` device initially only used a single memory backend. With +the addition of volatile memory support, it is now necessary to distinguish +between persistent and volatile memory backends. As such, memdev is depre= cated +in favor of persistent-memdev. + =20 Block device options '''''''''''''''''''' diff --git a/docs/system/devices/cxl.rst b/docs/system/devices/cxl.rst index 8f2885aba1..f12011e230 100644 --- a/docs/system/devices/cxl.rst +++ b/docs/system/devices/cxl.rst @@ -300,7 +300,7 @@ Example topology involving a switch:: =20 Example command lines --------------------- -A very simple setup with just one directly attached CXL Type 3 device:: +A very simple setup with just one directly attached CXL Type 3 Persistent = Memory device:: =20 qemu-system-x86_64 -M q35,cxl=3Don -m 4G,maxmem=3D8G,slots=3D8 -smp 4 \ ... @@ -308,7 +308,28 @@ A very simple setup with just one directly attached CX= L Type 3 device:: -object memory-backend-file,id=3Dcxl-lsa1,share=3Don,mem-path=3D/tmp/lsa= .raw,size=3D256M \ -device pxb-cxl,bus_nr=3D12,bus=3Dpcie.0,id=3Dcxl.1 \ -device cxl-rp,port=3D0,bus=3Dcxl.1,id=3Droot_port13,chassis=3D0,slot=3D= 2 \ - -device cxl-type3,bus=3Droot_port13,memdev=3Dcxl-mem1,lsa=3Dcxl-lsa1,id= =3Dcxl-pmem0 \ + -device cxl-type3,bus=3Droot_port13,persistent-memdev=3Dcxl-mem1,lsa=3Dc= xl-lsa1,id=3Dcxl-pmem0 \ + -M cxl-fmw.0.targets.0=3Dcxl.1,cxl-fmw.0.size=3D4G + +A very simple setup with just one directly attached CXL Type 3 Volatile Me= mory device:: + + qemu-system-aarch64 -M virt,gic-version=3D3,cxl=3Don -m 4g,maxmem=3D8G,s= lots=3D8 -cpu max \ + ... + -object memory-backend-ram,id=3Dvmem0,share=3Don,size=3D256M \ + -device pxb-cxl,bus_nr=3D12,bus=3Dpcie.0,id=3Dcxl.1 \ + -device cxl-rp,port=3D0,bus=3Dcxl.1,id=3Droot_port13,chassis=3D0,slot=3D= 2 \ + -device cxl-type3,bus=3Droot_port13,volatile-memdev=3Dvmem0,id=3Dcxl-vme= m0 \ + -M cxl-fmw.0.targets.0=3Dcxl.1,cxl-fmw.0.size=3D4G + +The same volatile setup may optionally include an LSA region:: + + qemu-system-aarch64 -M virt,gic-version=3D3,cxl=3Don -m 4g,maxmem=3D8G,s= lots=3D8 -cpu max \ + ... + -object memory-backend-ram,id=3Dvmem0,share=3Don,size=3D256M \ + -object memory-backend-file,id=3Dcxl-lsa0,share=3Don,mem-path=3D/tmp/lsa= .raw,size=3D256M \ + -device pxb-cxl,bus_nr=3D12,bus=3Dpcie.0,id=3Dcxl.1 \ + -device cxl-rp,port=3D0,bus=3Dcxl.1,id=3Droot_port13,chassis=3D0,slot=3D= 2 \ + -device cxl-type3,bus=3Droot_port13,volatile-memdev=3Dvmem0,lsa=3Dcxl-ls= a0,id=3Dcxl-vmem0 \ -M cxl-fmw.0.targets.0=3Dcxl.1,cxl-fmw.0.size=3D4G =20 A setup suitable for 4 way interleave. Only one fixed window provided, to = enable 2 way @@ -328,13 +349,13 @@ the CXL Type3 device directly attached (no switches).= :: -device pxb-cxl,bus_nr=3D12,bus=3Dpcie.0,id=3Dcxl.1 \ -device pxb-cxl,bus_nr=3D222,bus=3Dpcie.0,id=3Dcxl.2 \ -device cxl-rp,port=3D0,bus=3Dcxl.1,id=3Droot_port13,chassis=3D0,slot=3D= 2 \ - -device cxl-type3,bus=3Droot_port13,memdev=3Dcxl-mem1,lsa=3Dcxl-lsa1,id= =3Dcxl-pmem0 \ + -device cxl-type3,bus=3Droot_port13,persistent-memdev=3Dcxl-mem1,lsa=3Dc= xl-lsa1,id=3Dcxl-pmem0 \ -device cxl-rp,port=3D1,bus=3Dcxl.1,id=3Droot_port14,chassis=3D0,slot=3D= 3 \ - -device cxl-type3,bus=3Droot_port14,memdev=3Dcxl-mem2,lsa=3Dcxl-lsa2,id= =3Dcxl-pmem1 \ + -device cxl-type3,bus=3Droot_port14,persistent-memdev=3Dcxl-mem2,lsa=3Dc= xl-lsa2,id=3Dcxl-pmem1 \ -device cxl-rp,port=3D0,bus=3Dcxl.2,id=3Droot_port15,chassis=3D0,slot=3D= 5 \ - -device cxl-type3,bus=3Droot_port15,memdev=3Dcxl-mem3,lsa=3Dcxl-lsa3,id= =3Dcxl-pmem2 \ + -device cxl-type3,bus=3Droot_port15,persistent-memdev=3Dcxl-mem3,lsa=3Dc= xl-lsa3,id=3Dcxl-pmem2 \ -device cxl-rp,port=3D1,bus=3Dcxl.2,id=3Droot_port16,chassis=3D0,slot=3D= 6 \ - -device cxl-type3,bus=3Droot_port16,memdev=3Dcxl-mem4,lsa=3Dcxl-lsa4,id= =3Dcxl-pmem3 \ + -device cxl-type3,bus=3Droot_port16,persistent-memdev=3Dcxl-mem4,lsa=3Dc= xl-lsa4,id=3Dcxl-pmem3 \ -M cxl-fmw.0.targets.0=3Dcxl.1,cxl-fmw.0.targets.1=3Dcxl.2,cxl-fmw.0.siz= e=3D4G,cxl-fmw.0.interleave-granularity=3D8k =20 An example of 4 devices below a switch suitable for 1, 2 or 4 way interlea= ve:: @@ -354,15 +375,23 @@ An example of 4 devices below a switch suitable for 1= , 2 or 4 way interleave:: -device cxl-rp,port=3D1,bus=3Dcxl.1,id=3Droot_port1,chassis=3D0,slot=3D1= \ -device cxl-upstream,bus=3Droot_port0,id=3Dus0 \ -device cxl-downstream,port=3D0,bus=3Dus0,id=3Dswport0,chassis=3D0,slot= =3D4 \ - -device cxl-type3,bus=3Dswport0,memdev=3Dcxl-mem0,lsa=3Dcxl-lsa0,id=3Dcx= l-pmem0 \ + -device cxl-type3,bus=3Dswport0,persistent-memdev=3Dcxl-mem0,lsa=3Dcxl-l= sa0,id=3Dcxl-pmem0 \ -device cxl-downstream,port=3D1,bus=3Dus0,id=3Dswport1,chassis=3D0,slot= =3D5 \ - -device cxl-type3,bus=3Dswport1,memdev=3Dcxl-mem1,lsa=3Dcxl-lsa1,id=3Dcx= l-pmem1 \ + -device cxl-type3,bus=3Dswport1,persistent-memdev=3Dcxl-mem1,lsa=3Dcxl-l= sa1,id=3Dcxl-pmem1 \ -device cxl-downstream,port=3D2,bus=3Dus0,id=3Dswport2,chassis=3D0,slot= =3D6 \ - -device cxl-type3,bus=3Dswport2,memdev=3Dcxl-mem2,lsa=3Dcxl-lsa2,id=3Dcx= l-pmem2 \ + -device cxl-type3,bus=3Dswport2,persistent-memdev=3Dcxl-mem2,lsa=3Dcxl-l= sa2,id=3Dcxl-pmem2 \ -device cxl-downstream,port=3D3,bus=3Dus0,id=3Dswport3,chassis=3D0,slot= =3D7 \ - -device cxl-type3,bus=3Dswport3,memdev=3Dcxl-mem3,lsa=3Dcxl-lsa3,id=3Dcx= l-pmem3 \ + -device cxl-type3,bus=3Dswport3,persistent-memdev=3Dcxl-mem3,lsa=3Dcxl-l= sa3,id=3Dcxl-pmem3 \ -M cxl-fmw.0.targets.0=3Dcxl.1,cxl-fmw.0.size=3D4G,cxl-fmw.0.interleave-= granularity=3D4k =20 +Deprecations +------------ + +The Type 3 device [memdev] attribute has been deprecated in favor of the +[persistent-memdev] attributes. [memdev] will default to a persistent memo= ry +device for backward compatibility and is incapable of being used in combin= ation +with [persistent-memdev]. + Kernel Configuration Options ---------------------------- =20 --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508265; cv=none; d=zohomail.com; s=zohoarc; b=Z+Jthe37Kapd1hTyRiN31wznXZmzxX+gkyPDJSHG+i7tIGj4O/X178vX/E3R3N+pzWIp+SzFngujz3QeEUW1KUq/1pQRr/DfOqGR6SWPVD63NplRKER/qkuLrgtY5xaVTevkOelUc3UgamaYUuj7VItXfafxKehCRYLsDgJ2N+o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508265; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WtjR93h6QuSbRUCTzbaJ4aOffqFPn7qbJ+P5umk+LYA=; b=ewFjp6blCXjQcFLf3sKNkG0RTOTORk7iv24KYNtwB1jyiJv08eu5jfNM5Cd3CKqNSU40mR48O2svdAKeTYc59M6JDxivd/37wMxOeeIWMEoyozj1553jjXl88rdyiW9tKT1hweiJQTk/AnIH9/yqRQyFoYNB8EQ7J+dk8EZDQ2M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168450826588012.002947037396211; Fri, 19 May 2023 07:57:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01Rp-0001lG-Ax; Fri, 19 May 2023 10:51:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q01Ra-0001A9-Sc for qemu-devel@nongnu.org; Fri, 19 May 2023 10:51: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 1q01RV-0003bJ-BS for qemu-devel@nongnu.org; Fri, 19 May 2023 10:50:58 -0400 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-137-hW9FtN5wN-mdneOaX7JnqA-1; Fri, 19 May 2023 10:50:51 -0400 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-4f3a517b5c6so598832e87.0 for ; Fri, 19 May 2023 07:50:51 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id 12-20020ac2482c000000b004efef5cf939sm624961lft.83.2023.05.19.07.50.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:50:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507852; h=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=WtjR93h6QuSbRUCTzbaJ4aOffqFPn7qbJ+P5umk+LYA=; b=hsjyG3c1wjD73Bmu5C70jhPjXxUyFkB2LNIfy4/ksAdBfsHQSYA77xyTHG3bjqh61/k1ZK edIgmwsjZlevdI9Pdx0TAYSYP7EDvKQab1SPEVx+rr9OHBkgqe4yJBl4Q/hDiDLEFzDsXa SJ8F881Y2qk012CQbSkcUvRuWUJSHa0= X-MC-Unique: hW9FtN5wN-mdneOaX7JnqA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507849; x=1687099849; 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=WtjR93h6QuSbRUCTzbaJ4aOffqFPn7qbJ+P5umk+LYA=; b=JDlSeDayGxR/tnsUJL0ylW0+M9EhEOmasOHS3rGYMCFK0IRcfXbppeAMhdRNqRsfN0 3xoRpAusE6n4Mxz4JIfhNMQA66wCfppFz3k/0By/+XYsLpxmYlg5t0/pKwHiAmDOQKPe NDH3rOxKtqFghGjrmyGdYh0z6iyS4qhwQIyGGVKRMoXxvFsZoiETGmJDToSxMM3kAI/D cZcBsxvkclsI065LF/fXspKDUtBVC1o1+oeUSaWHqTReWJocASY2kN1O6D2VO2WNvX59 oZT4lQshY0xrH7D9wtFXTIInXqb63g62hiwn4yhiXX/hdLKyIpa20l/WjIXmCNK2kSA/ SXSg== X-Gm-Message-State: AC+VfDy3cva8EnS5f06oP7tecFH8xoeZME3zRZi5+xUcJ1SEkmSxOVA5 aWMWOZlk1+nvrs4KfCml73jkTXU/Y7IcIrtjl5+gx+LS/WHWb/atmvkC6p2MhIZ1LdmvYkCdT0c DEY9T61tdLr/EgWg+uzyzHKZAhnO+UAxgxKVbmsRDitqYHSUIDNpj67UB07RUCZ7Z4/21 X-Received: by 2002:a05:6512:31c5:b0:4f0:ee3:848f with SMTP id j5-20020a05651231c500b004f00ee3848fmr925772lfe.15.1684507849690; Fri, 19 May 2023 07:50:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7OHBBP0laTNVOvW8DDsjG2Lf9jycCIPtrURKMPCY1JEJoi+M+DTZVljRpsTGQYk+1dUongiA== X-Received: by 2002:a05:6512:31c5:b0:4f0:ee3:848f with SMTP id j5-20020a05651231c500b004f00ee3848fmr925758lfe.15.1684507849262; Fri, 19 May 2023 07:50:49 -0700 (PDT) Date: Fri, 19 May 2023 10:50:44 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Eric DeVolder , Igor Mammedov , Ani Sinha , Ani Sinha Subject: [PULL 13/40] ACPI: bios-tables-test.c step 2 (allowed-diff entries) Message-ID: <354b09d228e1d04272e126a1edfcc70701af2958.1684507742.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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508266594100008 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric DeVolder Following the guidelines in tests/qtest/bios-tables-test.c, set up bios-tables-test-allowed-diff.h to ignore the imminent changes to the APIC tables, per step 2. Signed-off-by: Eric DeVolder Message-Id: <20230517162545.2191-2-eric.devolder@oracle.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Igor Mammedov Acked-by: Ani Sinha --- tests/qtest/bios-tables-test-allowed-diff.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index dfb8523c8b..66ae44e6b9 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,15 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/microvm/APIC", +"tests/data/acpi/microvm/APIC.ioapic2", +"tests/data/acpi/microvm/APIC.pcie", +"tests/data/acpi/pc/APIC", +"tests/data/acpi/pc/APIC.acpihmat", +"tests/data/acpi/pc/APIC.cphp", +"tests/data/acpi/pc/APIC.dimmpxm", +"tests/data/acpi/q35/APIC", +"tests/data/acpi/q35/APIC.acpihmat", +"tests/data/acpi/q35/APIC.acpihmat-noinitiator", +"tests/data/acpi/q35/APIC.core-count2", +"tests/data/acpi/q35/APIC.cphp", +"tests/data/acpi/q35/APIC.dimmpxm", +"tests/data/acpi/q35/APIC.xapic", --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508285; cv=none; d=zohomail.com; s=zohoarc; b=f0ln6ivDswihnG/w3DSi2QEESYbWYPyGuFSVlCNr+QyxtRog0MZCDiCrqmHnSLxsvrcgPo/uF3k1HZx6Um2kxnMymCLmD/US65CahBvdHNigFtumtto/Xctvn5GF65ydnm5GMAoA1H4tvGj7JRtNXe3zjTPZDbgGXDS8IrwvEqw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508285; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=y2VfXNMFx2Ue0VAW0U2NLanOv7ue6Qvz78cTtsctJkM=; b=NhzTXOAsBxjOwVwYyIJK8mQjmyuInEcvs2AhamBu1M8RBfuz8O/1MTvKvwEGSt68r0xSSah3i/MtGDjI9qLupdeeUJu6LjMM/nuHRaocoiAn96ZVo/Xl/LXXFfc0dWRrGmU7h5KkDPhWryZpv0czdLpVye1BWvacd5MiBIusWDs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508285489232.12284616929605; Fri, 19 May 2023 07:58:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01Ro-0001XU-3w; Fri, 19 May 2023 10:51: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 1q01Rc-0001DB-Rh for qemu-devel@nongnu.org; Fri, 19 May 2023 10:51: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 1q01Rb-0003ba-6G for qemu-devel@nongnu.org; Fri, 19 May 2023 10:51:00 -0400 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-593-rTh79jCTMLKdkqYn6DQcDg-1; Fri, 19 May 2023 10:50:57 -0400 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-4f3932e595dso2263391e87.1 for ; Fri, 19 May 2023 07:50:57 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id y6-20020a197506000000b004e95f53adc7sm638891lfe.27.2023.05.19.07.50.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:50:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507858; h=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=y2VfXNMFx2Ue0VAW0U2NLanOv7ue6Qvz78cTtsctJkM=; b=Xq2mlGrtrWWhtjwysZfWqyOMD99QB4SeN0nUD84ATMSiUTxvgWN6/3sJxtbqlAHUyW18dB GESWw8k28J25qJl8HjCEJ/X1h8DPCbptGkku3sH6kkPnWa6CxFLgy1ZFRfKSmZMpwCLECF qE97b7Frgh84Hca5GZbdG7KEUkHJAw4= X-MC-Unique: rTh79jCTMLKdkqYn6DQcDg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507855; x=1687099855; 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=y2VfXNMFx2Ue0VAW0U2NLanOv7ue6Qvz78cTtsctJkM=; b=XiJjWBd+U+qBsbyD7ivaM+hXx1oaLrm0xpcAKfWeNGMBRM6KgjePspAxPh7geyApo8 X3zofia6eMXI5fhWBVukNGXNdQXA6LI+M+mkhlfz8l935/d1wdZ59In4qXAX4faoZELO tKzkB0CksQpYC32wZX8DYyWVYSRSK6yAFgYQLD6+bU5DDoMDWYAEG8HjOfrCRPPYBd6Z gy0Mpla0BbY2UjuPZVdbKcrLF3DHzozIIUTWZS5QaoM3ZVVpHR1Nt2vcLSLRQd0mN2Ae 8XogwcYztKp8B7hNGM/qlhgtMK9g5SKy7sJCUImKRmSeLL061Z0u5igOfU96ZnNm+bNh OZyQ== X-Gm-Message-State: AC+VfDy+IH1i+dT/x3UVafQuJQfR9HtkyR/tzF5lsJGxeC+zdjOZEGY9 Qk2Z3Zf9VMSdaIfizw5N4aqzooUGDS6iZaDZcfHbgsvjdeU8RMr+uXTOM8sM3T+2pE2bpb9uDkm xHBhr/0P5I1fLv0RaYnTGb4QnflL7z+StW5hfukCZepm3T4gmOuTWGCOiEwSmdMJAIJDh X-Received: by 2002:a05:6512:259:b0:4f0:1124:8b2a with SMTP id b25-20020a056512025900b004f011248b2amr978035lfo.46.1684507855529; Fri, 19 May 2023 07:50:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ44jKotLrwbCIbkZHjdbqz3JxDuRQFkShXknB1++MX+oJD+6YhRbS9X2a5pCmz4kdPDrZTutw== X-Received: by 2002:a05:6512:259:b0:4f0:1124:8b2a with SMTP id b25-20020a056512025900b004f011248b2amr978023lfo.46.1684507855267; Fri, 19 May 2023 07:50:55 -0700 (PDT) Date: Fri, 19 May 2023 10:50:49 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Eric DeVolder , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 14/40] ACPI: i386: bump to MADT to revision 3 Message-ID: <6da94e277cd6eaf627dcd2d50ca795c7a272b8aa.1684507742.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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508285937100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric DeVolder Currently i386 QEMU generates MADT revision 3, and reports MADT revision 1. Set .revision to 3 to match reality. Link: https://lore.kernel.org/linux-acpi/20230327191026.3454-1-eric.devolde= r@ora cle.com/T/#t Signed-off-by: Eric DeVolder Reviewed-by: Ani Sinha Message-Id: <20230517162545.2191-3-eric.devolder@oracle.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Igor Mammedov --- hw/i386/acpi-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/acpi-common.c b/hw/i386/acpi-common.c index 52e5c1439a..8a0932fe84 100644 --- a/hw/i386/acpi-common.c +++ b/hw/i386/acpi-common.c @@ -102,7 +102,7 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *li= nker, MachineClass *mc =3D MACHINE_GET_CLASS(x86ms); const CPUArchIdList *apic_ids =3D mc->possible_cpu_arch_ids(MACHINE(x8= 6ms)); AcpiDeviceIfClass *adevc =3D ACPI_DEVICE_IF_GET_CLASS(adev); - AcpiTable table =3D { .sig =3D "APIC", .rev =3D 1, .oem_id =3D oem_id, + AcpiTable table =3D { .sig =3D "APIC", .rev =3D 3, .oem_id =3D oem_id, .oem_table_id =3D oem_table_id }; =20 acpi_table_begin(&table, table_data); --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508172; cv=none; d=zohomail.com; s=zohoarc; b=cs4/Z2+u/51lCPBLBt6A323eEhxT2RqkS5ha8xbd49VFWsC/My+wvl9q55cccfkcNQu/CRiv4gqhVH5JrJu/PDXua9fd6dPr9iW25CtRChWAGLjn2oWOdo8XyV8JTPkai2OcRGdyExhFUmifsLpp8jV8928Uoz+YBAiajD7V/C0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508172; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XEgioFZGb5Y3lgiKqVjhZE5ZLmw953LNovIV0uBmxyo=; b=eo84Zbjh+KDzmwllMjmblkOZZDdsmvzbPURYa/JBOJay5d7/H33jNRCm3D/Osv8WUFb23P28g9qf3OVEWc48rrI+UYjHIKUNLxmwug9D4S9GdMpQH/nYJ38LQxYkTWCAn+Dvqiyc0hljSFkMrC/be1hVn1VLfAlLWxjIh5U/ZLY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508172117784.027532808968; Fri, 19 May 2023 07:56:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01T0-0004tz-Hs; Fri, 19 May 2023 10:52: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 1q01Sl-0004PD-Bm for qemu-devel@nongnu.org; Fri, 19 May 2023 10:52: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 1q01Se-0003iM-6t for qemu-devel@nongnu.org; Fri, 19 May 2023 10:52:11 -0400 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-128-u_SvbQWVP2eb9clf49DUlw-1; Fri, 19 May 2023 10:51:12 -0400 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2af237b22aaso4951421fa.0 for ; Fri, 19 May 2023 07:51:02 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id d13-20020ac25ecd000000b004f2509b87cesm625502lfq.107.2023.05.19.07.50.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:50:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507922; h=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=XEgioFZGb5Y3lgiKqVjhZE5ZLmw953LNovIV0uBmxyo=; b=EvWIIuXzTIOBx0n+vsRTR6+WMJLEOvobxi18Uv59Wf619k3bfKh/SbH2kFZ9zvwQdaEa5b /B+S2Ner84zjyxs3TVZplEeAqp8sgwbX3fAauvwF8aMlh7105bgBe3Nn34pSL9dF2XBB+1 /KD4mQyAeRwR3+Hr11MQh3FKdFFPgiw= X-MC-Unique: u_SvbQWVP2eb9clf49DUlw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507861; x=1687099861; 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=XEgioFZGb5Y3lgiKqVjhZE5ZLmw953LNovIV0uBmxyo=; b=aTBx92mvqC7QQGcZC7wMBbavPP4bo328w4l3fYiBBeWJm6wcKHELyF0NXZKOMBDeMl CGzdrTeRIkIQnzDHVrF1amEvX9g7VKTXhv7AjlvTA5d9yOol6YRqch750Zeg3B+hx+2I 5XndI0Cf/6SOKWoaaKhWpMaf1+AbL0LVpUofsR6Ed8yXyRVRv52ZeaMaCDkwizeLsyxM 9lhRAQzqtLBRYOtDLMfzO4p92uok1wqD1EsBWjZEv2lz/yBQgalJfpb/U7nF2If1H2YD tLXJK9IgsREEVHV4EnH9SCWNWDvi6jNy576WjSgNHpCe3LzdjytNQIRmvQvyA0sjOslw T+rQ== X-Gm-Message-State: AC+VfDx1uyBRRwxoiaR0P6W7YZQaLJkBh7cVAafXH7wd2YjWjWCAnPUf sg4h/9ZNmEHTOty6zjJFv5DjyEBzNCibbdc9W1rBeWTftBx0nTXGLvU3Vd5MAeb2mWtAqLv8/3w Ab72+85pJ4c5GMlXmNP/E8zykKsHscMsAuU1gCHhL/DacuPeU5U5DrclOdt0t+MRloJTu X-Received: by 2002:a05:6512:38d1:b0:4f3:96ac:6dd8 with SMTP id p17-20020a05651238d100b004f396ac6dd8mr900031lft.4.1684507860800; Fri, 19 May 2023 07:51:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7tOvYh4Dor7NawtD4UoxVkw0gUx7HGucyTFXOs8OfCqPM/1uCcIoaLRTS3pF1XPShFsMA/0Q== X-Received: by 2002:a05:6512:38d1:b0:4f3:96ac:6dd8 with SMTP id p17-20020a05651238d100b004f396ac6dd8mr900021lft.4.1684507860368; Fri, 19 May 2023 07:51:00 -0700 (PDT) Date: Fri, 19 May 2023 10:50:55 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Eric DeVolder , Igor Mammedov , Ani Sinha Subject: [PULL 15/40] ACPI: bios-tables-test.c step 5 (update expected table binaries) Message-ID: <1141159cb471b89a63c256902f315bcf8dcf7d5e.1684507742.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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508173748100007 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric DeVolder Following the guidelines in tests/qtest/bios-tables-test.c, this is step 5 and 6. An examination of all the files impacted (as listed in bios-tables-test-allowe-diff.h) shows only the MADT/APIC tables bumping revision from 1 to 3, and a corresponding change to the checksum. The below diff is typical: --- /tmp/asl-1F9641.dsl 2023-05-16 15:18:31.292579156 -0400 +++ /tmp/asl-GVD741.dsl 2023-05-16 15:18:31.291579149 -0400 @@ -1,32 +1,32 @@ /* * Intel ACPI Component Architecture * AML/ASL+ Disassembler version 20230331 (64-bit version) * Copyright (c) 2000 - 2023 Intel Corporation * - * Disassembly of tests/data/acpi/pc/APIC, Tue May 16 15:18:31 2023 + * Disassembly of /tmp/aml-R4D741, Tue May 16 15:18:31 2023 * * ACPI Data Table [APIC] * * Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue (= in hex) */ [000h 0000 004h] Signature : "APIC" [Multiple APIC D= escription Table (MADT)] [004h 0004 004h] Table Length : 00000078 -[008h 0008 001h] Revision : 01 -[009h 0009 001h] Checksum : 8A +[008h 0008 001h] Revision : 03 +[009h 0009 001h] Checksum : 88 [00Ah 0010 006h] Oem ID : "BOCHS " [010h 0016 008h] Oem Table ID : "BXPC " [018h 0024 004h] Oem Revision : 00000001 [01Ch 0028 004h] Asl Compiler ID : "BXPC" [020h 0032 004h] Asl Compiler Revision : 00000001 [024h 0036 004h] Local Apic Address : FEE00000 [028h 0040 004h] Flags (decoded below) : 00000001 PC-AT Compatibility : 1 [02Ch 0044 001h] Subtable Type : 00 [Processor Local APIC] [02Dh 0045 001h] Length : 08 [02Eh 0046 001h] Processor ID : 00 [02Fh 0047 001h] Local Apic ID : 00 [030h 0048 004h] Flags (decoded below) : 00000001 Processor Enabled : 1 @@ -81,24 +81,24 @@ [06Bh 0107 001h] Source : 0B [06Ch 0108 004h] Interrupt : 0000000B [070h 0112 002h] Flags (decoded below) : 000D Polarity : 1 Trigger Mode : 3 [072h 0114 001h] Subtable Type : 04 [Local APIC NMI] [073h 0115 001h] Length : 06 [074h 0116 001h] Processor ID : FF [075h 0117 002h] Flags (decoded below) : 0000 Polarity : 0 Trigger Mode : 0 [077h 0119 001h] Interrupt Input LINT : 01 Raw Table Data: Length 120 (0x78) - 0000: 41 50 49 43 78 00 00 00 01 8A 42 4F 43 48 53 20 // APICx.....B= OCHS + 0000: 41 50 49 43 78 00 00 00 03 88 42 4F 43 48 53 20 // APICx.....B= OCHS 0010: 42 58 50 43 20 20 20 20 01 00 00 00 42 58 50 43 // BXPC ...= .BXPC 0020: 01 00 00 00 00 00 E0 FE 01 00 00 00 00 08 00 00 // ...........= ..... 0030: 01 00 00 00 01 0C 00 00 00 00 C0 FE 00 00 00 00 // ...........= ..... 0040: 02 0A 00 00 02 00 00 00 00 00 02 0A 00 05 05 00 // ...........= ..... 0050: 00 00 0D 00 02 0A 00 09 09 00 00 00 0D 00 02 0A // ...........= ..... 0060: 00 0A 0A 00 00 00 0D 00 02 0A 00 0B 0B 00 00 00 // ...........= ..... 0070: 0D 00 04 06 FF 00 00 01 // ........ Signed-off-by: Eric DeVolder Message-Id: <20230517162545.2191-4-eric.devolder@oracle.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Igor Mammedov Acked-by: Ani Sinha --- tests/qtest/bios-tables-test-allowed-diff.h | 14 -------------- tests/data/acpi/microvm/APIC | Bin 70 -> 70 bytes tests/data/acpi/microvm/APIC.ioapic2 | Bin 82 -> 82 bytes tests/data/acpi/microvm/APIC.pcie | Bin 110 -> 110 bytes tests/data/acpi/pc/APIC | Bin 120 -> 120 bytes tests/data/acpi/pc/APIC.acpihmat | Bin 128 -> 128 bytes tests/data/acpi/pc/APIC.cphp | Bin 160 -> 160 bytes tests/data/acpi/pc/APIC.dimmpxm | Bin 144 -> 144 bytes tests/data/acpi/q35/APIC | Bin 120 -> 120 bytes tests/data/acpi/q35/APIC.acpihmat | Bin 128 -> 128 bytes tests/data/acpi/q35/APIC.acpihmat-noinitiator | Bin 144 -> 144 bytes tests/data/acpi/q35/APIC.core-count2 | Bin 2478 -> 2478 bytes tests/data/acpi/q35/APIC.cphp | Bin 160 -> 160 bytes tests/data/acpi/q35/APIC.dimmpxm | Bin 144 -> 144 bytes tests/data/acpi/q35/APIC.xapic | Bin 2686 -> 2686 bytes 15 files changed, 14 deletions(-) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index 66ae44e6b9..dfb8523c8b 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1,15 +1 @@ /* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/microvm/APIC", -"tests/data/acpi/microvm/APIC.ioapic2", -"tests/data/acpi/microvm/APIC.pcie", -"tests/data/acpi/pc/APIC", -"tests/data/acpi/pc/APIC.acpihmat", -"tests/data/acpi/pc/APIC.cphp", -"tests/data/acpi/pc/APIC.dimmpxm", -"tests/data/acpi/q35/APIC", -"tests/data/acpi/q35/APIC.acpihmat", -"tests/data/acpi/q35/APIC.acpihmat-noinitiator", -"tests/data/acpi/q35/APIC.core-count2", -"tests/data/acpi/q35/APIC.cphp", -"tests/data/acpi/q35/APIC.dimmpxm", -"tests/data/acpi/q35/APIC.xapic", diff --git a/tests/data/acpi/microvm/APIC b/tests/data/acpi/microvm/APIC index 68dbd44a7e35a356083f086df60f70e424c4249f..672764e711d80402890902ba9de= d10915770e84c 100644 GIT binary patch delta 16 XcmZ>B<8ln}barE4U|=3Dqq$Ylcn95e$) delta 16 XcmZ>B<8ln}barE4U|=3Dkn$Ylcn95Mq& diff --git a/tests/data/acpi/microvm/APIC.ioapic2 b/tests/data/acpi/microvm= /APIC.ioapic2 index 3063c52cd3e9bbed29c06031b375900f4a49b9e0..6f24fdb12ce3f1c13df7ff835e4= 75d8023e20d4a 100644 GIT binary patch delta 16 XcmWFv;&Ke|bPi%*U|?>X$mIb59$W*3 delta 16 XcmWFv;&Ke|bPi%*U|?*X$mIb59$Ev1 diff --git a/tests/data/acpi/microvm/APIC.pcie b/tests/data/acpi/microvm/AP= IC.pcie index 4e8f6ed8d6a866429fc17aecdeafc3fb5ef65fa3..2239ca76a607fb1ff9d392298e2= bd6461bba7ecf 100644 GIT binary patch delta 16 Xcmd1H<8ln}bk1X7U|_DA$dv*BBD@3c delta 16 Xcmd1H<8ln}bk1X7U|_77$dv*BBDw?a diff --git a/tests/data/acpi/pc/APIC b/tests/data/acpi/pc/APIC index 208331db53b7dd5c6205cce0e95427636b86dd64..868a3432f0295257393e45b7548= 3ef4bec455d74 100644 GIT binary patch delta 16 Xcmb=3DZ;BpM`bgp1vU|{Z;$dv~GB#s0m delta 16 Xcmb=3DZ;BpM`bgp1vU|{T;$dv~GB#Z delta 18 ZcmbQhIDwJNF~HM#0s{jBqxVFvHUKF)1V;b> diff --git a/tests/data/acpi/q35/APIC b/tests/data/acpi/q35/APIC index 208331db53b7dd5c6205cce0e95427636b86dd64..868a3432f0295257393e45b7548= 3ef4bec455d74 100644 GIT binary patch delta 16 Xcmb=3DZ;BpM`bgp1vU|{Z;$dv~GB#s0m delta 16 Xcmb=3DZ;BpM`bgp1vU|{T;$dv~GB#Z delta 18 ZcmbQhIDwJNF~HM#0s{jBqxVFvHUKF)1V;b> diff --git a/tests/data/acpi/q35/APIC.core-count2 b/tests/data/acpi/q35/API= C.core-count2 index a255082ef5bc39f0d92d3e372b91f09dd6d0d9a1..f5da2eb1e8a93d961b39f665f2e= 8b02acf1aeb3c 100644 GIT binary patch delta 19 acmZ1{yiS{I`URQ* delta 19 acmZ1{yiS{I_yw8( diff --git a/tests/data/acpi/q35/APIC.cphp b/tests/data/acpi/q35/APIC.cphp index 65cc4f4a9aa2676140a6525cdac1e838274b1e07..a2c2a24e5e3cf143b57a8932f78= eeda6d7b8bbdb 100644 GIT binary patch delta 18 ZcmZ3$xPXz%F~HM#0RsaAv)DwgX#guQ1XKV3 delta 18 ZcmZ3$xPXz%F~HM#0RsaAqr^n6X#guO1XKV3 diff --git a/tests/data/acpi/q35/APIC.dimmpxm b/tests/data/acpi/q35/APIC.di= mmpxm index d904d4a70ddecbb79a83a267af8e26f925e9f4c6..9b5922bc72db1fe64819a3970d6= ca95543da799e 100644 GIT binary patch delta 18 ZcmbQhIDwJNF~HM#0s{jBv*$#vHUKF+1V;b> delta 18 ZcmbQhIDwJNF~HM#0s{jBqxVFvHUKF)1V;b> diff --git a/tests/data/acpi/q35/APIC.xapic b/tests/data/acpi/q35/APIC.xapic index c1969c35aa12b61d25e0134bbb8d2187ba42d663..83bd28325af9d6d7619015a9701= 866b8f3f1d754 100644 GIT binary patch delta 19 acmew-@=3Dt`zF~HNgj*EeTS#2X%2^Ro9-UT)Q delta 19 acmew-@=3Dt`zF~HNgj*EeTQDY-l2^Ro9+yyoO --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508021; cv=none; d=zohomail.com; s=zohoarc; b=h5ybsVfg4umiUv4pfYCwVja7FozF7j+Ob8ZsA4OHRrR3PVJNQgFL10YGJ0lfoG2MwPdAbzfVJ+CYmXyFvZ8gOoWXxSWAIQ/LyB7uHb9j44mDUcBV3gXGP0r+p7hdKGcG5D2zdhUm0EQoIjX6BWhkuXDEh7e+XN/WGiHDNfokLII= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508021; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=D2IiRUt7FD7TGEQRwdHh0IrJ8V8/JXfdzIWlpXzqwtg=; b=XptWTpfTJuesDK5I9y4oinkXAUWsHL01r/ZO00+cn/0Drf1p1C8pH7Im33cUmEGkfre9riMgzKvml3x1LHArSIDfTMLA6iplN3vhZrs9MjdbcddS+JQ1WvoJ1ok4VCfNPEIAzDkvy+x9PGK9T4kfIY/SduiU2N7//wIdPanhl1A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508021061895.930172033777; Fri, 19 May 2023 07:53:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01Rz-0002dH-2v; Fri, 19 May 2023 10:51: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 1q01Rx-0002Hw-9P for qemu-devel@nongnu.org; Fri, 19 May 2023 10:51:21 -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 1q01Rl-0003cA-2C for qemu-devel@nongnu.org; Fri, 19 May 2023 10:51:20 -0400 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-658-4GH_g_iQMAKKBjVkMYKMxQ-1; Fri, 19 May 2023 10:51:07 -0400 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2ac8c5e4aafso6154621fa.1 for ; Fri, 19 May 2023 07:51:06 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id 18-20020a05651c041200b002adbe01cd69sm864841lja.9.2023.05.19.07.51.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:51:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507868; h=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=D2IiRUt7FD7TGEQRwdHh0IrJ8V8/JXfdzIWlpXzqwtg=; b=MqAHNW0cUUGiw5hhggHJ0xRCCGAyH68ZpOPzDDkTYxTC+UK/uMleUwrZc1DT/UKUJ83VEZ DFW+lM25MusrFHble7vFvpU0huQdAXL4GSM4xamxPOI+j0gE/LfLpctf3pArk3+wIwpfhZ d4sT2bvjSExK3gt0ubgXkbm8L71BPGI= X-MC-Unique: 4GH_g_iQMAKKBjVkMYKMxQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507865; x=1687099865; 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=D2IiRUt7FD7TGEQRwdHh0IrJ8V8/JXfdzIWlpXzqwtg=; b=JaT+ufHdRyl0c4nSJvtGt8nyxA2k+tuV/Wv/St+hECsJmXzriqaM739dJ2mXvqNR9j wUFcTduM+KTVv7vU6Ew1HKy/GXpa0yRB7WkHtQ4XtjIOLwAdL3MBulwv0koD+osxDqP+ M6WJoyulws17WkafKOCqLl1zVxP9+OY3liijWGD+4tn6cLrRXEFQ2aNMywvArc6hW+JM ilMz2nIuhGL4XL5rc8DnCl3HR0/Xe3lHBaJVnT8dn+7CEWsGdLsyO/gsgo+smzdFOx6U 78g0kZt6xnWC2ouqrYWecRGEsLox5mJ84UGq1/W6Q6rlf4ClgWtSjCmxE+8Zsz952sIH IuUQ== X-Gm-Message-State: AC+VfDwClHx3em+jRQSCFbaBJ0KruexZjVNSjN+W/MWdKwH4c3r1uCgh mmWt5gq0ZgK0caOQUxtd5rMvrFB9ZVNOJ3Unm15U5YqAVLBja1NhOEjhWTcXfnMukx0tvTDD8dM +knjBjZMNXwz8ykMI7itA8XsgbpLDv08UW3uK+UYQDE/XkawkqK8Mn3vmeXFGHtOFOVCd X-Received: by 2002:a2e:b62c:0:b0:2a9:d4f0:6 with SMTP id s12-20020a2eb62c000000b002a9d4f00006mr824227ljn.17.1684507865299; Fri, 19 May 2023 07:51:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ50eR1CGuqIQEE74Ya31XxSNmarC218WeOqygFsE/lGHoYvCI5qd4uo69vfx7rgt5LFRDvxew== X-Received: by 2002:a2e:b62c:0:b0:2a9:d4f0:6 with SMTP id s12-20020a2eb62c000000b002a9d4f00006mr824215ljn.17.1684507865026; Fri, 19 May 2023 07:51:05 -0700 (PDT) Date: Fri, 19 May 2023 10:51:00 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Vladimir Sementsov-Ogievskiy , David Hildenbrand , Juan Quintela , Marcel Apfelbaum Subject: [PULL 16/40] pci: pci_add_option_rom(): improve style Message-ID: <4ab049c7e68919b92a5ece5ad5baa52d0a963676.1684507742.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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508022116100006 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Fix over-80 lines and missing curly brackets for if-operators, which are required by QEMU coding style. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: David Hildenbrand Message-Id: <20230515125229.44836-2-vsementsov@yandex-team.ru> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Juan Quintela --- hw/pci/pci.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 8a87ccc8b0..e26e2a7e65 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2312,10 +2312,9 @@ static void pci_add_option_rom(PCIDevice *pdev, bool= is_default_rom, char name[32]; const VMStateDescription *vmsd; =20 - if (!pdev->romfile) - return; - if (strlen(pdev->romfile) =3D=3D 0) + if (!pdev->romfile || !strlen(pdev->romfile)) { return; + } =20 if (!pdev->rom_bar) { /* @@ -2364,7 +2363,8 @@ static void pci_add_option_rom(PCIDevice *pdev, bool = is_default_rom, } if (pdev->romsize !=3D -1) { if (size > pdev->romsize) { - error_setg(errp, "romfile \"%s\" (%u bytes) is too large for R= OM size %u", + error_setg(errp, "romfile \"%s\" (%u bytes) " + "is too large for ROM size %u", pdev->romfile, (uint32_t)size, pdev->romsize); g_free(path); return; @@ -2374,14 +2374,13 @@ static void pci_add_option_rom(PCIDevice *pdev, boo= l is_default_rom, } =20 vmsd =3D qdev_get_vmsd(DEVICE(pdev)); + snprintf(name, sizeof(name), "%s.rom", + vmsd ? vmsd->name : object_get_typename(OBJECT(pdev))); =20 - if (vmsd) { - snprintf(name, sizeof(name), "%s.rom", vmsd->name); - } else { - snprintf(name, sizeof(name), "%s.rom", object_get_typename(OBJECT(= pdev))); - } pdev->has_rom =3D true; - memory_region_init_rom(&pdev->rom, OBJECT(pdev), name, pdev->romsize, = &error_fatal); + memory_region_init_rom(&pdev->rom, OBJECT(pdev), name, pdev->romsize, + &error_fatal); + ptr =3D memory_region_get_ram_ptr(&pdev->rom); if (load_image_size(path, ptr, size) < 0) { error_setg(errp, "failed to load romfile \"%s\"", pdev->romfile); --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684507909; cv=none; d=zohomail.com; s=zohoarc; b=jQ92PxOESwRLxPBiM1A7mV/L0jLmATQUyBw9JwtxJPdGzjhAjo7umoPIZNr7CyAPtinbCSK7jxADBOrO2D1/SeMb2+qdwlenhndEhT0L1pZCSJRVPP7tRgRb6t9qTkaDfsppCOpkl8Ux9dnpGxffdASVrfT7lIghkQRPRx5ts0Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684507909; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=x8XsV0KlHYQh1ZXv+BOwKL6equViqnXJvPOITuHI9uI=; b=hnfmDloZ4vBZf2qAH7xJxG6nVMH+FVnn/GH3Af4VGddBQWGkk2i1iyoLpec2QON+gAfGZC82HZ7KhuVdMtZPcJ8ybjrwQLWpg97BYLmesfAGtqn4dYU/tGHN6bLApt0eeMSU2kbRZhCcrJajccq9zA+xJ8Ndub9XMjUEh95JZ54= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684507909983160.05811788660355; Fri, 19 May 2023 07:51:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01Rx-0002Gx-5o; Fri, 19 May 2023 10:51: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 1q01Rv-00027D-PZ for qemu-devel@nongnu.org; Fri, 19 May 2023 10:51:19 -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 1q01Rq-0003cT-AD for qemu-devel@nongnu.org; Fri, 19 May 2023 10:51:15 -0400 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-511-9Dxj9jwzN1WrY8_ThJ9dCw-1; Fri, 19 May 2023 10:51:12 -0400 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-4ef455ba5feso2115281e87.3 for ; Fri, 19 May 2023 07:51:11 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id j16-20020ac253b0000000b004f2391fe9a6sm620169lfh.266.2023.05.19.07.51.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:51:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507873; h=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=x8XsV0KlHYQh1ZXv+BOwKL6equViqnXJvPOITuHI9uI=; b=gAD4qEYpvyMicfgzwLugm8ZlW+LI+eF4vGQzsm4Dwi16RFvRZz/4TbQw8+R092EjNcDir7 NblkDcJ9eUAqhMtVinOkSXZF2LyQ7JEJgz5c3fK7uKKGrOY2SGo36WTRe0Zxur2xLKMpPs uZhPv3i59Jo/2e4PHWDMG7e8agBiyOg= X-MC-Unique: 9Dxj9jwzN1WrY8_ThJ9dCw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507870; x=1687099870; 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=x8XsV0KlHYQh1ZXv+BOwKL6equViqnXJvPOITuHI9uI=; b=gPpzIMEiULXsdsx+XG1vEvF0abUJ1S8kloJRZ/Z4gFeFqDlC0BZbuWlvYUJyn1OPUO sUf7eXsCS7EUwrykYVi2QECFmsLagsSVtLDgMxo0YiJr9652jlM7s6PFKMyuYtdJ+Pla b53RLcZY9eYaV96Bm5+2BUZeN4Rti1mqgO/gPgjxGVvVur4pN09JRTTbrFNm/UQO/YZD brW+/a0uOXaiEZCCrA4N1nF1ck6w5PZDDTVN4kI0Q9HDOrOXT3zsmq1Y/U6MWmV2U2vk hlnuNqReVGdlrwmBHLd8c5ioQeyuwuUcbCw3cdwd0KAwLTphW1XSNKmIoRiQjqSmoQ4K URzg== X-Gm-Message-State: AC+VfDwK0AbABD9YVOSJFod0Xjp/PS1hWAOhVlIG4LDog9gzybaxB4ac X6uFLZZKJ/R8XLZkScv+nw+dCKhwcrAjaAx9JdD/pwVzLC8hO9QeheupBBOSStKCYPYaVrydIhs x53mHio64Qmt6qCoTT2v7bPq7yeh3me70ksiGp5wVLCrd+2JoALqeuKEZ1ldVL94ouy1M X-Received: by 2002:ac2:4c08:0:b0:4f3:b1e6:4b46 with SMTP id t8-20020ac24c08000000b004f3b1e64b46mr420965lfq.12.1684507870272; Fri, 19 May 2023 07:51:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4/Q+V3MZJks1RuITYhF2XzaoqHiwWjhBAiHpMutMBSfa8rRM6pOgcfXqj0tkliV48cIc4JnA== X-Received: by 2002:ac2:4c08:0:b0:4f3:b1e6:4b46 with SMTP id t8-20020ac24c08000000b004f3b1e64b46mr420952lfq.12.1684507870030; Fri, 19 May 2023 07:51:10 -0700 (PDT) Date: Fri, 19 May 2023 10:51:05 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Vladimir Sementsov-Ogievskiy , David Hildenbrand , Juan Quintela , Marcel Apfelbaum Subject: [PULL 17/40] pci: pci_add_option_rom(): refactor: use g_autofree for path variable Message-ID: <5b52692f9d258d0e2637234832dc00042de03a4d.1684507742.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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684507912077100007 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: David Hildenbrand Message-Id: <20230515125229.44836-3-vsementsov@yandex-team.ru> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Juan Quintela --- hw/pci/pci.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index e26e2a7e65..3a0107758c 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2307,7 +2307,7 @@ static void pci_add_option_rom(PCIDevice *pdev, bool = is_default_rom, Error **errp) { int64_t size; - char *path; + g_autofree char *path =3D NULL; void *ptr; char name[32]; const VMStateDescription *vmsd; @@ -2349,16 +2349,13 @@ static void pci_add_option_rom(PCIDevice *pdev, boo= l is_default_rom, size =3D get_image_size(path); if (size < 0) { error_setg(errp, "failed to find romfile \"%s\"", pdev->romfile); - g_free(path); return; } else if (size =3D=3D 0) { error_setg(errp, "romfile \"%s\" is empty", pdev->romfile); - g_free(path); return; } else if (size > 2 * GiB) { error_setg(errp, "romfile \"%s\" too large (size cannot exceed 2 G= iB)", pdev->romfile); - g_free(path); return; } if (pdev->romsize !=3D -1) { @@ -2366,7 +2363,6 @@ static void pci_add_option_rom(PCIDevice *pdev, bool = is_default_rom, error_setg(errp, "romfile \"%s\" (%u bytes) " "is too large for ROM size %u", pdev->romfile, (uint32_t)size, pdev->romsize); - g_free(path); return; } } else { @@ -2384,10 +2380,8 @@ static void pci_add_option_rom(PCIDevice *pdev, bool= is_default_rom, ptr =3D memory_region_get_ram_ptr(&pdev->rom); if (load_image_size(path, ptr, size) < 0) { error_setg(errp, "failed to load romfile \"%s\"", pdev->romfile); - g_free(path); return; } - g_free(path); =20 if (is_default_rom) { /* Only the default rom images will be patched (if needed). */ --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508047; cv=none; d=zohomail.com; s=zohoarc; b=Rhci0Fxlr8/3JtUR/F0sLoAoc5SkbCOfzY2XbKfNvKIvMdgMvQT/36+Ejng1BAl+TAKlmuQu47n3kCLTMNXSCHe62RSWeqw5jhZAO+W571BYrJCzPe6DoAxSwKNMsN1OiiG20ENmh9KbjGEc4mpW54n51dvAg+26wCKmBQgOBSc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508047; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XUPTcE5SdErzr0Z7x7ic8k6+QHDhF6znZOeSZPOw6AA=; b=VL6gVbZ63eY6/ZzQB5kbRXc0by3DO+MNZofEbepTWK2P51fFjVavmm1Uvnhzf6TFOLehGWdKBieiKPsFEbCx0r9SZb6v/hB6A1gSq9uYPYpYpgTLOXKbAqpq1fzJe0uCqsCzW27n31e4XVu6rxUuvabVU1Zm56otxu6wgXtxa/4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508047774915.9657120352305; Fri, 19 May 2023 07:54:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01S0-0002kQ-44; Fri, 19 May 2023 10:51: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 1q01Rx-0002NZ-OJ for qemu-devel@nongnu.org; Fri, 19 May 2023 10:51:21 -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 1q01Rw-0003cj-3R for qemu-devel@nongnu.org; Fri, 19 May 2023 10:51:21 -0400 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-20-6krmOWalOWui2e98PNB_QQ-1; Fri, 19 May 2023 10:51:17 -0400 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-4f3932e595dso2263608e87.1 for ; Fri, 19 May 2023 07:51:17 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id q1-20020ac24a61000000b004f3b38cd311sm33542lfp.78.2023.05.19.07.51.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:51:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507879; h=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=XUPTcE5SdErzr0Z7x7ic8k6+QHDhF6znZOeSZPOw6AA=; b=VU8K2YzT3EjYdMCeDyTB8Vk5jJzrAaOpY211HUUnOYFpFGGaGF+bZcxTaDztudS/kYCb7i /kTDWWX5+/rO3TDFx3gR+m6HNvamOGsaek3v1Y5D55/lSrBMqqmAch+tHYW0ryyUJ6stde 6YVlNeebTg0cDX6kQcd3NipqEyBs6pI= X-MC-Unique: 6krmOWalOWui2e98PNB_QQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507876; x=1687099876; 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=XUPTcE5SdErzr0Z7x7ic8k6+QHDhF6znZOeSZPOw6AA=; b=M1q5megnNpDCuZ3BhekafJMLuMWAWuRvZTT2WcA7OCulLJ0pmxHdMZczGbrJ761SZn 6fRmyoz6ZXwv0vhJrlf/Qmeok0oVviWANhR2Cq1xttexRsbq+6zpCZZXtKsVfWW+hwiC xq/WuSybgVg8XHADZe/oHK8HPI7LaDMpt+MK41Ranlhe168IOhDcMQHvCZgdYz3Lem5C w7pKT6GhS7hVk/7FpOTt7oeEzZ1CcB289Pp51nwkNIy1oQUT8j/Evkp9cRnDhrX9TWnu UJR/CCYY00gWi3YHDdVRU+TCBX4bIUydTS7zODXEnkVEogIroG8EeIJjUBhCLz48r60q 8xjg== X-Gm-Message-State: AC+VfDzBdoUuVM3SU1TzbJb4Yi0URgiffhkPUDe0as2zVvb7dYFIHY2J gs5mgAcj8YTyqIvpIsgrhED1GlZa37KCkBruYxJ8eWRQv7a7izdzwumHiyAZz6zmCJXFu+F7XP0 Wq3ucGkUHWlJTutjUvSOILqe0Z86fhvJjYg23AVeq8lbSKqSPfy0ctWpOLEbnMj7Nb6Li X-Received: by 2002:a05:6512:21c7:b0:4ed:cc6d:61fe with SMTP id d7-20020a05651221c700b004edcc6d61femr929482lft.24.1684507876021; Fri, 19 May 2023 07:51:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7E+3eeDRP9NAS0QGzPyRlsE8329J3c2Rl63BEpeUJrNdkzMexNXDv6OPEaYbVVQ7fJtGp4OQ== X-Received: by 2002:a05:6512:21c7:b0:4ed:cc6d:61fe with SMTP id d7-20020a05651221c700b004edcc6d61femr929471lft.24.1684507875780; Fri, 19 May 2023 07:51:15 -0700 (PDT) Date: Fri, 19 May 2023 10:51:10 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefan Hajnoczi , Cindy Lu , Yajun Wu , Maxime Coquelin , Eugenio =?utf-8?B?UMOpcmV6?= Subject: [PULL 18/40] vhost-user: send SET_STATUS 0 after GET_VRING_BASE Message-ID: <6f8be29ec17d44496b9ed67599bceaaba72d1864.1684507742.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508048248100001 From: Stefan Hajnoczi Setting the VIRTIO Device Status Field to 0 resets the device. The device's state is lost, including the vring configuration. vhost-user.c currently sends SET_STATUS 0 before GET_VRING_BASE. This risks confusion about the lifetime of the vhost-user state (e.g. vring last_avail_idx) across VIRTIO device reset. Eugenio P=C3=A9rez adjusted the order for vhost-vdpa.c in commit c3716f260bff ("vdpa: move vhost reset after get vring base") and in that commit description suggested doing the same for vhost-user in the future. Go ahead and adjust vhost-user.c now. I ran various online code searches to identify vhost-user backends implementing SET_STATUS. It seems only DPDK implements SET_STATUS and Yajun Wu has confirmed that it is safe to make this change. Fixes: commit 923b8921d210763359e96246a58658ac0db6c645 ("vhost-user: Suppor= t vhost_dev_start") Cc: Michael S. Tsirkin Cc: Cindy Lu Cc: Yajun Wu Signed-off-by: Stefan Hajnoczi Message-Id: <20230501230409.274178-1-stefanha@redhat.com> Reviewed-by: Maxime Coquelin Reviewed-by: Yajun Wu=C2=A0 Acked-by: Eugenio P=C3=A9rez Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-user.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index e5285df4ba..40974afd06 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -2677,7 +2677,20 @@ static int vhost_user_dev_start(struct vhost_dev *de= v, bool started) VIRTIO_CONFIG_S_DRIVER | VIRTIO_CONFIG_S_DRIVER_OK); } else { - return vhost_user_set_status(dev, 0); + return 0; + } +} + +static void vhost_user_reset_status(struct vhost_dev *dev) +{ + /* Set device status only for last queue pair */ + if (dev->vq_index + dev->nvqs !=3D dev->vq_index_end) { + return; + } + + if (virtio_has_feature(dev->protocol_features, + VHOST_USER_PROTOCOL_F_STATUS)) { + vhost_user_set_status(dev, 0); } } =20 @@ -2716,4 +2729,5 @@ const VhostOps user_ops =3D { .vhost_get_inflight_fd =3D vhost_user_get_inflight_fd, .vhost_set_inflight_fd =3D vhost_user_set_inflight_fd, .vhost_dev_start =3D vhost_user_dev_start, + .vhost_reset_status =3D vhost_user_reset_status, }; --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508084; cv=none; d=zohomail.com; s=zohoarc; b=V9UXYJHg/vxqkpADFgyZOyGnvO2VSQb1x7N4JZhTQxsdQvWYrNuMOvjb5A/T/fZRqylvQGC41o2fTgv5ttUZ3Q9FE8enodrDcuJO+YDt+sJlS20fVbOs+fdqMFfUTzkyeNOOBGi1rdm88oKULVYoiJj5stfWLSt19uIorImVdIQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508084; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=scD/t6FKL2vSfOhKYpUs6/tNGVFI4PHgCamZz9KPYUk=; b=WcCdI3I0B3jrzYZX463iN1Juh03UPSGsiYTA7nBi9SfZfMWRRAOnhTHR0uuOL69Own4MLUAjtUBJ0Gef5x7o7qZ+pZ3UvTiaSiALfUy1Tp/Fu8O9xaX63MDpB/Opch0gdPQTB5tsJ8/ENzmgm6L98ksJU1/NtSAZWGjcxZesVLY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508084223467.46116661424026; Fri, 19 May 2023 07:54:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01S5-0003AF-9B; Fri, 19 May 2023 10:51: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 1q01S4-00037f-7y for qemu-devel@nongnu.org; Fri, 19 May 2023 10:51: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 1q01S2-0003dV-Da for qemu-devel@nongnu.org; Fri, 19 May 2023 10:51:27 -0400 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-380-3GaB10ZTM7iP8JR1Zgy2iA-1; Fri, 19 May 2023 10:51:23 -0400 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2ac7e062911so17915711fa.2 for ; Fri, 19 May 2023 07:51:23 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id a6-20020a19f806000000b004f38260f196sm618728lff.218.2023.05.19.07.51.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:51:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507885; h=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=scD/t6FKL2vSfOhKYpUs6/tNGVFI4PHgCamZz9KPYUk=; b=B5Z09pEtVuZWLNsxctTqqky+jRv3MY2dB81hs1DX/FsWACFcDVC/I7hfLxxqN8th+kzfI4 L+IoY1EsMzUgjYnbWaq1UiQ20R5FEPjHBmUGk/3rt2etDgr+tQH3mGFpZtBS50qJZQknv5 r2mOsS0myve/mX08fGWx+dmJdiWZGPU= X-MC-Unique: 3GaB10ZTM7iP8JR1Zgy2iA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507882; x=1687099882; 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=scD/t6FKL2vSfOhKYpUs6/tNGVFI4PHgCamZz9KPYUk=; b=NovS4NwZP2VHUHg5HFWjB9K5wuwyRos6DIG8kaD4gEGWaUL4LOLiCo9k2QllXdDWdz 1XlUtk9+vTcsVWxshVwOMruQXK3VvlezBfZhbQmc1HDjbq7LPhXo2x2D/m0UsjZoiHp6 SfAlzQdrqe1uPSqrQsV9nUMLEDuOeUJYdgUfn/wv8RrAk0mvBMxTizBXPQrVnGcnvNCW WWSKgvom2tfgIW/8xiW5P9kjsacGcJe8cvqdes00hjmjeCZm2xpo2xpPtbFgkqISxRcN aCJ/K0fqdgO/GmnTZOjkqPbRk8i5GWKnr36CCLtHoYVONxYUL4T5d8q1k/yhEm0159zP U08Q== X-Gm-Message-State: AC+VfDyXiVY7SyBk4nGv7rjD4MWk0fhUYP1tbhsEaihYqCzvJLrLAGfh Oj1e1wp/1Bdf5dQExFFgGr8MaemJDYQUMyOK2rT2VDT28+alyFjUpLD5EKyfrsvm0YKTfb+0L2K E4mU92bGbaqnzYilyWsffQopb8C2UI5YA2fdmHU+XjysXKZNyxZvaRdCyhm77ZzUfzL+T X-Received: by 2002:ac2:489a:0:b0:4f3:a4ce:7ccd with SMTP id x26-20020ac2489a000000b004f3a4ce7ccdmr837224lfc.35.1684507881921; Fri, 19 May 2023 07:51:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6L/auj6WCtEsR82SBz3AfLgfsHQKnDqe1Q4VCZa4CrmBkzQAu10udk/ot9EQqqkzog3ZBDog== X-Received: by 2002:ac2:489a:0:b0:4f3:a4ce:7ccd with SMTP id x26-20020ac2489a000000b004f3a4ce7ccdmr837209lfc.35.1684507881652; Fri, 19 May 2023 07:51:21 -0700 (PDT) Date: Fri, 19 May 2023 10:51:16 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Leonardo Bras , Jonathan Cameron , Peter Xu , Juan Quintela , Fiona Ebner , Eduardo Habkost , Marcel Apfelbaum , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Yanan Wang Subject: [PULL 19/40] hw/pci: Disable PCI_ERR_UNCOR_MASK register for machine type < 8.0 Message-ID: <5ed3dabe57dd9f4c007404345e5f5bf0e347317f.1684507742.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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508084814100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Leonardo Bras Since it's implementation on v8.0.0-rc0, having the PCI_ERR_UNCOR_MASK set for machine types < 8.0 will cause migration to fail if the target QEMU version is < 8.0.0 : qemu-system-x86_64: get_pci_config_device: Bad config data: i=3D0x10a read:= 40 device: 0 cmask: ff wmask: 0 w1cmask:0 qemu-system-x86_64: Failed to load PCIDevice:config qemu-system-x86_64: Failed to load e1000e:parent_obj qemu-system-x86_64: error while loading state for instance 0x0 of device '0= 000:00:02.0/e1000e' qemu-system-x86_64: load of migration failed: Invalid argument The above test migrated a 7.2 machine type from QEMU master to QEMU 7.2.0, with this cmdline: ./qemu-system-x86_64 -M pc-q35-7.2 [-incoming XXX] In order to fix this, property x-pcie-err-unc-mask was introduced to control when PCI_ERR_UNCOR_MASK is enabled. This property is enabled by default, but is disabled if machine type <=3D 7.2. Fixes: 010746ae1d ("hw/pci/aer: Implement PCI_ERR_UNCOR_MASK register") Suggested-by: Michael S. Tsirkin Signed-off-by: Leonardo Bras Message-Id: <20230503002701.854329-1-leobras@redhat.com> Reviewed-by: Jonathan Cameron Reviewed-by: Peter Xu Reviewed-by: Juan Quintela Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1576 Tested-by: Fiona Ebner Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/pci/pci.h | 2 ++ hw/core/machine.c | 1 + hw/pci/pci.c | 2 ++ hw/pci/pcie_aer.c | 11 +++++++---- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 935b4b91b4..e6d0574a29 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -207,6 +207,8 @@ enum { QEMU_PCIE_EXTCAP_INIT =3D (1 << QEMU_PCIE_EXTCAP_INIT_BITNR), #define QEMU_PCIE_CXL_BITNR 10 QEMU_PCIE_CAP_CXL =3D (1 << QEMU_PCIE_CXL_BITNR), +#define QEMU_PCIE_ERR_UNC_MASK_BITNR 11 + QEMU_PCIE_ERR_UNC_MASK =3D (1 << QEMU_PCIE_ERR_UNC_MASK_BITNR), }; =20 typedef struct PCIINTxRoute { diff --git a/hw/core/machine.c b/hw/core/machine.c index 47a34841a5..07f763eb2e 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -48,6 +48,7 @@ GlobalProperty hw_compat_7_2[] =3D { { "e1000e", "migrate-timadj", "off" }, { "virtio-mem", "x-early-migration", "false" }, { "migration", "x-preempt-pre-7-2", "true" }, + { TYPE_PCI_DEVICE, "x-pcie-err-unc-mask", "off" }, }; const size_t hw_compat_7_2_len =3D G_N_ELEMENTS(hw_compat_7_2); =20 diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 3a0107758c..1cc7c89036 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -79,6 +79,8 @@ static Property pci_props[] =3D { DEFINE_PROP_STRING("failover_pair_id", PCIDevice, failover_pair_id), DEFINE_PROP_UINT32("acpi-index", PCIDevice, acpi_index, 0), + DEFINE_PROP_BIT("x-pcie-err-unc-mask", PCIDevice, cap_present, + QEMU_PCIE_ERR_UNC_MASK_BITNR, true), DEFINE_PROP_END_OF_LIST() }; =20 diff --git a/hw/pci/pcie_aer.c b/hw/pci/pcie_aer.c index 103667c368..374d593ead 100644 --- a/hw/pci/pcie_aer.c +++ b/hw/pci/pcie_aer.c @@ -112,10 +112,13 @@ int pcie_aer_init(PCIDevice *dev, uint8_t cap_ver, ui= nt16_t offset, =20 pci_set_long(dev->w1cmask + offset + PCI_ERR_UNCOR_STATUS, PCI_ERR_UNC_SUPPORTED); - pci_set_long(dev->config + offset + PCI_ERR_UNCOR_MASK, - PCI_ERR_UNC_MASK_DEFAULT); - pci_set_long(dev->wmask + offset + PCI_ERR_UNCOR_MASK, - PCI_ERR_UNC_SUPPORTED); + + if (dev->cap_present & QEMU_PCIE_ERR_UNC_MASK) { + pci_set_long(dev->config + offset + PCI_ERR_UNCOR_MASK, + PCI_ERR_UNC_MASK_DEFAULT); + pci_set_long(dev->wmask + offset + PCI_ERR_UNCOR_MASK, + PCI_ERR_UNC_SUPPORTED); + } =20 pci_set_long(dev->config + offset + PCI_ERR_UNCOR_SEVER, PCI_ERR_UNC_SEVERITY_DEFAULT); --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508142; cv=none; d=zohomail.com; s=zohoarc; b=O67dVpQjAzTK7mID7neuGJlkQzGIuEMLOkmQbT3WlVLavJofhw6RLUsiIuNEW8x3UDbv0swtd49dRy8/WJUHGRATlwpKnIdvtS+3xMgcD8q3m4RKAGCBV4mhhkBtki/YFZWbCOd5c2Yr2F7Lv6kCeOdK7is5ksMNvfYTDeov30o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508142; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3a5VBfyfVaZtQkBTAD7S89WTx9VSHLv7NsVNGa8+EsM=; b=C681fzN7vbtfhercNfRwabrA2CkkkVA7RXo7stm6TV5diNWT4FV03kQgagdsQdhyFkB+VOBBA+wASq4zdrGW5mjhE6fPZWXyowh/FQIoVt6QDrT13g4/sLeGMN44hfT+rUn0smWd0351nMUo86ZSj8JOIiN2N3+wYKGNlw0IGd4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508142854274.01290775133623; Fri, 19 May 2023 07:55:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01SD-0003Zt-Fx; Fri, 19 May 2023 10:51: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 1q01SB-0003RB-MI for qemu-devel@nongnu.org; Fri, 19 May 2023 10:51: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 1q01S9-0003fU-4i for qemu-devel@nongnu.org; Fri, 19 May 2023 10:51:35 -0400 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-494-HqTJo0afNYGHSHiRVxIGuQ-1; Fri, 19 May 2023 10:51:29 -0400 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-4f020caac60so2235512e87.0 for ; Fri, 19 May 2023 07:51:29 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id j16-20020ac253b0000000b004f2391fe9a6sm620239lfh.266.2023.05.19.07.51.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:51:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507891; h=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=3a5VBfyfVaZtQkBTAD7S89WTx9VSHLv7NsVNGa8+EsM=; b=cZkEWmiB/22G8ZJDVwF3nmkz+ImS0n5n8cQ7SNtB8UR7ZS9rv1yW6Hd+9v+2Z4iFD0gvS0 vuUds51Nu1GC4F6g2WdBKi0IOvBNFVJedjJYVhWbISj049w9oaHwGqv/5yYMHED8Kn9o4c 0dRalvjZM37fCE6Df5N/gM78EG0mo7s= X-MC-Unique: HqTJo0afNYGHSHiRVxIGuQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507888; x=1687099888; 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=3a5VBfyfVaZtQkBTAD7S89WTx9VSHLv7NsVNGa8+EsM=; b=QMvllrWtraHUosxkhh4pgN9ygBFyNztdKnwxjv/aReDZHz1CY45j7+d8nDE7sy6Xp0 3aqxoUWuDE0l/yTIz0pXXHmC8UgFJ0+Z5zu5zwBPGXT4yGP5aa/C90USDH6wgmGIoonD ydKqaAue8EmROczRUGKJrPbBNQfd8lqxpbv7+IYxaUPdUQrW3f0BphfGLn8bm8IlKiem bgyTFH9ttk29SX1bb1aPnRwcsUE3rgQVYOkd3I6stUylOksie6ZDwzYVeJ+3yi6I6E8Z LegopPGOW1LqRPa43ZCZnlajA2lWBToQ/al4obltDvpy+Xdh7VhnEbP3DCKZPmHJ2GYB 6WLw== X-Gm-Message-State: AC+VfDzwRzTqryYNrOrpBnO11kWzDO2sVvmihpiluNjFr6xXvFDgKBrw 9cytnPDg8mJnQX2sL0foAKA2q6xjO3Af0mMJCVwtUvbuFneFpTp6ibuqqUzLXsmJcGyk0sZ5Ofw dl7k5yL3L0g+IkjkLldpfoAo3OkRX7nu/UyR2RBB5OmcwW7urx7xUaFLFFAB29oCQwJ0X X-Received: by 2002:ac2:4d0d:0:b0:4f2:72be:22eb with SMTP id r13-20020ac24d0d000000b004f272be22ebmr787742lfi.55.1684507887880; Fri, 19 May 2023 07:51:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6dAjZT+90uKvaMdcJe08CoGHza9OmxOJ9wwq3EeDxNjuTdLB446RO7fnqIp66oHo+KE+dvJw== X-Received: by 2002:ac2:4d0d:0:b0:4f2:72be:22eb with SMTP id r13-20020ac24d0d000000b004f272be22ebmr787732lfi.55.1684507887580; Fri, 19 May 2023 07:51:27 -0700 (PDT) Date: Fri, 19 May 2023 10:51:21 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , David Hildenbrand , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 20/40] virtio-mem: Default to "unplugged-inaccessible=on" with 8.1 on x86-64 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508144941100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: David Hildenbrand Allowing guests to read unplugged memory simplified the bring-up of virtio-mem in Linux guests -- which was limited to x86-64 only. On arm64 (which was added later), we never had legacy guests and don't even allow to configure it, essentially always having "unplugged-inaccessible=3Don". At this point, all guests we care about should be supporting VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE, so let's change the default for the 8.1 machine. This change implies that also memory that supports the shared zeropage (private anonymous memory) will now require VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE in the driver in order to be usable by the guest -- as default, one can still manually set the unplugged-inaccessible property. Disallowing the guest to read unplugged memory will be important for some future features, such as memslot optimizations or protection of unplugged memory, whereby we'll actually no longer allow the guest to even read from unplugged memory. At some point, we might want to deprecate and remove that property. Cc: "Michael S. Tsirkin" Cc: Marcel Apfelbaum Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost Signed-off-by: David Hildenbrand Message-Id: <20230503182352.792458-1-david@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/pc.c | 4 +++- hw/virtio/virtio-mem.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index d761c8c775..7802dc21d9 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -116,7 +116,9 @@ { "qemu64-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, }= ,\ { "athlon-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, }, =20 -GlobalProperty pc_compat_8_0[] =3D {}; +GlobalProperty pc_compat_8_0[] =3D { + { "virtio-mem", "unplugged-inaccessible", "auto" }, +}; const size_t pc_compat_8_0_len =3D G_N_ELEMENTS(pc_compat_8_0); =20 GlobalProperty pc_compat_7_2[] =3D { diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index 957fe77dc0..538b695c29 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -1341,7 +1341,7 @@ static Property virtio_mem_properties[] =3D { TYPE_MEMORY_BACKEND, HostMemoryBackend *), #if defined(VIRTIO_MEM_HAS_LEGACY_GUESTS) DEFINE_PROP_ON_OFF_AUTO(VIRTIO_MEM_UNPLUGGED_INACCESSIBLE_PROP, VirtIO= MEM, - unplugged_inaccessible, ON_OFF_AUTO_AUTO), + unplugged_inaccessible, ON_OFF_AUTO_ON), #endif DEFINE_PROP_BOOL(VIRTIO_MEM_EARLY_MIGRATION_PROP, VirtIOMEM, early_migration, true), --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508218; cv=none; d=zohomail.com; s=zohoarc; b=GWpfJOiUtlAf7pstNWd5MqxKZdFoi40gJ+sf5TQNdp+TcjyXft+coT8yN5+Y6LaU+wR5Q64yd9ybnhYtyuDPcq3bMMGh0pDY5vbB6mkUcpMV9bVRvAV29UARDe4DMs1XrIMnGJT2UvrZqNeAhW8rlc1RyHBlFj1sHcTGCm7b9HI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508218; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SxaVYbD07JQoLxbrFvNgYxKeREtojHgH3ZDGsvoJASA=; b=PnCRo7IqyCci0j9Ox6GdGJCmgpsvcCmBdWkNuxNQNgA41FAefqq+tZKJ66ig46a4lrgMumFDIjhtyzL5HrYo7ZlO+JOhTljGmIT/qNMMy+OZCz1KLpjhXx2+2qf+uvoEK7KLbdBFBqWZYU5VmoIOayOLws1AlTqXqYZeiawWii4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508218863338.8310195612204; Fri, 19 May 2023 07:56:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01SG-0003ef-6x; Fri, 19 May 2023 10:51: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 1q01SE-0003c2-4F for qemu-devel@nongnu.org; Fri, 19 May 2023 10:51: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 1q01SC-0003fk-Ey for qemu-devel@nongnu.org; Fri, 19 May 2023 10:51:37 -0400 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-628-TDxwn4ADO3yr72IQqO8cSA-1; Fri, 19 May 2023 10:51:34 -0400 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-4f37c82f185so2130562e87.0 for ; Fri, 19 May 2023 07:51:34 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id 24-20020ac24858000000b004cb43eb09dfsm623155lfy.123.2023.05.19.07.51.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507895; h=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=SxaVYbD07JQoLxbrFvNgYxKeREtojHgH3ZDGsvoJASA=; b=XZYwhtAThJw9gV45CkVFlLWrpkwQOEoW3sd7VAKYrjBYhWcyEPUesnLT2PQ2DnXMlQ7k4v qbW26LrXh0eS81XOfHGZOpwOPCVuw9oVhOZauxCtYXVlOH/oFsgDXZMBZS/aBdDkO/lKQF SjZtcYD+a3EzCQ7pY0kaaQM+ostoLI8= X-MC-Unique: TDxwn4ADO3yr72IQqO8cSA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507893; x=1687099893; 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=SxaVYbD07JQoLxbrFvNgYxKeREtojHgH3ZDGsvoJASA=; b=cJBEMn6vDFM4InVtkYgPRiCFjEKbxXm1wE49CtIOsuUu0nCKGVISMVNSErjTaxlLsP b2yDq/yE5Q1cX7T66mfq8WZpdKV1JeiJ0FsZmed5ABu3Y1DuyqSfT2PbkZH2Ghj5UTGD FchGqgINA4FZk2X4DmLUZX8QpvmLJsKjZQH5Pwc9AebqwFwh2ZzIjMtQsDuQhSiJg+oK py4cJymATHXUDL3qZBLUMsfkhTrB8v12p4/eDTiabyZ3l4ZCA65tYUsyJPBfK+inVWIc NHxHiWjosNLoWjFMGycxrTFfJkBanjRRSmZ2NOV5ia5d8kV69c5XWcKWc9R4lwUnhAso W/pQ== X-Gm-Message-State: AC+VfDyEc9qxsCOlEt+hXnty2txaOCdzbz0s2wjBna7Bm7x/OTGc1cZz PPtzKwaT4Z9fuIF2J5is6jJH1exM4520ZmCKH7WwtF/Tp/6iLnufeXBbIZzCwEehGiNigLbFbIL Gb8fR51CXhoQEk+Z1kldlx0jO/obA30q9UdpNchsuUMVrw7fUgBEsSPeDos5EMwT4e1C0 X-Received: by 2002:ac2:48b1:0:b0:4f3:a944:bb61 with SMTP id u17-20020ac248b1000000b004f3a944bb61mr917986lfg.55.1684507892843; Fri, 19 May 2023 07:51:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4y2NkEGvGzRFZ2JZ3kR4jNFbBRwaCGks83+5ixLlaX0l5PcW5R0DwRQJpJ9SqyploynSBpsw== X-Received: by 2002:ac2:48b1:0:b0:4f3:a944:bb61 with SMTP id u17-20020ac248b1000000b004f3a944bb61mr917975lfg.55.1684507892500; Fri, 19 May 2023 07:51:32 -0700 (PDT) Date: Fri, 19 May 2023 10:51:27 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , David Hildenbrand , Igor Mammedov , Stefan Hajnoczi Subject: [PULL 21/40] vhost-user: Remove acpi-specific memslot limit 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508219280100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: David Hildenbrand Let's just support 512 memslots on x86-64 and aarch64 as well. The maximum number of ACPI slots (256) is no longer completely expressive ever since we supported virtio-based memory devices. Further, we're completely ignoring other memslots used outside of memory device context, such as memslots used for boot memory. Note that the vhost memslot limit in the kernel is usually configured to be 509. With this change, we prepare vhost-user on the QEMU side to be closer to that limit, to eventually support ~512 memslots in most vhost implementations and have less "surprises" when cold/hotplugging vhost devices while also consuming more memslots than we're currently used to by memory devices (e.g., once virtio-mem starts using multiple memslots). Note that most vhost-user implementations only support a small number of memslots so far, which we can hopefully improve in the near future. We'll leave the PPC special-case as is for now. Cc: "Michael S. Tsirkin" Cc: Igor Mammedov Cc: Stefan Hajnoczi Signed-off-by: David Hildenbrand Message-Id: <20230503184144.808478-1-david@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-user.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 40974afd06..e3ec8727da 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -42,17 +42,7 @@ #define VHOST_USER_F_PROTOCOL_FEATURES 30 #define VHOST_USER_BACKEND_MAX_FDS 8 =20 -/* - * Set maximum number of RAM slots supported to - * the maximum number supported by the target - * hardware plaform. - */ -#if defined(TARGET_X86) || defined(TARGET_X86_64) || \ - defined(TARGET_ARM) || defined(TARGET_AARCH64) -#include "hw/acpi/acpi.h" -#define VHOST_USER_MAX_RAM_SLOTS ACPI_MAX_RAM_SLOTS - -#elif defined(TARGET_PPC) || defined(TARGET_PPC64) +#if defined(TARGET_PPC) || defined(TARGET_PPC64) #include "hw/ppc/spapr.h" #define VHOST_USER_MAX_RAM_SLOTS SPAPR_MAX_RAM_SLOTS =20 --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508026; cv=none; d=zohomail.com; s=zohoarc; b=cOWS/2MzR+Yt8j/PjT0p4QHT2+cobUMLrrYso916pq6jpF+Za74fnR00dnTIrM71DZJ782e43Es7F0tMh7JNGWkWB+hI1TmPXKQdmSktDfrBeanwE4q+gyWl3+po+2GvfTgIb+EhTUq5F7xQvyluTVuuLU3oE4Pq5zGiz8Mc1Rk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508026; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3Y4RlRUifuWdGvfjUojCEkNyIBAd0v/LeQqgJVREKVs=; b=kB2hcog2NH/prjBgl1qudWLLCXSbDlqrmgqdkrvzpDbMzMxdP8kkg2ta0hGL5gvNszMbOys+p8V+epW1ij/3QCzMGiKMXukrlh9ZKZEySK4rN3nfA+NBi15cqRq/+3Pxl0JclTG9jCjFoQIHmHSXnNYAElZuoSHh8L+byX8f/v0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508026934609.5682128601129; Fri, 19 May 2023 07:53:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01SP-0003vo-D1; Fri, 19 May 2023 10:51: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 1q01SM-0003tF-SP for qemu-devel@nongnu.org; Fri, 19 May 2023 10:51: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 1q01SK-0003gH-Ra for qemu-devel@nongnu.org; Fri, 19 May 2023 10:51:46 -0400 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-443-sM43P0yjMUStktIED10Scw-1; Fri, 19 May 2023 10:51:40 -0400 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-4f38f48be8bso2238357e87.2 for ; Fri, 19 May 2023 07:51:40 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id u3-20020ac248a3000000b004f14591a942sm614489lfg.271.2023.05.19.07.51.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:51:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507901; h=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=3Y4RlRUifuWdGvfjUojCEkNyIBAd0v/LeQqgJVREKVs=; b=DRB/etKIJizbOeoJ7CPVz0qF17AFvYaloVQkyk0OcnIKnUoEcDKxCpr+XvcRS4JffL48o5 zkYFV5VtzX05xRidcS8lI3JKuW8OL5XKsGSCZANKIZ/CtG9fYg3WN+GxWOJjY7ETnyDk7B S2sSz43PWi43e1IN+vRQJ1g7A8UtIzQ= X-MC-Unique: sM43P0yjMUStktIED10Scw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507898; x=1687099898; 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=3Y4RlRUifuWdGvfjUojCEkNyIBAd0v/LeQqgJVREKVs=; b=AahGrRmkn9ieXZiZivmkpVnNoPupj5J2+inOzUAim+xKTM49SfNKNEWAr2OjirYFkC AcfSKIVafN6smNPbaHRUf12CXf1g7l4Gu7aXTLASw1qqJQ6a3lBwB7Oh5x8Hcads6au0 MMD2wgsWBOKznCECJAKubxuFxumNhTt1jnQxGtxuJwjRu99T47YR4MifzBGqwua8Xezz /XpZUhK5oql6zNpYBmX+9Xg9QkSPqPhk7pn9hX0exb2ZTEqiWAqnVi+IlmPcacCYCor2 YPGX11prwE6Dmp8BxtLJq3sdaK5S5mkchWR6/TAaoD3GoF0qYfM6ceUSafOtT8ZwyECs flvA== X-Gm-Message-State: AC+VfDyV/9gKDFE9ELQLhC+9GNjR7Cm3RW6EnXLJ2XqVyhpbUYi1LHfP tMJ2PW0rWTRaUkQ3HIcHzQbOcnM1aFVtg4ScdEdLUEiE8+Q+xFaxKrkzt2H5rPk9ds+YKvWkxKm JrXOYpY9KweNo8DNVp8sUhGhRZgH+alvHpoKkyAgKntUMtAhc+/YPnD/h5HBoM4wHaoJx X-Received: by 2002:ac2:5973:0:b0:4f3:ac64:84f8 with SMTP id h19-20020ac25973000000b004f3ac6484f8mr851479lfp.34.1684507898528; Fri, 19 May 2023 07:51:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7AYWDiUW4KeHq8NfvE66wGpALh6ea0vXBc9tAjZ4u6rgWH2zFOSb1svzzx9YUAxZ/jLqAEHQ== X-Received: by 2002:ac2:5973:0:b0:4f3:ac64:84f8 with SMTP id h19-20020ac25973000000b004f3ac6484f8mr851466lfp.34.1684507898180; Fri, 19 May 2023 07:51:38 -0700 (PDT) Date: Fri, 19 May 2023 10:51:32 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Eugenio =?utf-8?B?UMOpcmV6?= , Xuan Zhuo , Jason Wang Subject: [PULL 22/40] virtio-net: not enable vq reset feature unconditionally Message-ID: <1fac00f70b3261050af5564b20ca55c1b2a3059a.1684507742.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508028127100001 From: Eugenio P=C3=A9rez The commit 93a97dc5200a ("virtio-net: enable vq reset feature") enables unconditionally vq reset feature as long as the device is emulated. This makes impossible to actually disable the feature, and it causes migration problems from qemu version previous than 7.2. The entire final commit is unneeded as device system already enable or disable the feature properly. This reverts commit 93a97dc5200a95e63b99cb625f20b7ae802ba413. Fixes: 93a97dc5200a ("virtio-net: enable vq reset feature") Signed-off-by: Eugenio P=C3=A9rez Message-Id: <20230504101447.389398-1-eperezma@redhat.com> Reviewed-by: Xuan Zhuo Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/net/virtio-net.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 447f669921..8ce239a34d 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -805,7 +805,6 @@ static uint64_t virtio_net_get_features(VirtIODevice *v= dev, uint64_t features, } =20 if (!get_vhost_net(nc->peer)) { - virtio_add_feature(&features, VIRTIO_F_RING_RESET); return features; } =20 --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508208; cv=none; d=zohomail.com; s=zohoarc; b=EePP0c3BUXqHa3yRJqlldeVGFWdFYhC0bsVNdZ2sGjZyGrvQVlhO9SpWQ6MsrwwDnoZzjZG9GqucqbVjIgMQ+y9pI8iFn4yHgQ0bqU8zpvuebWD/AeDPI3u51MFRJ9w8TX+Rfaa/wGAYrTtf0Z1fbOkzA+PbQ0qsoK1TDYS8iok= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508208; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kHVWE9pMIWQclfvDGF+QtPkpgYsCEq0QUnqNj9BA47s=; b=D70A2cBKVXo3zsUwchWw7B7oVjMIUawhEmCv4MzKPJVsbaw2lgLrvxn8jGrxOVVzvyOu9ZYoojMA3hsxzNxfH/nmOtUQUKOeNHG+NCOYb6pRTX3WHNgN3X01Ty9CRDpgyvU0qswcjA/5V8jjyEb7ZPioJYYsr2vBstkXPvGZh7Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508208152949.7857834951311; Fri, 19 May 2023 07:56:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01Sl-0004KI-2z; Fri, 19 May 2023 10:52: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 1q01SO-0003va-KV for qemu-devel@nongnu.org; Fri, 19 May 2023 10:51:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q01SN-0003gf-1x for qemu-devel@nongnu.org; Fri, 19 May 2023 10:51:48 -0400 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-670-4RVGdg4aMqa8FlGHYkru7A-1; Fri, 19 May 2023 10:51:45 -0400 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-4f397572596so2010024e87.2 for ; Fri, 19 May 2023 07:51:44 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id e5-20020a056512090500b004f38411f148sm626343lft.84.2023.05.19.07.51.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:51:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507906; h=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=kHVWE9pMIWQclfvDGF+QtPkpgYsCEq0QUnqNj9BA47s=; b=HkKFNnLRzJqTHeC3Irv1pJnUodsjPsrnFOrjNpaHTLg5xG3hb8zeGJ3vCpjDA4eoGfAMQH AT+P3d3ozdueyX5EeWbanPT4ykipWkKmBPyVbpU4+gq3FHfH8D0zJFbit//lxAAkDIcwhT VWPaUbwONM+cuWz6tXlCZHBOTU3UWGQ= X-MC-Unique: 4RVGdg4aMqa8FlGHYkru7A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507903; x=1687099903; 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=kHVWE9pMIWQclfvDGF+QtPkpgYsCEq0QUnqNj9BA47s=; b=cb4CBGpAFPrjwAzM46cM/8nlWpmLXLlRBkZ2XMVx/kcVtNSaiAv6+ykass6dlyYTIB iuqPoNHcfcuZ7mui+91xyXObA5rLElGQSxlG8dFyrw79Z1Dx221f3Vnc50GqZcf/OTNG OSb98A/kFawuBMZbIzuIcOOla64tB3PIF0rTkRzPWXmSNNw4tCgpAV78osLwZyCg66Y5 UWZyM7YDpxp80QLFPpYMMo1JmTWBPjWLqEAHujHbgWgzENYTikyRUAYofwVM/9Ls2Yph IGp8NCsYtcgLoXsQdIqfpaiiVx0lH/wE3AlZMzw7VOmLTQrBlo+Hh3+EC62Tkw8cCGW4 k6sw== X-Gm-Message-State: AC+VfDwnr4joAXYuRkxqaWzPHznHCTGQ2uCddfOIMw0oTmrvNCxVtYsO rfoT+1mI3cwOPlFIUnyjdy23BToRuFpjZBv43QqUHgWoS5is+grzqjKi2sh6LnuOrb22BqgjeTg wPFuCW7paOvMdifFAgJqI5R85OOmXnW1TL6hw9EeBbqFhVY7L4A659yHLsuQNZFMnHUA4 X-Received: by 2002:ac2:4846:0:b0:4dc:8192:c5e6 with SMTP id 6-20020ac24846000000b004dc8192c5e6mr802942lfy.13.1684507903307; Fri, 19 May 2023 07:51:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Txw1swKS3OJfyf//G8/Xuy1YQxI8949xdqLPQQRFSEe04UYk9HZTxQkns8DTpSxashjS+Eg== X-Received: by 2002:ac2:4846:0:b0:4dc:8192:c5e6 with SMTP id 6-20020ac24846000000b004dc8192c5e6mr802929lfy.13.1684507903066; Fri, 19 May 2023 07:51:43 -0700 (PDT) Date: Fri, 19 May 2023 10:51:38 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Mauro Matteo Cascella , Yiming Tao , Gonglei , zhenwei pi Subject: [PULL 23/40] virtio-crypto: fix NULL pointer dereference in virtio_crypto_free_request Message-ID: <3e69908907f8d3dd20d5753b0777a6e3824ba824.1684507742.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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508209196100002 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Mauro Matteo Cascella Ensure op_info is not NULL in case of QCRYPTODEV_BACKEND_ALG_SYM algtype. Fixes: 0e660a6f90a ("crypto: Introduce RSA algorithm") Signed-off-by: Mauro Matteo Cascella Reported-by: Yiming Tao Message-Id: <20230509075317.1132301-1-mcascell@redhat.com> Reviewed-by: Gonglei Reviewed-by: zhenwei pi Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-crypto.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c index 2fe804510f..c729a1f79e 100644 --- a/hw/virtio/virtio-crypto.c +++ b/hw/virtio/virtio-crypto.c @@ -476,15 +476,17 @@ static void virtio_crypto_free_request(VirtIOCryptoRe= q *req) size_t max_len; CryptoDevBackendSymOpInfo *op_info =3D req->op_info.u.sym_op_info; =20 - max_len =3D op_info->iv_len + - op_info->aad_len + - op_info->src_len + - op_info->dst_len + - op_info->digest_result_len; + if (op_info) { + max_len =3D op_info->iv_len + + op_info->aad_len + + op_info->src_len + + op_info->dst_len + + op_info->digest_result_len; =20 - /* Zeroize and free request data structure */ - memset(op_info, 0, sizeof(*op_info) + max_len); - g_free(op_info); + /* Zeroize and free request data structure */ + memset(op_info, 0, sizeof(*op_info) + max_len); + g_free(op_info); + } } else if (req->flags =3D=3D QCRYPTODEV_BACKEND_ALG_ASYM) { CryptoDevBackendAsymOpInfo *op_info =3D req->op_info.u.asym_op_inf= o; if (op_info) { --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508243; cv=none; d=zohomail.com; s=zohoarc; b=TiZOuBvAqwUPq3JzjHb0tEUvl7TLAw5AhILY9g0VTcSyBDj1TiiqH6jpo8kp66EA9MO+F2amFTb1lCfosJN0JgFLK058yAr9WLiCFxDPaq0bk9nyQpeKenTKh3j3ck8/HjkXkzBtLc6Kc6x3ifTwJ6Mn1DXaf9yHna1dFdPoJtk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508243; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TieozOKcq7wNxJeAelFrvx+KwG5hCz5Or4GbbfSJris=; b=IPaJz80z96+P+8NFHfqzdFto/IWWKNHq8ZApPEaDUQs4ifE5m9OOqK9Hfhar+W7NT2C25OzcOPSw47pp+jucYz5mbHOA0FogqpZXSgWbsEWRlYczwGQ6/kXkHvMeChla5NQSclsspgCXtAsz5VQGH3jBeJ/zZJ4tPYeX0risfr4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508243808909.4448496128352; Fri, 19 May 2023 07:57:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01Sy-0004pO-2e; Fri, 19 May 2023 10:52: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 1q01SY-00042F-PX for qemu-devel@nongnu.org; Fri, 19 May 2023 10:52:04 -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 1q01SS-0003hA-9S for qemu-devel@nongnu.org; Fri, 19 May 2023 10:51:53 -0400 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-160-oz5GEdu2OHStbLX_mSLNcQ-1; Fri, 19 May 2023 10:51:49 -0400 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-4edc7406cbaso2113003e87.2 for ; Fri, 19 May 2023 07:51:49 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id z1-20020ac24181000000b004f11e965308sm634868lfh.20.2023.05.19.07.51.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:51:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507911; h=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=TieozOKcq7wNxJeAelFrvx+KwG5hCz5Or4GbbfSJris=; b=XceUkZAsGIxPQVK2hrY9buknPqoSjcQrAJSQPHx39LnA0Q1HlmS3JqQefsnOLTIxnyWJXN AtcNEw17QQ3Br/MTQTqL7YDCPvu5e1mrfA1ndQi4iclcBbFz8ipeOkzIOhi4PoVDV6tqem tKReYslw4LvOBMwLfUw3xyNXKRoHF5o= X-MC-Unique: oz5GEdu2OHStbLX_mSLNcQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507908; x=1687099908; 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=TieozOKcq7wNxJeAelFrvx+KwG5hCz5Or4GbbfSJris=; b=aYVlS/vRMBSobI1qruPvEzUe3IZNL/iAFS8UgMx7r0SFGDaZaSQOtCAqGVcHHw6q76 of/9zV95oXzIR2v1fQ+hqyJYjCbRvTuIcjJJjZHZiHJ/77+t7f4HrNwjybFV7x61Fwaa lEdIBSKWKI+qjHpnjVklr/ddsfIqEptM2t8ejmLCuEF9qov1Wxv3oMVrCis1wgTyPwHu +bwVPja4R/RSUSV77+X7IjmaUpyuw28USnWqYqnjW1l1cAUlJNqvFhutji071xvdgX9R z50PnrNnWPcBJW92V8ZNaF6GiuCJZHZL4rCnliTL71A34JKVyQmCw1gVzLzsEDRLDwtz b3MA== X-Gm-Message-State: AC+VfDyYWE2FrPZX3T3J6x9UkOwZn1FrssTtHb0/pvKa1yMkn7GpoU2q pLUbDUnN2DeZsduCCX1MtXhmcYLhojd1UAN9Ot7HOSw9Ucea1pN/sy6D0+rBsIgtM7m3iJ0Ex+r WPbwyLz1eIfru+5knZt8QSZLL2lNHS3pGfMIWcE6LvsESUIQ/zkAlswoE3KiUZwXoycG6 X-Received: by 2002:ac2:4c90:0:b0:4f1:95cf:11eb with SMTP id d16-20020ac24c90000000b004f195cf11ebmr863338lfl.6.1684507908137; Fri, 19 May 2023 07:51:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ70d5Hk6XdNaYu5md0QYr42yWC+kmwqzuiO2+yu30oSfJzkZXlDUMeK/ZXCe6pNboEk7FGY6A== X-Received: by 2002:ac2:4c90:0:b0:4f1:95cf:11eb with SMTP id d16-20020ac24c90000000b004f195cf11ebmr863333lfl.6.1684507907880; Fri, 19 May 2023 07:51:47 -0700 (PDT) Date: Fri, 19 May 2023 10:51:43 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Cindy Lu Subject: [PULL 24/40] vhost: expose function vhost_dev_has_iommu() Message-ID: <74b5d2b56c85515f1559ee0dfa8289bbb9832d51.1684507742.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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508245590100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Cindy Lu To support vIOMMU in vdpa, need to exposed the function vhost_dev_has_iommu, vdpa will use this function to check if vIOMMU enable. Signed-off-by: Cindy Lu Message-Id: <20230510054631.2951812-2-lulu@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost.h | 1 + hw/virtio/vhost.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index a52f273347..f7f10c8fb7 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -336,4 +336,5 @@ int vhost_dev_set_inflight(struct vhost_dev *dev, struct vhost_inflight *inflight); int vhost_dev_get_inflight(struct vhost_dev *dev, uint16_t queue_size, struct vhost_inflight *inflight); +bool vhost_dev_has_iommu(struct vhost_dev *dev); #endif diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 746d130c74..23da579ce2 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -107,7 +107,7 @@ static void vhost_dev_sync_region(struct vhost_dev *dev, } } =20 -static bool vhost_dev_has_iommu(struct vhost_dev *dev) +bool vhost_dev_has_iommu(struct vhost_dev *dev) { VirtIODevice *vdev =3D dev->vdev; =20 --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508214; cv=none; d=zohomail.com; s=zohoarc; b=ZvcmTrZc2Jtw7Yx/i6qe63t41AFj49/gq/Vc6Aaw38NF3W/GuflGb0deNf65Om4+jg4TZ3PNslOSlusAa1d/LFw+ine8xSXCxiiFE3FsjaaeJCICGBc5nbAKoApZWR0NsjDI6EV6GlvMaI/UGTgeQ7LcyTHzS05ke/ei4/nSLK4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508214; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PgZez/77CPjISuZkTP4eS35ZBSmaQPk9oC+m6mGfSMg=; b=h281ZEC2O0eBFvXN6VCO83+Bt5Vr9IFe2Kk5DF1aCoHUIdFNDR+DWgNQP+M4e8D8Ge/2J/GgMXH/Jgg7DBn6B+wypzS1JqeoQoafQPG68IuEBXmF7IMTbhGqMn7450gxi9YSmggz2Aoc0Qwa19yNNGiF28LMlpB91V6r4W0MiKY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168450821482870.34196756820927; Fri, 19 May 2023 07:56:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01T9-00056Z-Rj; Fri, 19 May 2023 10:52: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 1q01Sa-00045K-IH for qemu-devel@nongnu.org; Fri, 19 May 2023 10:52:07 -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 1q01SY-0003hS-Im for qemu-devel@nongnu.org; Fri, 19 May 2023 10:51:59 -0400 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-196-Pcf9LbYzOoCmZmKs-c5K4Q-1; Fri, 19 May 2023 10:51:55 -0400 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-4f381431472so2201313e87.3 for ; Fri, 19 May 2023 07:51:55 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id f17-20020a056512093100b004f27cecb68asm625222lft.166.2023.05.19.07.51.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:51:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507916; h=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=PgZez/77CPjISuZkTP4eS35ZBSmaQPk9oC+m6mGfSMg=; b=ZFLQQzKe+uUL/isouhgsGMpHtHcgYb0dyLu8yWQRQ6O/2nFL5PLalB7MvLlOeYBulgAZrH 43ue6kHw4yf3cWgP5fVvUuWydGspDuVyM8rm4YbpPNIRjgXoaWyIEy5t6CA+nH6vqhpF1I fleiHIKCLCJ1Dqxp9YT+rJ+7sCfDLU4= X-MC-Unique: Pcf9LbYzOoCmZmKs-c5K4Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507914; x=1687099914; 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=PgZez/77CPjISuZkTP4eS35ZBSmaQPk9oC+m6mGfSMg=; b=aC0hUqj6zVqJiIQ47U1trIq2gVsiIoMlDg7GF2c7qjgCIuHpHnQEAl/WfGTs73mXXa 3bewrnKWHTbUe6jwHrPyTGLk3beLbbHQqeZkqLLpZcd0KTrh8aCnqer6RUMus+p0BwQx 50arl6OtVV922zBQepim3oRIdxf6OmwYu4s1Idg5fcTJZVSfiOMN9qt1xQnMgqwjzo6f SQqdOc19lxD6p5cvIecZ38fi4n/ZO4cs3Sq33zIXYKJFrvA4a84tv4ItAj79/glOneb4 09h1jk1cACZhuI2IgM4tSMvKxnKDEEQ3Hx7rdVfTQgh+JmfhlMFluoTd5liXCq1U2RtG 1DNw== X-Gm-Message-State: AC+VfDzikxwqF5vJ2Wzpx+3h2XzF+01Kfsqe4+3qF7r8VXPRSklD7nR7 vdxyTuR9VaQeBb/IQxKqUiG0dbeDDRsyGhHW/sL8k+mF4ynqAezoqLvooFdy1UH0L4yPNc0c8w4 6qWYCqE4kiAakOeG62b7wC1pUoNb0uMv47K16PhXclBGBgUReWEP7PaEmqH3F0Er6jVNG X-Received: by 2002:a05:6512:15e:b0:4f0:e2:c709 with SMTP id m30-20020a056512015e00b004f000e2c709mr1012302lfo.17.1684507913807; Fri, 19 May 2023 07:51:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7IgbkPjf95fc+Gveiw6rYCrWOLqg0H9aNHFbpk4MVr/3JkYlhztYUZg+dDLRdghUFlrRFX6Q== X-Received: by 2002:a05:6512:15e:b0:4f0:e2:c709 with SMTP id m30-20020a056512015e00b004f000e2c709mr1012288lfo.17.1684507913415; Fri, 19 May 2023 07:51:53 -0700 (PDT) Date: Fri, 19 May 2023 10:51:48 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Cindy Lu Subject: [PULL 25/40] vhost_vdpa: fix the input in trace_vhost_vdpa_listener_region_del() Message-ID: <3d1e4d34a81a212e234f674e57e73c824d4b131a.1684507742.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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508216248100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Cindy Lu In trace_vhost_vdpa_listener_region_del, the value for llend should change to int128_get64(int128_sub(llend, int128_one())) Signed-off-by: Cindy Lu Message-Id: <20230510054631.2951812-3-lulu@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-vdpa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index bc6bad23d5..92c2413c76 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -288,7 +288,8 @@ static void vhost_vdpa_listener_region_del(MemoryListen= er *listener, iova =3D TARGET_PAGE_ALIGN(section->offset_within_address_space); llend =3D vhost_vdpa_section_end(section); =20 - trace_vhost_vdpa_listener_region_del(v, iova, int128_get64(llend)); + trace_vhost_vdpa_listener_region_del(v, iova, + int128_get64(int128_sub(llend, int128_one()))); =20 if (int128_ge(int128_make64(iova), llend)) { return; --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508265; cv=none; d=zohomail.com; s=zohoarc; b=AICVh1bBrWe83IZ62TQMjMro0XjblNSmEkrHIpWb38drz/MoB4nyvL5UmeeKaYBbqYBQHyomz1e+RDNC779wtH7c/7G941SL5CIcsjrHZITUl6DlUpo4S9RLYI55WmacXyhM7wU5XkBP/j1wIYtSRUAW2Hm9shXltIMouRA/ZDc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508265; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MG9QRbAhHmgPgErXXueTm6QmvHo2RMS9Zz4DxlsczRI=; b=bmjNzkkdss2SFY3x9OtIbmVFgylj/Zz+P41AlLFoBjYmmSTK301BiyN0IaQUGZ6PlivhFiRS/wQWCy4J5qAu1mBadN7QjUdCo5PzOdeLwkqKjeSOyr2bHdHMqEs4CMvqjPYKC0KQA6lXPHaN+/uSWQCknlLkV3SNxp+Og0QoNsg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508265340484.83366663335266; Fri, 19 May 2023 07:57:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01Sn-0004WX-EH; Fri, 19 May 2023 10:52:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q01Sk-0004Hc-Ca for qemu-devel@nongnu.org; Fri, 19 May 2023 10:52: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 1q01Sc-0003iC-34 for qemu-devel@nongnu.org; Fri, 19 May 2023 10:52:09 -0400 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-393-zOL3TX1oM-ilZpTVPhWNCQ-1; Fri, 19 May 2023 10:52:00 -0400 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2af23cfd23aso4547341fa.0 for ; Fri, 19 May 2023 07:51:59 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id x17-20020a19f611000000b004eca2b1c5b4sm622290lfe.229.2023.05.19.07.51.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:51:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507921; h=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=MG9QRbAhHmgPgErXXueTm6QmvHo2RMS9Zz4DxlsczRI=; b=I7Fb5CqLfhuLEXYfYW47Mo7RdTXK01YikMsENUoA3Lyy/3sLPWOQML/dQ7KKyE4Qc6rV+x INw+lT3WkSeedblcNw6Dxe885UeK1+ir1iZMatuTaxm1gdQdYtRny5adUcBxgQcSpvDMdp 4o0RGgAUFRNQVy3APOYADLze3KvyaPo= X-MC-Unique: zOL3TX1oM-ilZpTVPhWNCQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507918; x=1687099918; 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=MG9QRbAhHmgPgErXXueTm6QmvHo2RMS9Zz4DxlsczRI=; b=bQUMatfRyq0/jzl7Gsi2D6BQu0OLQt1ZK/ohKrk4BgYTClHozetdmCxOuU1xEy0i47 MKHimvSRbBkMr3A4cLtbyR+LPkr1wt4Y/Mf2qzx5vR9sJsMTsLMZZSYYok43+lhIahTY c+z9N3dbCKrHrlAKmUwdT6HJtXiQOL6tQHd1HCWfdj/ui19728o8ZWA6RM8RcYnWMLAN 37hzgQh0t2F2CZaUIQ3tSGP3W19019H0V+U4Jtml2evqxgYdk4gq3BeCTsqT/st1L1ou Zt1xl4Qxsl6j1zY+0XnqHLUCxkY0pu6zPaECm4FywDu8o9gOLIv49y1JsfPne4ih7xB5 PXzg== X-Gm-Message-State: AC+VfDzqEY9Hsp8rPHbSdhvHLO+JDS9SmlnhvDNjMXpn4za65kZLK+sC EosUMbJ4UJuGgJjSFUTKUXSDSyyH5S+FCBUAqtUL310+5zQRgl4ibwm84I3707gKIZNBSkgGLd5 EBNIhuX6WkxhCml3iUpnluvVueNfowrmCAhiMKDgw0zqu//1vBwt5bcIgb9Ac2PUaKdi9 X-Received: by 2002:ac2:4949:0:b0:4f3:93ec:ffec with SMTP id o9-20020ac24949000000b004f393ecffecmr849230lfi.63.1684507918301; Fri, 19 May 2023 07:51:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4HVWKWqDquqjB68SkRi0XayeTIIqLw47+ZAGD54wq30UHaC3l1/gyCaVtWhP/X8DrkxMYkYA== X-Received: by 2002:ac2:4949:0:b0:4f3:93ec:ffec with SMTP id o9-20020ac24949000000b004f393ecffecmr849219lfi.63.1684507917942; Fri, 19 May 2023 07:51:57 -0700 (PDT) Date: Fri, 19 May 2023 10:51:53 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Cindy Lu Subject: [PULL 26/40] vhost-vdpa: Add check for full 64-bit in region delete Message-ID: <2fbef6aad892a3e784041fc5a6d5f5bda0565464.1684507742.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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508265725100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Cindy Lu The unmap ioctl doesn't accept a full 64-bit span. So need to add check for the section's size in vhost_vdpa_listener_region_del(). Signed-off-by: Cindy Lu Message-Id: <20230510054631.2951812-4-lulu@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-vdpa.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 92c2413c76..0c8c37e786 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -316,10 +316,28 @@ static void vhost_vdpa_listener_region_del(MemoryList= ener *listener, vhost_iova_tree_remove(v->iova_tree, *result); } vhost_vdpa_iotlb_batch_begin_once(v); + /* + * The unmap ioctl doesn't accept a full 64-bit. need to check it + */ + if (int128_eq(llsize, int128_2_64())) { + llsize =3D int128_rshift(llsize, 1); + ret =3D vhost_vdpa_dma_unmap(v, VHOST_VDPA_GUEST_PA_ASID, iova, + int128_get64(llsize)); + + if (ret) { + error_report("vhost_vdpa_dma_unmap(%p, 0x%" HWADDR_PRIx ", " + "0x%" HWADDR_PRIx ") =3D %d (%m)", + v, iova, int128_get64(llsize), ret); + } + iova +=3D int128_get64(llsize); + } ret =3D vhost_vdpa_dma_unmap(v, VHOST_VDPA_GUEST_PA_ASID, iova, int128_get64(llsize)); + if (ret) { - error_report("vhost_vdpa dma unmap error!"); + error_report("vhost_vdpa_dma_unmap(%p, 0x%" HWADDR_PRIx ", " + "0x%" HWADDR_PRIx ") =3D %d (%m)", + v, iova, int128_get64(llsize), ret); } =20 memory_region_unref(section->mr); --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508087; cv=none; d=zohomail.com; s=zohoarc; b=C4jgBFc78e64uc3O1u2BMuA1E4B2YsSBEZBq23Wtghc797S9SfVZtEwowaq+0MQ9hHT8dIKKFAw/Eu/dS+yeJ5pwopRF9Ze8fltNdIAne3mMdrKwOGb7tvJ+33y4S4SpNymJ5AFcNnb+odUtngv0IKvXwuW//wEehNH5gnooKss= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508087; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8bazluS/HWGCkbOQX31x8muj323D+ZTb5+7E+xu4F88=; b=dSySWXgllar6gV9KaPM+o9dKLOp8PYP81AcRzuGAvzD3DDq05lFL8N2RPUQ0ZkmQDP7Vh11g2qluFtrKgXb7eEktvqgDkT5MSlfDAF6rMZLcAjOHBLyjJDtM4auA57we44Rlkn0+yCMx5CTlLScnoBn3zu5VvbrkUEV2PMOn0rE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508087609363.607356289485; Fri, 19 May 2023 07:54:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01TC-0005LG-VN; Fri, 19 May 2023 10:52: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 1q01Sy-0004vE-UP for qemu-devel@nongnu.org; Fri, 19 May 2023 10:52:30 -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 1q01Sh-0003iT-VO for qemu-devel@nongnu.org; Fri, 19 May 2023 10:52:24 -0400 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-124-9zan63QoNfWkFAFbPWzoCg-1; Fri, 19 May 2023 10:52:04 -0400 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-4f3932e595dso2264000e87.1 for ; Fri, 19 May 2023 07:52:04 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id w25-20020a05651204d900b004f37ae2e718sm634075lfq.3.2023.05.19.07.51.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:52:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507925; h=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=8bazluS/HWGCkbOQX31x8muj323D+ZTb5+7E+xu4F88=; b=ETLkk21GhejurhWmLhdzsFdp+E3f3ySO5TVz58bx5dLs0yLbSpcEhhIpR3FxmF5/YXUsN9 JVBBShYOxr+f8zevPNVE22v34Vz8KGJNWv6xMvu2jw2e1NK4PUPNOg2dI7tDm//DcgykTX f/EEdLdXxTIMoCPfHHqZ+I8gdyCi/g8= X-MC-Unique: 9zan63QoNfWkFAFbPWzoCg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507922; x=1687099922; 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=8bazluS/HWGCkbOQX31x8muj323D+ZTb5+7E+xu4F88=; b=OwyNhGU6gfOheAvA0Hq+76sYsyM03p4ZmUuVn3kLiqLpwKMiA2yKA10adrx0K6aLD+ 2sV7PfY7KAxnefpt30ojESFT/NGrPbdP2K/wt0JEJ/85JZ8Gy8fiqVfY3tL2IsTqCS5P d/++3J53gx5LUWGcY/dLyRoYa37fYTw2+3SGpd59DKwPkPEdoW6ljfi0yY5OWyBh9A4i s/tKHINkwILeNgwNXJz9t33sSi0j025JZdazkTp0BKKQJSwooJFwk3L5/tFKWGBs7pra 57cSZnmC/pK90rlnilN/1HnEnWCtmSz7vA/1WZDFI4zV3TgneDoryc1lbXqXwk7/dfp3 fp2w== X-Gm-Message-State: AC+VfDxm0vmPYMDYdAcKdXXphXKZDAOMed9MQNPibesk5xR20jerlRA8 2qVTckE1IPCPp9PSm66WTpq41PnpGQlug7MEymdcipyGsWWmn9ohSUr+t1BC1DcfPt+GvBj5X/4 M+zvS6AHAakd0vem+qym7ljxF1ECxCPHjqwqbJqQYvyfqkNir+jbuX7Vxd3PGr5/De5uv X-Received: by 2002:ac2:519c:0:b0:4ef:efb5:bfea with SMTP id u28-20020ac2519c000000b004efefb5bfeamr961878lfi.37.1684507922447; Fri, 19 May 2023 07:52:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5UjaVs2fb1/YyD0KUCqFlopXZQZrUjQNDdd+XgpifaFzMHS2W+babVZidWXjBqa+tTLWNCXA== X-Received: by 2002:ac2:519c:0:b0:4ef:efb5:bfea with SMTP id u28-20020ac2519c000000b004efefb5bfeamr961868lfi.37.1684507922109; Fri, 19 May 2023 07:52:02 -0700 (PDT) Date: Fri, 19 May 2023 10:51:58 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Cindy Lu Subject: [PULL 27/40] vhost-vdpa: Add support for vIOMMU. Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508088654100004 From: Cindy Lu 1. The vIOMMU support will make vDPA=C2=A0can work in IOMMU mode. This will fix=C2=A0security issues while using the no-IOMMU mode. To support this feature we need to add new functions for IOMMU MR=C2=A0adds= and deletes. Also since the SVQ does not support vIOMMU yet, add the check for IOMMU in vhost_vdpa_dev_start, if the SVQ and IOMMU enable at the same time the function will return fail. 2. Skip the iova_max check vhost_vdpa_listener_skipped_section(). While MR is IOMMU, move this check to vhost_vdpa_iommu_map_notify() Verified in vp_vdpa and vdpa_sim_net driver Signed-off-by: Cindy Lu Message-Id: <20230510054631.2951812-5-lulu@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost-vdpa.h | 11 +++ hw/virtio/vhost-vdpa.c | 145 +++++++++++++++++++++++++++++++-- 2 files changed, 149 insertions(+), 7 deletions(-) diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h index c278a2a8de..e64bfc7f98 100644 --- a/include/hw/virtio/vhost-vdpa.h +++ b/include/hw/virtio/vhost-vdpa.h @@ -52,6 +52,8 @@ typedef struct vhost_vdpa { struct vhost_dev *dev; Error *migration_blocker; VhostVDPAHostNotifier notifier[VIRTIO_QUEUE_MAX]; + QLIST_HEAD(, vdpa_iommu) iommu_list; + IOMMUNotifier n; } VhostVDPA; =20 int vhost_vdpa_get_iova_range(int fd, struct vhost_vdpa_iova_range *iova_r= ange); @@ -61,4 +63,13 @@ int vhost_vdpa_dma_map(struct vhost_vdpa *v, uint32_t as= id, hwaddr iova, int vhost_vdpa_dma_unmap(struct vhost_vdpa *v, uint32_t asid, hwaddr iova, hwaddr size); =20 +typedef struct vdpa_iommu { + struct vhost_vdpa *dev; + IOMMUMemoryRegion *iommu_mr; + hwaddr iommu_offset; + IOMMUNotifier n; + QLIST_ENTRY(vdpa_iommu) iommu_next; +} VDPAIOMMUState; + + #endif diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 0c8c37e786..b3094e8a8b 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -26,6 +26,7 @@ #include "cpu.h" #include "trace.h" #include "qapi/error.h" +#include "hw/virtio/virtio-access.h" =20 /* * Return one past the end of the end of section. Be careful with uint64_t @@ -60,13 +61,21 @@ static bool vhost_vdpa_listener_skipped_section(MemoryR= egionSection *section, iova_min, section->offset_within_address_space); return true; } + /* + * While using vIOMMU, sometimes the section will be larger than iova_= max, + * but the memory that actually maps is smaller, so move the check to + * function vhost_vdpa_iommu_map_notify(). That function will use the = actual + * size that maps to the kernel + */ =20 - llend =3D vhost_vdpa_section_end(section); - if (int128_gt(llend, int128_make64(iova_max))) { - error_report("RAM section out of device range (max=3D0x%" PRIx64 - ", end addr=3D0x%" PRIx64 ")", - iova_max, int128_get64(llend)); - return true; + if (!memory_region_is_iommu(section->mr)) { + llend =3D vhost_vdpa_section_end(section); + if (int128_gt(llend, int128_make64(iova_max))) { + error_report("RAM section out of device range (max=3D0x%" PRIx= 64 + ", end addr=3D0x%" PRIx64 ")", + iova_max, int128_get64(llend)); + return true; + } } =20 return false; @@ -185,6 +194,115 @@ static void vhost_vdpa_listener_commit(MemoryListener= *listener) v->iotlb_batch_begin_sent =3D false; } =20 +static void vhost_vdpa_iommu_map_notify(IOMMUNotifier *n, IOMMUTLBEntry *i= otlb) +{ + struct vdpa_iommu *iommu =3D container_of(n, struct vdpa_iommu, n); + + hwaddr iova =3D iotlb->iova + iommu->iommu_offset; + struct vhost_vdpa *v =3D iommu->dev; + void *vaddr; + int ret; + Int128 llend; + + if (iotlb->target_as !=3D &address_space_memory) { + error_report("Wrong target AS \"%s\", only system memory is allowe= d", + iotlb->target_as->name ? iotlb->target_as->name : "no= ne"); + return; + } + RCU_READ_LOCK_GUARD(); + /* check if RAM section out of device range */ + llend =3D int128_add(int128_makes64(iotlb->addr_mask), int128_makes64(= iova)); + if (int128_gt(llend, int128_make64(v->iova_range.last))) { + error_report("RAM section out of device range (max=3D0x%" PRIx64 + ", end addr=3D0x%" PRIx64 ")", + v->iova_range.last, int128_get64(llend)); + return; + } + + if ((iotlb->perm & IOMMU_RW) !=3D IOMMU_NONE) { + bool read_only; + + if (!memory_get_xlat_addr(iotlb, &vaddr, NULL, &read_only, NULL)) { + return; + } + ret =3D vhost_vdpa_dma_map(v, VHOST_VDPA_GUEST_PA_ASID, iova, + iotlb->addr_mask + 1, vaddr, read_only); + if (ret) { + error_report("vhost_vdpa_dma_map(%p, 0x%" HWADDR_PRIx ", " + "0x%" HWADDR_PRIx ", %p) =3D %d (%m)", + v, iova, iotlb->addr_mask + 1, vaddr, ret); + } + } else { + ret =3D vhost_vdpa_dma_unmap(v, VHOST_VDPA_GUEST_PA_ASID, iova, + iotlb->addr_mask + 1); + if (ret) { + error_report("vhost_vdpa_dma_unmap(%p, 0x%" HWADDR_PRIx ", " + "0x%" HWADDR_PRIx ") =3D %d (%m)", + v, iova, iotlb->addr_mask + 1, ret); + } + } +} + +static void vhost_vdpa_iommu_region_add(MemoryListener *listener, + MemoryRegionSection *section) +{ + struct vhost_vdpa *v =3D container_of(listener, struct vhost_vdpa, lis= tener); + + struct vdpa_iommu *iommu; + Int128 end; + int iommu_idx; + IOMMUMemoryRegion *iommu_mr; + int ret; + + iommu_mr =3D IOMMU_MEMORY_REGION(section->mr); + + iommu =3D g_malloc0(sizeof(*iommu)); + end =3D int128_add(int128_make64(section->offset_within_region), + section->size); + end =3D int128_sub(end, int128_one()); + iommu_idx =3D memory_region_iommu_attrs_to_index(iommu_mr, + MEMTXATTRS_UNSPECIFIED); + iommu->iommu_mr =3D iommu_mr; + iommu_notifier_init(&iommu->n, vhost_vdpa_iommu_map_notify, + IOMMU_NOTIFIER_IOTLB_EVENTS, + section->offset_within_region, + int128_get64(end), + iommu_idx); + iommu->iommu_offset =3D section->offset_within_address_space - + section->offset_within_region; + iommu->dev =3D v; + + ret =3D memory_region_register_iommu_notifier(section->mr, &iommu->n, = NULL); + if (ret) { + g_free(iommu); + return; + } + + QLIST_INSERT_HEAD(&v->iommu_list, iommu, iommu_next); + memory_region_iommu_replay(iommu->iommu_mr, &iommu->n); + + return; +} + +static void vhost_vdpa_iommu_region_del(MemoryListener *listener, + MemoryRegionSection *section) +{ + struct vhost_vdpa *v =3D container_of(listener, struct vhost_vdpa, lis= tener); + + struct vdpa_iommu *iommu; + + QLIST_FOREACH(iommu, &v->iommu_list, iommu_next) + { + if (MEMORY_REGION(iommu->iommu_mr) =3D=3D section->mr && + iommu->n.start =3D=3D section->offset_within_region) { + memory_region_unregister_iommu_notifier(section->mr, &iommu->n= ); + QLIST_REMOVE(iommu, iommu_next); + g_free(iommu); + break; + } + } +} + static void vhost_vdpa_listener_region_add(MemoryListener *listener, MemoryRegionSection *section) { @@ -199,6 +317,10 @@ static void vhost_vdpa_listener_region_add(MemoryListe= ner *listener, v->iova_range.last)) { return; } + if (memory_region_is_iommu(section->mr)) { + vhost_vdpa_iommu_region_add(listener, section); + return; + } =20 if (unlikely((section->offset_within_address_space & ~TARGET_PAGE_MASK= ) !=3D (section->offset_within_region & ~TARGET_PAGE_MASK))) { @@ -278,6 +400,9 @@ static void vhost_vdpa_listener_region_del(MemoryListen= er *listener, v->iova_range.last)) { return; } + if (memory_region_is_iommu(section->mr)) { + vhost_vdpa_iommu_region_del(listener, section); + } =20 if (unlikely((section->offset_within_address_space & ~TARGET_PAGE_MASK= ) !=3D (section->offset_within_region & ~TARGET_PAGE_MASK))) { @@ -1182,7 +1307,13 @@ static int vhost_vdpa_dev_start(struct vhost_dev *de= v, bool started) } =20 if (started) { - memory_listener_register(&v->listener, &address_space_memory); + if (vhost_dev_has_iommu(dev) && (v->shadow_vqs_enabled)) { + error_report("SVQ can not work while IOMMU enable, please disa= ble" + "IOMMU and try again"); + return -1; + } + memory_listener_register(&v->listener, dev->vdev->dma_as); + return vhost_vdpa_add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK); } =20 --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508131; cv=none; d=zohomail.com; s=zohoarc; b=N16mNpoLGRtkqrEgHz9AtEDtopcHWuZuS1He8pM0qgRlJ/ppHEmJaZE1P2EG/c+gERjiHOQWQVRkdy4u7jiLFGe7VknSItMXTtk8glTEKePcXUoy/OE3h3qw5AD/8FmoFapDaHLV5Sux2f3stTjUtqPzn1pRSuW2y9o+ObBlcSc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508131; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EcQNtufz3Fzfm9arp8K8qhgvENcT9nU1AXjN4pj1S3g=; b=IfulX5d4WO7cz2jYDObWpIyM+YyhKJJTAMithBQJTslQGFBUXv2hKd/joGqUVdM/KdOFHyjhYY2JOZLJ+TS9aG+U3WIpRfeM7uBsWpY2hvWmQWLBWJ7SIpM40ON3QLhY1SYyKSkOHYcpgLKM2jbdO1pl79o8RVUUvMDNglLlLec= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508131364811.6535997873738; Fri, 19 May 2023 07:55:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01TC-0005LF-Ut; Fri, 19 May 2023 10:52: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 1q01Sv-0004sW-OI for qemu-devel@nongnu.org; Fri, 19 May 2023 10:52: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 1q01St-0003jx-TG for qemu-devel@nongnu.org; Fri, 19 May 2023 10:52:21 -0400 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-98-i8h5DMBYOoaTRyUIMyTWvQ-1; Fri, 19 May 2023 10:52:10 -0400 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2ac98a3d564so17926081fa.3 for ; Fri, 19 May 2023 07:52:09 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id e11-20020a2e984b000000b002a9ee18e9c7sm826862ljj.69.2023.05.19.07.52.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:52:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507939; h=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=EcQNtufz3Fzfm9arp8K8qhgvENcT9nU1AXjN4pj1S3g=; b=g6bDKFox7l+vyM3bPD5DsPD9YriBdEOSVds0oTMt/Dc5poqjXUU4GrsAS1p9LameYVSTV7 MkVr2Ig6oJ4tEDgwsgECa/j+dTZYCoLWdG5pHSX9IRUVIEXeI2TaxsJoIuXo41exW8ov7W dnKNLQR4iM+wJHOoicYffecMarchl9U= X-MC-Unique: i8h5DMBYOoaTRyUIMyTWvQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507928; x=1687099928; 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=EcQNtufz3Fzfm9arp8K8qhgvENcT9nU1AXjN4pj1S3g=; b=BdGejDJsfwPQ/5/8zV8YJTCE1bAmLUNvWgg/PVQNIs04Xc6/X145Np5ronM1jb85XC tJLH70ehj90HYUB6HFOEbeykM/bCnuO0lwe2P2/X5eVv6f8VbicAhccrjZMBVlGDe05L j8eTGWx3yTiNQMBx96ffQrKzaw44zBCSV9vaiMVWqZp/goKQwL3CbuC8lvpPPutBTtBJ cwj1ciJ6c14cYuR8gdDr6eVrU+Q9IYwRivM+D9L321jfvMqeSBPLMdAJyhr857/Dm8Mc Q5MsBhRMzd1A8chND5yFi0f1oW8UPSSajVUXPAlf7W04mx6tbMcbcawsfR98+pkQgzzd ZPaQ== X-Gm-Message-State: AC+VfDxH1kkPhb0KN9U+49hpx0LPsk37kayv+x8QkJa8rlfaCwVCNT26 TmhR3yXHN9+lH27PGchmeZ/6VMezj1X1obZh7117zNQWe62VZNfYT5ssokMgZBaWcpnCKlPP+0U HOipuEY6OuKNABymlhN2flQuQeuxELx72wPKlJo7E+/2tAi4i8j5MUlVlSW3e6siju0Dr X-Received: by 2002:a2e:2e0f:0:b0:2ad:95dd:8802 with SMTP id u15-20020a2e2e0f000000b002ad95dd8802mr884319lju.38.1684507927947; Fri, 19 May 2023 07:52:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6cSILmhVP9fLJT9IRvkCEnpslQ18oM/Ojmi2vIUaLqVjoulPeBlh/k+YeZB3D3nad4lAtS5w== X-Received: by 2002:a2e:2e0f:0:b0:2ad:95dd:8802 with SMTP id u15-20020a2e2e0f000000b002ad95dd8802mr884308lju.38.1684507927707; Fri, 19 May 2023 07:52:07 -0700 (PDT) Date: Fri, 19 May 2023 10:52:02 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Thomas Huth , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Marcel Apfelbaum Subject: [PULL 28/40] hw/pci-host/i440fx: Inline sysbus_add_io() Message-ID: <273d65020b04f8a01e4b5cd543aeef1624b17001.1684507742.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508131909100001 From: Bernhard Beschow sysbus_add_io() just wraps memory_region_add_subregion() while also obscuring where the memory is attached. So use memory_region_add_subregion() directly and attach it to the existing memory region s->bus->address_space_io which is set as an alias to get_system_io() by the pc machine. Signed-off-by: Bernhard Beschow Reviewed-by: Thomas Huth Message-Id: <20230213162004.2797-2-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/i440fx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 262f82c303..9c6882d3fc 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -27,6 +27,7 @@ #include "qemu/range.h" #include "hw/i386/pc.h" #include "hw/pci/pci.h" +#include "hw/pci/pci_bus.h" #include "hw/pci/pci_host.h" #include "hw/pci-host/i440fx.h" #include "hw/qdev-properties.h" @@ -217,10 +218,10 @@ static void i440fx_pcihost_realize(DeviceState *dev, = Error **errp) PCIHostState *s =3D PCI_HOST_BRIDGE(dev); SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); =20 - sysbus_add_io(sbd, 0xcf8, &s->conf_mem); + memory_region_add_subregion(s->bus->address_space_io, 0xcf8, &s->conf_= mem); sysbus_init_ioports(sbd, 0xcf8, 4); =20 - sysbus_add_io(sbd, 0xcfc, &s->data_mem); + memory_region_add_subregion(s->bus->address_space_io, 0xcfc, &s->data_= mem); sysbus_init_ioports(sbd, 0xcfc, 4); =20 /* register i440fx 0xcf8 port as coalesced pio */ --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508265; cv=none; d=zohomail.com; s=zohoarc; b=XpcRcPKYSWi+7m7q2HsskDSnrJODEK2tYa1pWR299w7lbd3Hce2CoQ2OGO+ZrvkThnB8j2L1W0AVwZ1Y3NTjS7bP976hy9PDjSiqBTTtDg3I3p2Ma40it/OwWW/a+qy/wDlFpgm/NAjQergN/if7kcu595QildhVELkNsRpBZ6s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508265; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ERgWhut0Ar78W50hUKkDUqbaG/clkmwna7iN062IWeA=; b=Mi2oZ+Jm2flzyyjBbpPE0SxFxv4PbhTcZzs/JvQdz21WWfnuiQHd+AC9qP3vtzr7PP6TmvpccNaf0NnywBXoUZBNboUJKFeQ/SKXjzrsrqgq4esKGN6bViySz5Oi53Hg1ROAT8y1LFaVRxfD6msrgELVTkrZLjsMEbxb9LJbkIU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508265046197.96359410290165; Fri, 19 May 2023 07:57:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01T7-000564-Rf; Fri, 19 May 2023 10:52: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 1q01Sv-0004sV-Nd for qemu-devel@nongnu.org; Fri, 19 May 2023 10:52: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 1q01St-0003jt-DB for qemu-devel@nongnu.org; Fri, 19 May 2023 10:52:21 -0400 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-524-Ffdglf5VObqH2l8J2AfOXQ-1; Fri, 19 May 2023 10:52:16 -0400 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-4f020caac60so2235976e87.0 for ; Fri, 19 May 2023 07:52:15 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id d7-20020ac244c7000000b004f11eb32f20sm633732lfm.13.2023.05.19.07.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:52:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507938; h=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=ERgWhut0Ar78W50hUKkDUqbaG/clkmwna7iN062IWeA=; b=DDqnzCYj/DVW5y4HCiXgRBQU2i/6gkf6MOCb3HkamjXeo4w6+rIdSPba0OhWhtZJjoo4q6 WrnUjpel+CfY2LC4zYxE15ZRbPRxQVA5EVagr17sTOUZp+bAae/wQsiHTkKBNPHo2EUVfA IH0kNqln3Lqxm5v4tVVvxgnNTCPsh38= X-MC-Unique: Ffdglf5VObqH2l8J2AfOXQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507934; x=1687099934; 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=ERgWhut0Ar78W50hUKkDUqbaG/clkmwna7iN062IWeA=; b=AXDnjP992+CB2Xz4GI2P6JmkoiHGw4m7jnH+XUH8zxIVNtoCk19UWiXkuqMZN2d9PS YBToaiY//+CmD0n6TK1tZIV8XV+LkiK72s5lUpPjapYHXw04j4Q0IEBsnoxtsJ/2UDIP /oEhlJBE4yI5eI3xR33v2lAfrYxSccaMkFC30d3/5SEDDlgd+GmCMpcBNOIDXxVlAtec oJ4tNHi83Lr5/rUlOHkzMcNcrz2Sl0AVd+Ser70bfZaWcjoqvOW9uwKWsuywXkJll0/N mv6Hd9ztuKaeCJ/TLYrzQmZ2yTCUm4SID6SXUwdBp4jqsC+xhExlB9tooKrdiH7H/8a0 yeSQ== X-Gm-Message-State: AC+VfDwAW3WE9/44VZCD0B2LJ134fFdJmlQ7e6/SmsD4WLUVb42pfxaQ gc4Hmwv0md5UvXBpr7T8n3zpgQv0RWVcbrD7BYnm0zOR+17GnK8yP08ONxYhSa0CXvkY1J6w1cq WQjCvxo6I3Nf+t4EIvvsVKFpua+eiiCxXu+wTEokuV11043Z5+wiBVg/+N1oPb71hAR52 X-Received: by 2002:ac2:44d6:0:b0:4dd:ce0b:7692 with SMTP id d22-20020ac244d6000000b004ddce0b7692mr814825lfm.46.1684507933936; Fri, 19 May 2023 07:52:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4j1ExbdBB4jyguSGtF/CvuI8waDeTLSOW100aHcOBft3PqT1QlcG5Cf3ZGBs+DUxpJGwcIGg== X-Received: by 2002:ac2:44d6:0:b0:4dd:ce0b:7692 with SMTP id d22-20020ac244d6000000b004ddce0b7692mr814813lfm.46.1684507933550; Fri, 19 May 2023 07:52:13 -0700 (PDT) Date: Fri, 19 May 2023 10:52:08 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Thomas Huth , Marcel Apfelbaum Subject: [PULL 29/40] hw/pci-host/q35: Inline sysbus_add_io() Message-ID: <67b4a74a0743c4cdb78bf884cea2407645530af3.1684507742.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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508266593100007 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Bernhard Beschow sysbus_add_io() just wraps memory_region_add_subregion() while also obscuring where the memory is attached. So use memory_region_add_subregion() directly and attach it to the existing memory region s->mch.address_space_io which is set as an alias to get_system_io() by the q35 machine. Signed-off-by: Bernhard Beschow Reviewed-by: Thomas Huth Message-Id: <20230213162004.2797-3-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci-host/q35.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index 26390863d6..fa05844319 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -50,10 +50,12 @@ static void q35_host_realize(DeviceState *dev, Error **= errp) Q35PCIHost *s =3D Q35_HOST_DEVICE(dev); SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); =20 - sysbus_add_io(sbd, MCH_HOST_BRIDGE_CONFIG_ADDR, &pci->conf_mem); + memory_region_add_subregion(s->mch.address_space_io, + MCH_HOST_BRIDGE_CONFIG_ADDR, &pci->conf_me= m); sysbus_init_ioports(sbd, MCH_HOST_BRIDGE_CONFIG_ADDR, 4); =20 - sysbus_add_io(sbd, MCH_HOST_BRIDGE_CONFIG_DATA, &pci->data_mem); + memory_region_add_subregion(s->mch.address_space_io, + MCH_HOST_BRIDGE_CONFIG_DATA, &pci->data_me= m); sysbus_init_ioports(sbd, MCH_HOST_BRIDGE_CONFIG_DATA, 4); =20 /* register q35 0xcf8 port as coalesced pio */ --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508037; cv=none; d=zohomail.com; s=zohoarc; b=U92a11IOl99Q+98ou6CWSm+masQBG2U803IU1pV7gVRRq5BTC/kEedxLNGjNNuLbBs2C4zRxCKxCp01dbBgcRm/fp6lSrw7FvcUo94Jx33mAM7e34uXBq+yj2h5Jf7Hrv3Xu/vb+UCNel88jGu3m/DTo/hbndOWFanpRLomYlL4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508037; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yL382e7AnC4ayRKjUR+8KuEK+Fg9P80Jv7fuv4Rssck=; b=Wq35GCSAlY4tZv3/Wb4j2MSn18oySj2Cv5DPC++ICzWj/fa6Q50yyQ8TrRRYPV4pX1vhnjGcj+L4tAOMlHDudceLgYOqLnIgWS5qtHv31s3p2hB+14s0zFe5Azd5yLwvARmQ/ipKabFgnMMZBTRLSrmoLNOkdSR2pvu1ItzPTY8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508037456271.15120047782045; Fri, 19 May 2023 07:53:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01TE-0005Wz-5P; Fri, 19 May 2023 10:52: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 1q01T4-00050D-LG for qemu-devel@nongnu.org; Fri, 19 May 2023 10:52: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 1q01Sy-0003kN-On for qemu-devel@nongnu.org; Fri, 19 May 2023 10:52:27 -0400 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-55-a7qvYsYrPxuupZGrrobwOg-1; Fri, 19 May 2023 10:52:23 -0400 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2af237b22aaso4960241fa.0 for ; Fri, 19 May 2023 07:52:20 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id a5-20020a05651c010500b002a8b08882dbsm854659ljb.55.2023.05.19.07.52.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:52:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507944; h=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=yL382e7AnC4ayRKjUR+8KuEK+Fg9P80Jv7fuv4Rssck=; b=QB5q5E/lz30SkBWjiJocsttjzPYNnHcY9jnRz85q/ei1AAKV3GFQSVgXAwwhkofmQBaGAO wjhD4t1MhaMfd1YXBXvTqnJJgFdAG7ApAlcpSCPSR/vquYLsGbNJohJS1NFHgdBG1PHb+b 5D33GL+o+0iQ56grlcozafPQzxun/yA= X-MC-Unique: a7qvYsYrPxuupZGrrobwOg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507939; x=1687099939; 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=yL382e7AnC4ayRKjUR+8KuEK+Fg9P80Jv7fuv4Rssck=; b=lFjYVpslG9eTmVnFQ4NQAwROO+fia7BZvwQCUyFBCodu2krjhPue7i0z94Ob/XINqO NNNSf+FbG0D+olFU/VFV8l74tKVwVsSjWJqcGEv1m2RmfR1UQ0co6YovwCnAiLC/7rdT L1t+YIpeOH20Sqrd7JY4wt0qn+LPVToHC8RqKz1vmau8tw34XaGNLK4RmkTkg35Fvp9r LEtwsQQ2saNJ0xF+BmtnM/ndyyWe+gOpf1dZPCmNjj5GvqKqSB/z7LPOTUmDOKyw1LlP 6OhffLdyFww+5PKY3AZYJGqSwYZbs97UZhm6/b2S6ftnUrSsX3RcfqMUpIjC0PbXUsQf X6lQ== X-Gm-Message-State: AC+VfDy/q3pePwdlhVjzKbBpLiH2HFn/fORt7COEpYl3kV7fKuGRIzGL ZDsVSLt1TPbwyBxjnUZXjoqe6EtzXJ62Rp6sd3xwhfA74tykUEAoj8ypVzsdbfjAnSY50tH2sNH aAwHddS27FuSKopxQsyo5SVhJ+qfrmVXUhk7lUs0EfSG4PPP53FV3YbbQWaOAvs2XmkB6 X-Received: by 2002:a2e:b04d:0:b0:29f:58c6:986e with SMTP id d13-20020a2eb04d000000b0029f58c6986emr811366ljl.52.1684507939384; Fri, 19 May 2023 07:52:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6BBoUNxQ0Plh7QFLNuPkZ7JbhXGtm+85gYLAL6owOdGN6erxB+kkKni03pVPqXuSTOuJkDRw== X-Received: by 2002:a2e:b04d:0:b0:29f:58c6:986e with SMTP id d13-20020a2eb04d000000b0029f58c6986emr811352ljl.52.1684507939135; Fri, 19 May 2023 07:52:19 -0700 (PDT) Date: Fri, 19 May 2023 10:52:13 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Thomas Huth , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 30/40] hw/i386/pc_q35: Reuse machine parameter Message-ID: <1ab7167b09446996a8c967c6fe2eb4dcb9f53c87.1684507742.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508039256100003 From: Bernhard Beschow Signed-off-by: Bernhard Beschow Reviewed-by: Thomas Huth Message-Id: <20230213162004.2797-4-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc_q35.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index f02919d92c..a76c2d4501 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -218,7 +218,7 @@ static void pc_q35_init(MachineState *machine) pc_memory_init(pcms, get_system_memory(), rom_memory, &ram_memory, pci_hole64_size); =20 - object_property_add_child(qdev_get_machine(), "q35", OBJECT(q35_host)); + object_property_add_child(OBJECT(machine), "q35", OBJECT(q35_host)); object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_RAM_MEM, OBJECT(ram_memory), NULL); object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_PCI_MEM, --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508295; cv=none; d=zohomail.com; s=zohoarc; b=L2t/WeYsANcZGrdkNG+p5QDsVHGzQ1U9UG85svP0RE8PhKCh6DcJdLszLp3RmqHsIVMQ0NPdbEo8KecjesoP0eZ/2VzUgDkACME5ll7dkZcS61niElrkGPJcbB1rEx3EEliJ9tsTrRWa92905FctcdCytqjo7fYvW1zK3XNn5fI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508295; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AkZgLO2ULCvim6XkvxIlN6Y1si/CGYQ9Gj9d57Tfixs=; b=aDZxCSUmJQqQ4NdodZMpa7jCHJcM2GGNrTghN0WfHK844DhkaQqaSAkgfl9XnY/pT5Cvjuh5lID2C2HIAdGF7SDYetie570ZzneL15i0RSff3jkO3UJIq/4WfcyJbkfugWPnsKR7b5rduaPynWlw844m+wPYuwy9/jTGKFE7zRQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508295944849.3319188151879; Fri, 19 May 2023 07:58:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01TJ-0005u1-4T; Fri, 19 May 2023 10:52: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 1q01T5-00050H-VA for qemu-devel@nongnu.org; Fri, 19 May 2023 10:52: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 1q01T4-0003lv-DL for qemu-devel@nongnu.org; Fri, 19 May 2023 10:52:31 -0400 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-355-avLj4-sgNDaw9lOok_3CGg-1; Fri, 19 May 2023 10:52:27 -0400 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-4ef455ba989so2144187e87.0 for ; Fri, 19 May 2023 07:52:26 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id f18-20020ac24e52000000b004cc9042c9cfsm626003lfr.158.2023.05.19.07.52.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:52:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507948; h=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=AkZgLO2ULCvim6XkvxIlN6Y1si/CGYQ9Gj9d57Tfixs=; b=AqJ3iK0hm6s0edAsTMJsLC+3LCxDQRv1v0f0OBq4goRnWeU56waehZhkbSq3bHaa18+SKV sJSDgHyt5ovTouE43qUyH0R0A4gitQS/bkxWtZ5Rc3Ljdg8AZQKPXy3ZZNFW4FVu5FUKXH G71W6xwP1szDV7FNgFtUj4bby2oRZOo= X-MC-Unique: avLj4-sgNDaw9lOok_3CGg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507945; x=1687099945; 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=AkZgLO2ULCvim6XkvxIlN6Y1si/CGYQ9Gj9d57Tfixs=; b=aevI5QGvdEgY/0qPi9gojsVQscwjsKEy5nF8Gxk7Sx6c5ZLPBY4em67HiTy5CxNdn4 b0bRKT3+sgdw31ltn61mhqbTt50KIvUSfM8mNU8yE058+cOM2Nx22fRtEZQGBeRzS9lw svXz1t2/2+s74U0EXU+n37fhcGlNnHSnzUavaYrjv7hWQt9kwOtKQa9UONgLsaPq8V5M 8I7YSpUba5ldVgu9H13dtcHY5iNCPVha1t0eB60nJJVaNelbZ93V+jZ7kxlNfuJFiB6A SuxHPUVV7ai7uvocq69C4J2+wjmjp7/WfpxTVQ+lRI++F6Q7RuqiH1KOL8x919onxPsA QdOA== X-Gm-Message-State: AC+VfDy3jMU6oeTTX9IWntukRFJT/1UfyfXFejzdKRckkuae4wg3wo85 q5BZscXp6U/wBYrPg6rcsWSQTfgNPNeqK/qztZTOnPUkSAl7dN9XCKrXS8RrfhPYF6ALqpw5K4V 0gBTZMPOfpIZCGktjPOdeknH5BtbQ+ScK5PD+9J8+A4OWjn9HHL+P/RD0+mWYk8HvPhXD X-Received: by 2002:a05:6512:376b:b0:4ef:f4ef:a1cc with SMTP id z11-20020a056512376b00b004eff4efa1ccmr755977lft.14.1684507945268; Fri, 19 May 2023 07:52:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4A+bXZ8eevLxogYXvyXCwUzwFiHbSmRQtP7gW3vX29PXNxd/QgsLXJkGcFgkSUMtJgBJ0evA== X-Received: by 2002:a05:6512:376b:b0:4ef:f4ef:a1cc with SMTP id z11-20020a056512376b00b004eff4efa1ccmr755960lft.14.1684507944980; Fri, 19 May 2023 07:52:24 -0700 (PDT) Date: Fri, 19 May 2023 10:52:19 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Thomas Huth , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 31/40] hw/i386/pc_{q35,piix}: Reuse MachineClass::desc as SMB product name Message-ID: <1e366da0318bd9fb8cea66914e9682ad6e7d0a94.1684507742.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508296855100004 From: Bernhard Beschow No need to repeat the descriptions. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth Message-Id: <20230213162004.2797-5-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/pc_piix.c | 2 +- hw/i386/pc_q35.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 66a849d279..a9c40201fb 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -198,7 +198,7 @@ static void pc_init1(MachineState *machine, if (pcmc->smbios_defaults) { MachineClass *mc =3D MACHINE_GET_CLASS(machine); /* These values are guest ABI, do not change */ - smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)", + smbios_set_defaults("QEMU", mc->desc, mc->name, pcmc->smbios_legacy_mode, pcmc->smbios_uuid_encoded, pcms->smbios_entry_point_type); diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index a76c2d4501..89e69737d6 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -199,7 +199,7 @@ static void pc_q35_init(MachineState *machine) =20 if (pcmc->smbios_defaults) { /* These values are guest ABI, do not change */ - smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)", + smbios_set_defaults("QEMU", mc->desc, mc->name, pcmc->smbios_legacy_mode, pcmc->smbios_uuid_encoded, pcms->smbios_entry_point_type); --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508171; cv=none; d=zohomail.com; s=zohoarc; b=DzzONeeEO7G3tw7XxttREkaTj3iwd4mskCtttoMrfw9bn8kibqUFXXe/YKvP7yMMLmuUa7dA0Ug6Lx7+dSkhFNZor0Zy+z1XoOG9FMHOATuUtv8tNzQTuedJcsNxumApGalQnFLSdT5aZJWIJ8KLyU+CI/jn4ezzVEcQfLnUoyw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508171; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OedOpR3sWdkPNhnqIT9PzPMy+No4a4OcU7ka6unQxog=; b=ntdaP/UYJ9iD65g6gwoy709gjSI2pu2+jr6aAgVmPlcFzhDIjVvbp3QXWbzIdPJDWOBSgRyMrCVaLotjKL01Lm7AwqkCI2o7jzd/hp7q8PLhywLi4qiFVjenMJXRsXnNLWCWADBCUPrNCq+zOCiYcmpy+4weJYp9wHhBa6TVscs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168450817146935.76463067462794; Fri, 19 May 2023 07:56:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01TL-0006HU-2K; Fri, 19 May 2023 10:52: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 1q01TE-0005fX-Vo for qemu-devel@nongnu.org; Fri, 19 May 2023 10:52:44 -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 1q01T9-0003mH-QI for qemu-devel@nongnu.org; Fri, 19 May 2023 10:52:40 -0400 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-629-5WjbbZ0BNJGWvJjRRw2tlQ-1; Fri, 19 May 2023 10:52:33 -0400 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2af1589c75aso13526861fa.2 for ; Fri, 19 May 2023 07:52:32 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id u29-20020a056512041d00b004f20d0ebe50sm626132lfk.94.2023.05.19.07.52.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:52:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507954; h=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=OedOpR3sWdkPNhnqIT9PzPMy+No4a4OcU7ka6unQxog=; b=hgfge2Jsho/G6kKY92g2k4gQio7tWm8/xq6vF0e1QYBeapz8ismyGNSyPWFlEDG0wbc+vA fVYlwIu15aUXyC3hsh3q7OHlmWHNY4S6owbWFC5EazlHJDbwg0gGxe4RSMw2Oh7PRN33Wk nYley2LOuLTq5A32lZDzYd0TAF3hhEc= X-MC-Unique: 5WjbbZ0BNJGWvJjRRw2tlQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507951; x=1687099951; 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=OedOpR3sWdkPNhnqIT9PzPMy+No4a4OcU7ka6unQxog=; b=iGnSLWgQDbV0gmuu/e3bphDz5mtF4DP5GhYrFgvyGNwqaVly3nF4XzHM+r/RSFopbB mjdC0dblBizMz3sxyKEKvfhFsEjYg3qut42+ByHKteWIwGLXp9ltmDhOzu+eOEjOi+LR oopNzYZ7bycraDyUO3xIFneLP5ZEWL0SG0srmrxQgLYADcCtcrCHCve7ZLqbzHxfIGZf orrOVK5g1zwWHtNdaC7AkWLVAeCTJ2191wufW/3QSwXv831ttUA628ZPwfJJc063lLJL d0qQqCIiEtQEZjNbEgkQBFQwKG5a0DAH3CDY1/kUV6fUZEV1p5I3xfXIrNhZuKADeujf b0tg== X-Gm-Message-State: AC+VfDyPkPdyy8wbeEMw1wHZy5is/hjpBRDfXC6+aoGbll3MD2gsDIBh lQa/o8mhXpMhATr3RPX5gX13VCvsgpI3WnPahh12exkostT7YtcwjSsTsNDoqkPnytlpX7F+VpQ PdrugzpS3Ov265CkdLKPdgfTVnDnEx7Yxhqew+f/QRYfpqopr/F1TgHm3IwaQC0rrhBEI X-Received: by 2002:a19:f002:0:b0:4ed:c17c:16e5 with SMTP id p2-20020a19f002000000b004edc17c16e5mr1086418lfc.17.1684507950897; Fri, 19 May 2023 07:52:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6mK3TAp7J7+TY9GMOb92H8Gq61C1JityalPA9zk/YDkDhrRdms+jLIVknlx1S0padeVCwVtg== X-Received: by 2002:a19:f002:0:b0:4ed:c17c:16e5 with SMTP id p2-20020a19f002000000b004edc17c16e5mr1086405lfc.17.1684507950659; Fri, 19 May 2023 07:52:30 -0700 (PDT) Date: Fri, 19 May 2023 10:52:25 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Thomas Huth , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 32/40] hw/i386/pc_{q35,piix}: Minimize usage of get_system_memory() Message-ID: <8631743c0968d11983a3a04939c580160bb79ac3.1684507742.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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508171727100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Bernhard Beschow Signed-off-by: Bernhard Beschow Reviewed-by: Thomas Huth Message-Id: <20230213162004.2797-6-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/pc_piix.c | 2 +- hw/i386/pc_q35.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index a9c40201fb..ac7b1a9194 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -242,7 +242,7 @@ static void pc_init1(MachineState *machine, isa_bus =3D ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0")); } else { pci_bus =3D NULL; - isa_bus =3D isa_bus_new(NULL, get_system_memory(), system_io, + isa_bus =3D isa_bus_new(NULL, system_memory, system_io, &error_abort); i8257_dma_init(isa_bus, 0); pcms->hpet_enabled =3D false; diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 89e69737d6..1490f87adb 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -126,6 +126,7 @@ static void pc_q35_init(MachineState *machine) DeviceState *lpc_dev; BusState *idebus[MAX_SATA_PORTS]; ISADevice *rtc_state; + MemoryRegion *system_memory =3D get_system_memory(); MemoryRegion *system_io =3D get_system_io(); MemoryRegion *pci_memory; MemoryRegion *rom_memory; @@ -192,7 +193,7 @@ static void pc_q35_init(MachineState *machine) rom_memory =3D pci_memory; } else { pci_memory =3D NULL; - rom_memory =3D get_system_memory(); + rom_memory =3D system_memory; } =20 pc_guest_info_init(pcms); @@ -215,7 +216,7 @@ static void pc_q35_init(MachineState *machine) } =20 /* allocate ram and load rom/bios */ - pc_memory_init(pcms, get_system_memory(), rom_memory, &ram_memory, + pc_memory_init(pcms, system_memory, rom_memory, &ram_memory, pci_hole64_size); =20 object_property_add_child(OBJECT(machine), "q35", OBJECT(q35_host)); @@ -224,7 +225,7 @@ static void pc_q35_init(MachineState *machine) object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_PCI_MEM, OBJECT(pci_memory), NULL); object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_SYSTEM_MEM, - OBJECT(get_system_memory()), NULL); + OBJECT(system_memory), NULL); object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_IO_MEM, OBJECT(system_io), NULL); object_property_set_int(OBJECT(q35_host), PCI_HOST_BELOW_4G_MEM_SIZE, --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508251; cv=none; d=zohomail.com; s=zohoarc; b=f9t9TyMxEy+XKBCpKU9jBrLVOTsjFsE9Q7j8nNgsVYTGfgj4KWqTWcUYMGhaSQIkl6PVTsbCjtbAoo3PjMQjzbMq7k2MDIbuXplloYrm82ewhWBPMNmuSXCPrbThLwAx5B3p+TqhmJpm4hyCtjKOs86oTQHHIix/TlxaVVaLuac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508251; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=N7l9eaKw0wAoGbx++cmrYeMJ6/PfackXU4qxbeWVb6I=; b=CO/4bsljULJTcEsmqyd/bVUlZ9Y624KbWevpKCRqxXrQwY8wCVL0ZbQc24wQj2Pq2GSn1mJx8SUi+Y2bfwWNSFS8zrhdEeBqnaffGBqoJytOGzUcHTStdVS6HP4GpYP5fBanQRPnppWSSgA3a9st2eoheZysWfyDN6O6/D7znG4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508251985614.6780822095753; Fri, 19 May 2023 07:57:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01TL-0006LC-VF; Fri, 19 May 2023 10:52: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 1q01TK-00067m-7t for qemu-devel@nongnu.org; Fri, 19 May 2023 10:52: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 1q01TG-0003n9-4X for qemu-devel@nongnu.org; Fri, 19 May 2023 10:52:45 -0400 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-411-fVxKquxzMlCgTFIlDJO5Cw-1; Fri, 19 May 2023 10:52:39 -0400 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2ad9ee492c7so19332371fa.2 for ; Fri, 19 May 2023 07:52:39 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id f26-20020ac2533a000000b004f3a1033078sm626368lfh.52.2023.05.19.07.52.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:52:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507961; h=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=N7l9eaKw0wAoGbx++cmrYeMJ6/PfackXU4qxbeWVb6I=; b=LXrPrASFyN9xAarH6rCXPhF6Ub3pBPi66IuiHTRDcFUBFmuAvOwkrciCxhdfI+BG4B7HUD CfUsTSLbPQhdsCg8eGqLfa5zRkyAuB1ie5Heq2iiJIPlaiPFLlYADEokcp8yw6Kigzpv/5 VwZ6Mf9/sLjpjn/5o9odmVTINBoy/Ro= X-MC-Unique: fVxKquxzMlCgTFIlDJO5Cw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507958; x=1687099958; 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=N7l9eaKw0wAoGbx++cmrYeMJ6/PfackXU4qxbeWVb6I=; b=VgEAIbHot90IfZlNh6AdjE1JXB/AeU2NjZt9ePCaxvi2RnRz9NEQHozic3egZS1bvv Wexht55HCVQNAf+G3CCmNW9F5bGPPwqDiT4KyS3A/pWZFFbRvSYhpq7/cg6L/6i57M+3 eCz1psnJob1UUB19UP19a9QwOdDfQe6kFfKZIq+xaJ/r45hDtGpXPo9xDBxNzvvWSDtv JBghqUWAJR5U49YrZ28f+2OYeXbHmjllj8IQ5VH8+2kGX/14mO9Y+fm49atbp5x37z7x ipybo3QRhiwv3lb0kho8zi0nQRtw55lni5++YfVcweCJetk00Nj+e3bQTFqNEC9EGsvU I60g== X-Gm-Message-State: AC+VfDz8AKbsWxZGfn9vSRwNQtI2khMm2OZTU0JyW2LMVGoTBRWFmVKO iKe5UXJ3fHfXFITuSrvNLnV3puns3paodj3/HJYvoutC0QncwC2eobP0IUmb52SshpwY7syJvbg fCatLmb4Fegb7FNdIYpI4WaaPpANLUghnUQfWsAcqWMPjBLi+LdydT9lLhrrTTdDLvNsW X-Received: by 2002:a05:6512:49e:b0:4ef:ff42:b13 with SMTP id v30-20020a056512049e00b004efff420b13mr803756lfq.65.1684507957841; Fri, 19 May 2023 07:52:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5BuclpEfxdgyMOez7idGWRvwuJ5C47rw8aB2+3wb/rRNNrmGlevgV0ZqfNyW4anhtgoohEfA== X-Received: by 2002:a05:6512:49e:b0:4ef:ff42:b13 with SMTP id v30-20020a056512049e00b004efff420b13mr803744lfq.65.1684507957543; Fri, 19 May 2023 07:52:37 -0700 (PDT) Date: Fri, 19 May 2023 10:52:30 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 33/40] hw/i386/pc: Initialize ram_memory variable directly Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508253752100003 From: Bernhard Beschow Going through pc_memory_init() seems quite complicated for a simple assignment. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230213162004.2797-7-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/pc.h | 1 - hw/i386/pc.c | 2 -- hw/i386/pc_piix.c | 4 ++-- hw/i386/pc_q35.c | 6 ++---- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 84935fc958..4e638564ca 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -162,7 +162,6 @@ void xen_load_linux(PCMachineState *pcms); void pc_memory_init(PCMachineState *pcms, MemoryRegion *system_memory, MemoryRegion *rom_memory, - MemoryRegion **ram_memory, uint64_t pci_hole64_size); uint64_t pc_pci_hole64_start(void); DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 7802dc21d9..03da571bda 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -952,7 +952,6 @@ static hwaddr pc_max_used_gpa(PCMachineState *pcms, uin= t64_t pci_hole64_size) void pc_memory_init(PCMachineState *pcms, MemoryRegion *system_memory, MemoryRegion *rom_memory, - MemoryRegion **ram_memory, uint64_t pci_hole64_size) { int linux_boot, i; @@ -1010,7 +1009,6 @@ void pc_memory_init(PCMachineState *pcms, * Split single memory region and use aliases to address portions of i= t, * done for backwards compatibility with older qemus. */ - *ram_memory =3D machine->ram; ram_below_4g =3D g_malloc(sizeof(*ram_below_4g)); memory_region_init_alias(ram_below_4g, NULL, "ram-below-4g", machine->= ram, 0, x86ms->below_4g_mem_size); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index ac7b1a9194..1acf02e711 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -144,6 +144,7 @@ static void pc_init1(MachineState *machine, if (xen_enabled()) { xen_hvm_init_pc(pcms, &ram_memory); } else { + ram_memory =3D machine->ram; if (!pcms->max_ram_below_4g) { pcms->max_ram_below_4g =3D 0xe0000000; /* default: 3.5G */ } @@ -206,8 +207,7 @@ static void pc_init1(MachineState *machine, =20 /* allocate ram and load rom/bios */ if (!xen_enabled()) { - pc_memory_init(pcms, system_memory, - rom_memory, &ram_memory, hole64_size); + pc_memory_init(pcms, system_memory, rom_memory, hole64_size); } else { pc_system_flash_cleanup_unused(pcms); if (machine->kernel_filename !=3D NULL) { diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 1490f87adb..c1535af739 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -130,7 +130,6 @@ static void pc_q35_init(MachineState *machine) MemoryRegion *system_io =3D get_system_io(); MemoryRegion *pci_memory; MemoryRegion *rom_memory; - MemoryRegion *ram_memory; GSIState *gsi_state; ISABus *isa_bus; int i; @@ -216,12 +215,11 @@ static void pc_q35_init(MachineState *machine) } =20 /* allocate ram and load rom/bios */ - pc_memory_init(pcms, system_memory, rom_memory, &ram_memory, - pci_hole64_size); + pc_memory_init(pcms, system_memory, rom_memory, pci_hole64_size); =20 object_property_add_child(OBJECT(machine), "q35", OBJECT(q35_host)); object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_RAM_MEM, - OBJECT(ram_memory), NULL); + OBJECT(machine->ram), NULL); object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_PCI_MEM, OBJECT(pci_memory), NULL); object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_SYSTEM_MEM, --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508197; cv=none; d=zohomail.com; s=zohoarc; b=i/9FKnOybI3W/1gTD8RW4TmtVhBLTz1k/f062g3Idvb6urqNIjiAHPjKZQISh97dxobvmBoYbsIy6ld3XFcXH7nBWHeO21mCR9xXOYi/uEigO/GOTBYh0iv1hERw17K/bWQmO7HPQ+k01xnxOT8GE14Uk6sJhzymRtH7PD0RL/o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508197; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=S2d8RLaxvH8FDWwZE15r3Lmb+RwrAhSPgfBez2s1KyE=; b=YVGO7D+x/WXQqPxkAu08X+xXkPebbi0ciAQhJs04Z9m8qdqHABbQXBfisgq35uZx3kqWVm1CYOkEb/A6ssbXoSLBhjvVainjjkDhtKVOvdGGFgRhQNPln7WUW8evWbuR0nAMrqOfL5hs/tuhuyZgsVIt9VcTP2/zJeK+vZrg/5w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16845081971081011.6466766793286; Fri, 19 May 2023 07:56:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01TR-0006RU-Mk; Fri, 19 May 2023 10:52: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 1q01TM-0006No-Qz for qemu-devel@nongnu.org; Fri, 19 May 2023 10:52:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q01TL-0003qR-53 for qemu-devel@nongnu.org; Fri, 19 May 2023 10:52:48 -0400 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-392-YOSOSEJ-Ooe5T5o4WycxEg-1; Fri, 19 May 2023 10:52:45 -0400 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2af1ed9514bso9205351fa.0 for ; Fri, 19 May 2023 07:52:44 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id e22-20020a2e9316000000b002ab3ea4e566sm857061ljh.58.2023.05.19.07.52.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:52:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507966; h=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=S2d8RLaxvH8FDWwZE15r3Lmb+RwrAhSPgfBez2s1KyE=; b=eVhs7UzvGWinpkfOQtHksYYEO/HYobxu8SccY4sX4YAOww2vB0BxT30B7bfB2icMQxOXGu WGP9/yWmR+Pgc0GIcWQLXcKV6Pis+dWO+k73b6pf/OYHdKB/Uyi2GkjaWWnd5S61Ga8cD3 +1fb2Rx4TQUpdsx20OI+wPCozGpo4IY= X-MC-Unique: YOSOSEJ-Ooe5T5o4WycxEg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507962; x=1687099962; 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=S2d8RLaxvH8FDWwZE15r3Lmb+RwrAhSPgfBez2s1KyE=; b=TdlmBQho0Wxc/t67cl4GzGfU+K7Ap7KB7LfDqC6fqPlKpEKMia37Zws5LUfeGL6yUj ZRdN3+cClMQSC8bgIT8JkQKy2WBT7c3ycmixnRGrd7EECuMoHbr1tQXyfY1tD3WPFdkb 7kdhZZY4yXacebfIE4AdtyvjQE71SE/1qA6PxGT64gQkkVHsuq6R+flnPZ72ONrGBxaR IEIkeUDzCX9QnWhyTAzWhSZ9aOCQOE/McKOeIHq8eZIyETJOghOyfj5ojhEcsGIuVD6i TJkbp89iJ+GoEm1iDXhYFFyvZlClURPQ0OQndmNEXBjHzhnMfySXfcF/mfsnNLo83fYA pDLw== X-Gm-Message-State: AC+VfDw6a25Li/NkHfua04EAWQuPuKFs6Xqzrhu0V8IevxdjlFU7h88j 2kLIYPgY4u4MTsCUYnM15GQy4gEJBsZ61HCivqfFyKwDyL1R/3sWw6qqMSR7gayyxoMKYPi2QfU 1i9qkQYc/DTDHcLuRQspf5ugC7zck3G/Zl21bO1oZI7V2uhyu2jbL5YyiNQrbBVZBkzIq X-Received: by 2002:a2e:a172:0:b0:2af:21d3:a4d9 with SMTP id u18-20020a2ea172000000b002af21d3a4d9mr804726ljl.45.1684507962707; Fri, 19 May 2023 07:52:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7vm7yj7NoHM4OakLi0nSQOHORo157Wfgpzdq0eo5GSRteZpZZ8AFgw2O6qqknS4gpaN5Evtw== X-Received: by 2002:a2e:a172:0:b0:2af:21d3:a4d9 with SMTP id u18-20020a2ea172000000b002af21d3a4d9mr804716ljl.45.1684507962393; Fri, 19 May 2023 07:52:42 -0700 (PDT) Date: Fri, 19 May 2023 10:52:37 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Marcel Apfelbaum Subject: [PULL 34/40] hw/pci-host/pam: Make init_pam() usage more readable Message-ID: <9e57b81861e05b2856ed1c4fbc2d991801c7c777.1684507742.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508198813100005 From: Bernhard Beschow Unlike pam_update() which takes the subject -- PAMMemoryRegion -- as first argument, init_pam() takes it as fifth (!) argument. This makes it quite hard to figure out what an init_pam() invocation actually initializes. By moving the subject to the front this should become clearer. While at it, lower the DeviceState parameter to Object, also communicating more clearly that this parameter is just the owner rather than some (heavy?) dependency. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230213162004.2797-8-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/pci-host/pam.h | 5 +++-- hw/pci-host/i440fx.c | 10 +++++----- hw/pci-host/pam.c | 12 ++++++------ hw/pci-host/q35.c | 8 ++++---- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/include/hw/pci-host/pam.h b/include/hw/pci-host/pam.h index c1fd06ba2a..005916f826 100644 --- a/include/hw/pci-host/pam.h +++ b/include/hw/pci-host/pam.h @@ -87,8 +87,9 @@ typedef struct PAMMemoryRegion { unsigned current; } PAMMemoryRegion; =20 -void init_pam(DeviceState *dev, MemoryRegion *ram, MemoryRegion *system, - MemoryRegion *pci, PAMMemoryRegion *mem, uint32_t start, uin= t32_t size); +void init_pam(PAMMemoryRegion *mem, Object *owner, MemoryRegion *ram, + MemoryRegion *system, MemoryRegion *pci, + uint32_t start, uint32_t size); void pam_update(PAMMemoryRegion *mem, int idx, uint8_t val); =20 #endif /* QEMU_PAM_H */ diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 9c6882d3fc..61e7b97ff4 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -292,12 +292,12 @@ PCIBus *i440fx_init(const char *pci_type, object_property_add_const_link(qdev_get_machine(), "smram", OBJECT(&f->smram)); =20 - init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space, - &f->pam_regions[0], PAM_BIOS_BASE, PAM_BIOS_SIZE); + init_pam(&f->pam_regions[0], OBJECT(d), f->ram_memory, f->system_memor= y, + f->pci_address_space, PAM_BIOS_BASE, PAM_BIOS_SIZE); for (i =3D 0; i < ARRAY_SIZE(f->pam_regions) - 1; ++i) { - init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_spac= e, - &f->pam_regions[i+1], PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, - PAM_EXPAN_SIZE); + init_pam(&f->pam_regions[i + 1], OBJECT(d), f->ram_memory, + f->system_memory, f->pci_address_space, + PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, PAM_EXPAN_SIZE); } =20 ram_size =3D ram_size / 8 / 1024 / 1024; diff --git a/hw/pci-host/pam.c b/hw/pci-host/pam.c index 454dd120db..68e9884d27 100644 --- a/hw/pci-host/pam.c +++ b/hw/pci-host/pam.c @@ -30,24 +30,24 @@ #include "qemu/osdep.h" #include "hw/pci-host/pam.h" =20 -void init_pam(DeviceState *dev, MemoryRegion *ram_memory, +void init_pam(PAMMemoryRegion *mem, Object *owner, MemoryRegion *ram_memor= y, MemoryRegion *system_memory, MemoryRegion *pci_address_space, - PAMMemoryRegion *mem, uint32_t start, uint32_t size) + uint32_t start, uint32_t size) { int i; =20 /* RAM */ - memory_region_init_alias(&mem->alias[3], OBJECT(dev), "pam-ram", ram_m= emory, + memory_region_init_alias(&mem->alias[3], owner, "pam-ram", ram_memory, start, size); /* ROM (XXX: not quite correct) */ - memory_region_init_alias(&mem->alias[1], OBJECT(dev), "pam-rom", ram_m= emory, + memory_region_init_alias(&mem->alias[1], owner, "pam-rom", ram_memory, start, size); memory_region_set_readonly(&mem->alias[1], true); =20 /* XXX: should distinguish read/write cases */ - memory_region_init_alias(&mem->alias[0], OBJECT(dev), "pam-pci", pci_a= ddress_space, + memory_region_init_alias(&mem->alias[0], owner, "pam-pci", pci_address= _space, start, size); - memory_region_init_alias(&mem->alias[2], OBJECT(dev), "pam-pci", ram_m= emory, + memory_region_init_alias(&mem->alias[2], owner, "pam-pci", ram_memory, start, size); =20 memory_region_transaction_begin(); diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index fa05844319..fd18920e7f 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -645,12 +645,12 @@ static void mch_realize(PCIDevice *d, Error **errp) object_property_add_const_link(qdev_get_machine(), "smram", OBJECT(&mch->smram)); =20 - init_pam(DEVICE(mch), mch->ram_memory, mch->system_memory, - mch->pci_address_space, &mch->pam_regions[0], + init_pam(&mch->pam_regions[0], OBJECT(mch), mch->ram_memory, + mch->system_memory, mch->pci_address_space, PAM_BIOS_BASE, PAM_BIOS_SIZE); for (i =3D 0; i < ARRAY_SIZE(mch->pam_regions) - 1; ++i) { - init_pam(DEVICE(mch), mch->ram_memory, mch->system_memory, - mch->pci_address_space, &mch->pam_regions[i+1], + init_pam(&mch->pam_regions[i + 1], OBJECT(mch), mch->ram_memory, + mch->system_memory, mch->pci_address_space, PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, PAM_EXPAN_SIZE); } } --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508296; cv=none; d=zohomail.com; s=zohoarc; b=aYkW2a982bsHhskOm4EPJ/pWpyn/HANp2lWe+3RAyvUXEhlKyZMdcP65hmM7482ae8mHwIZiENybncl/1n4L3cL+rUYWb1nrodfYR0TnHlrMoSYKfR9rX4ATKlo0+Ky51PzU02YWo8zGQSHe7qIabYfv8XAQf4Qb08G3H9sWbWQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508296; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Yp/tSHUOqsrSNAJ6KI0EHry6cJp6FlWfqU2oOq6BEB4=; b=h5nyt0QrR4oEDwwkpaUiwPGPk5DvF8CtSNWv/jxcQbLgAg67Z8oDvjjz+5PG82wR9mFrtp6Dh4XZ9j6YXzlpofZctQ79C/97MWkIeU+JlhEwz2b275VfYQDCg/SxutJQOQJSgVsuVHv08O8WH19U3hvkf126Bm+Fx5ZVo7xEv2c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168450829615413.968442405636779; Fri, 19 May 2023 07:58:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01Tl-000724-H5; Fri, 19 May 2023 10:53:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q01Tf-0006rx-S1 for qemu-devel@nongnu.org; Fri, 19 May 2023 10:53:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q01Tc-0003t1-DJ for qemu-devel@nongnu.org; Fri, 19 May 2023 10:53:07 -0400 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-187-iyBweUZSMBCPToCXCRdcvA-1; Fri, 19 May 2023 10:52:54 -0400 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-4f39ae34494so1701277e87.2 for ; Fri, 19 May 2023 07:52:52 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id p4-20020a19f004000000b004f39868bef1sm616602lfc.209.2023.05.19.07.52.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:52:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507982; h=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=Yp/tSHUOqsrSNAJ6KI0EHry6cJp6FlWfqU2oOq6BEB4=; b=SEurRrvXPKROGRP84fPm9IGIVXXXLn03VmEogmhBVELahxw8DdRfmGhNMytXDPurS6zuyx V8yR9P2QCYynQZCrbPvbbgWL/N68NQZlh7j/Rp15Dmu07TEmDgsd1GttkWtYntZL+JcVI0 shyRbvrN9Kvaz/Y8GFyhkiagZ4pPNCA= X-MC-Unique: iyBweUZSMBCPToCXCRdcvA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507968; x=1687099968; 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=Yp/tSHUOqsrSNAJ6KI0EHry6cJp6FlWfqU2oOq6BEB4=; b=eK/7aml+1N1vyTsh53mKGKytOUq0JWVtaQzo6Zl8g+f/8UQxf+Shk6opv+wI4bXWQy lasEQS8oOF48iOPaJT12/9hxZ4QXlgCKVGlh4ol0jJRoEI0p4Ze+Zp1favCtNczqx0Pw 42IVc6s3KrYhF1ft76e95EGKfQ7ZJIFZAwoAs0RhIbnYG0TqNZ9TZcMoqvnvE/X62P6/ udiPjwtU9sqh5FrNEwdYumYr5apIeoQcTUQyT8jAu8FTYCDBBnWIDRfRG2V71oO2Ck+/ d4Vpwcsluih8UB9L0KtTNfkRCX1F2ucWDFfP3PkHYBPe4uCzW8kqOndo/U5FVZGlAK5f 0fwg== X-Gm-Message-State: AC+VfDyZ7nywx6xny12hGRGwTpdea+JOZbDDKqfw1UF4prb29BFe3ig8 XrySUeScQia2PWtZOHVJvlOA5dX4ymXDDB0vZ+nMU4LUwgbYk7cw6wPHpFgXjuiGPB2k1IGJ+o8 DaDRW9QlJ9D+ZPZPU4hGAyMv7YDyVLR61vX3dD4/ZxH6b5hQMVhKUrXatPLhKBN+yT9eD X-Received: by 2002:a05:6512:92c:b0:4f1:4fa4:4f56 with SMTP id f12-20020a056512092c00b004f14fa44f56mr757237lft.17.1684507967978; Fri, 19 May 2023 07:52:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ76BGAvkBCfB6fTrCdsxWWVg21gnok83BQl+H84cA5GH5PkjOkxDbZYwg4nWqQOl/UXS+0bpQ== X-Received: by 2002:a05:6512:92c:b0:4f1:4fa4:4f56 with SMTP id f12-20020a056512092c00b004f14fa44f56mr757231lft.17.1684507967638; Fri, 19 May 2023 07:52:47 -0700 (PDT) Date: Fri, 19 May 2023 10:52:42 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Viktor Prutyanov Subject: [PULL 35/40] virtio-pci: add handling of PCI ATS and Device-TLB enable/disable Message-ID: <206e91d143301414df2deb48a411e402414ba6db.1684507742.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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508297988100009 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Viktor Prutyanov According to PCIe Address Translation Services specification 5.1.3., ATS Control Register has Enable bit to enable/disable ATS. Guest may enable/disable PCI ATS and, accordingly, Device-TLB for the VirtIO PCI device. So, raise/lower a flag and call a trigger function to pass this event to a device implementation. Signed-off-by: Viktor Prutyanov Message-Id: <20230512135122.70403-2-viktor@daynix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/virtio.h | 2 ++ hw/virtio/virtio-pci.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index f6b38f7e9c..af86ed7249 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -155,6 +155,7 @@ struct VirtIODevice QLIST_HEAD(, VirtQueue) *vector_queues; QTAILQ_ENTRY(VirtIODevice) next; EventNotifier config_notifier; + bool device_iotlb_enabled; }; =20 struct VirtioDeviceClass { @@ -212,6 +213,7 @@ struct VirtioDeviceClass { const VMStateDescription *vmsd; bool (*primary_unplug_pending)(void *opaque); struct vhost_dev *(*get_vhost)(VirtIODevice *vdev); + void (*toggle_device_iotlb)(VirtIODevice *vdev); }; =20 void virtio_instance_init_common(Object *proxy_obj, void *data, diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 02fb84a8fa..edbc0daa18 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -716,6 +716,38 @@ virtio_address_space_read(VirtIOPCIProxy *proxy, hwadd= r addr, } } =20 +static void virtio_pci_ats_ctrl_trigger(PCIDevice *pci_dev, bool enable) +{ + VirtIOPCIProxy *proxy =3D VIRTIO_PCI(pci_dev); + VirtIODevice *vdev =3D virtio_bus_get_device(&proxy->bus); + VirtioDeviceClass *k =3D VIRTIO_DEVICE_GET_CLASS(vdev); + + vdev->device_iotlb_enabled =3D enable; + + if (k->toggle_device_iotlb) { + k->toggle_device_iotlb(vdev); + } +} + +static void pcie_ats_config_write(PCIDevice *dev, uint32_t address, + uint32_t val, int len) +{ + uint32_t off; + uint16_t ats_cap =3D dev->exp.ats_cap; + + if (!ats_cap || address < ats_cap) { + return; + } + off =3D address - ats_cap; + if (off >=3D PCI_EXT_CAP_ATS_SIZEOF) { + return; + } + + if (range_covers_byte(off, len, PCI_ATS_CTRL + 1)) { + virtio_pci_ats_ctrl_trigger(dev, !!(val & PCI_ATS_CTRL_ENABLE)); + } +} + static void virtio_write_config(PCIDevice *pci_dev, uint32_t address, uint32_t val, int len) { @@ -729,6 +761,10 @@ static void virtio_write_config(PCIDevice *pci_dev, ui= nt32_t address, pcie_cap_flr_write_config(pci_dev, address, val, len); } =20 + if (proxy->flags & VIRTIO_PCI_FLAG_ATS) { + pcie_ats_config_write(pci_dev, address, val, len); + } + if (range_covers_byte(address, len, PCI_COMMAND)) { if (!(pci_dev->config[PCI_COMMAND] & PCI_COMMAND_MASTER)) { virtio_set_disabled(vdev, true); --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508089; cv=none; d=zohomail.com; s=zohoarc; b=I77wbqVFwNagkZYOR0izGdb7yUydZk0TjSdKh5OQs4HQX098NzsVZjiI7iL0flfePwXjNDvDyr/kL9o+oPdgT5tg/619ykVqLU+WbYfrgP1l61RXoUDvYX0KezwKCWMPyM/SOtf6WdtK/Td3LAw4Mc1dAjo7yFHORFeTm4defgs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508089; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jxcwPV6SSLXLk1OvKnmW9oDhQMoLFlaPkAVdYBMH5QI=; b=WKvpSqZQpWIGjLPwW2/gVjMiqRGsxx4PZzZ+YFaa4vU7dVSsvYggIcsHdUCb+sfHYVmt+i56cpyXYbue2XTvSeUbu7PAn9zk+V3N3jG/JVESjbSjxk9RuU3zFtKW1IBFX8b6deyVSCVnQ2HBTepooSwnhEnkiNVbQBAr2NFNS20= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168450808938766.60530403504947; Fri, 19 May 2023 07:54:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01Th-0006s7-Lw; Fri, 19 May 2023 10:53: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 1q01TZ-0006lQ-Gd for qemu-devel@nongnu.org; Fri, 19 May 2023 10:53: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 1q01TV-0003sh-4u for qemu-devel@nongnu.org; Fri, 19 May 2023 10:53:00 -0400 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-269-dpFdiKNtOqicgQa2bp-e-g-1; Fri, 19 May 2023 10:52:55 -0400 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2af1fd4d30bso6238101fa.0 for ; Fri, 19 May 2023 07:52:55 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id l25-20020a2e8699000000b002a9f1b23604sm858101lji.93.2023.05.19.07.52.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:52:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507976; h=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=jxcwPV6SSLXLk1OvKnmW9oDhQMoLFlaPkAVdYBMH5QI=; b=KupWILlPyJfkUgQ2Q6a8W/hyVC8R6zwF3UOKLJNasQ3zh0pVHi6g3AwlISROY0YPGggxTx JogycKOQweL1cjKaQFZvClPVXBUJMGqZGNTOgxPrJoqaQX2vB9/wfb/UuRyaNWgThRT6r4 YDMEVM4c/Qx4g3hZGHzipGC60fCQqLs= X-MC-Unique: dpFdiKNtOqicgQa2bp-e-g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507973; x=1687099973; 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=jxcwPV6SSLXLk1OvKnmW9oDhQMoLFlaPkAVdYBMH5QI=; b=R8XafMoGTPNuQTaZqu6ke4f8rolWag88FF5Dp2t9i28uIjdk9gF6bAE1tiQsMeUnJe fPooL9iSO3pwlmrj6QjJiSW7Wz7Jif/8A/kA57GCnS20PaVN4xZkfG3fuxQDjsuCRMMr EFeRnzJ9PyMAv4cd+YPoNVYBRfB15OXo/wRctIOdn1NhPMDPmUh0BNxtuDzs23Y3jW1+ kQfd9tFfETZRI+BhWy2aOtbfbhxSz8j7AFqZteWzcotmAXhSG+4Lo6n54zyQBtir8Jlg C7xHN5hbCtRbI1z7qOOmyNwfxvWKHgdUZj2z+m5gW1TkLnoIh9+qE/4sjqpdbjy8GDsk K1+w== X-Gm-Message-State: AC+VfDz/Z1Q3QRkv7zv0O5J3SDoXSRFPijBLGh3le+7HRDZ0SL51UUNp +TOSAX0SVaqcSaWbDgpp9sfxN21SDRr8kdQiKRlow/CQQu831B6h8S22ReUXGRySAV00u9DWfTI jgHDXQ0Zs+LLc67wfUgBYgEb00/z1amYUBnzyxGfK72RPN5KpgHCqa2/4O+1CqZlYFg3j X-Received: by 2002:a2e:9b08:0:b0:2a9:fa39:235e with SMTP id u8-20020a2e9b08000000b002a9fa39235emr696627lji.26.1684507973463; Fri, 19 May 2023 07:52:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6KY2S36KGGI76DxiPhy3v16ZCcEto17PLnoSYX5HVqrnrSWbvj2ktMb19Gszk4uswVr9ZHjQ== X-Received: by 2002:a2e:9b08:0:b0:2a9:fa39:235e with SMTP id u8-20020a2e9b08000000b002a9fa39235emr696617lji.26.1684507973107; Fri, 19 May 2023 07:52:53 -0700 (PDT) Date: Fri, 19 May 2023 10:52:47 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Sebastian Ott , Paolo Bonzini , Marcel Apfelbaum Subject: [PULL 36/40] hw/pci-bridge: make building pcie-to-pci bridge configurable Message-ID: <6a36a4ced803838cbba5f90b1b765d8ef6255115.1684507742.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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508090642100007 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Sebastian Ott Introduce a CONFIG option to build the pcie-to-pci bridge. No functional change since it's enabled per default for PCIE_PORT=3Dy. Signed-off-by: Sebastian Ott Message-Id: <72b6599d-6b27-00b5-aac5-2ebc16a2e023@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci-bridge/Kconfig | 5 +++++ hw/pci-bridge/meson.build | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/pci-bridge/Kconfig b/hw/pci-bridge/Kconfig index 02614f49aa..67077366cc 100644 --- a/hw/pci-bridge/Kconfig +++ b/hw/pci-bridge/Kconfig @@ -3,6 +3,11 @@ config PCIE_PORT default y if PCI_DEVICES depends on PCI_EXPRESS && MSI_NONBROKEN =20 +config PCIE_PCI_BRIDGE + bool + default y if PCIE_PORT + depends on PCIE_PORT + config PXB bool default y if Q35 || ARM_VIRT diff --git a/hw/pci-bridge/meson.build b/hw/pci-bridge/meson.build index fe92d43de6..0edc6c7cbf 100644 --- a/hw/pci-bridge/meson.build +++ b/hw/pci-bridge/meson.build @@ -2,7 +2,8 @@ pci_ss =3D ss.source_set() pci_ss.add(files('pci_bridge_dev.c')) pci_ss.add(when: 'CONFIG_I82801B11', if_true: files('i82801b11.c')) pci_ss.add(when: 'CONFIG_IOH3420', if_true: files('ioh3420.c')) -pci_ss.add(when: 'CONFIG_PCIE_PORT', if_true: files('pcie_root_port.c', 'g= en_pcie_root_port.c', 'pcie_pci_bridge.c')) +pci_ss.add(when: 'CONFIG_PCIE_PORT', if_true: files('pcie_root_port.c', 'g= en_pcie_root_port.c')) +pci_ss.add(when: 'CONFIG_PCIE_PCI_BRIDGE', if_true: files('pcie_pci_bridge= .c')) pci_ss.add(when: 'CONFIG_PXB', if_true: files('pci_expander_bridge.c'), if_false: files('pci_expander_bridge_stubs.= c')) pci_ss.add(when: 'CONFIG_XIO3130', if_true: files('xio3130_upstream.c', 'x= io3130_downstream.c')) --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508309; cv=none; d=zohomail.com; s=zohoarc; b=HHk2/f3Vecsj4OZ0h5XG4xY/7+csaUxZ7x0QbabsyMtHjGnM5Xm5Hr0lDI6c65Gx1n2wXk/Pz+zBalMLhLs8RnSrXKBNnmUOuVsOHf013K3nzEU4yDqWyT/qf7CipXNoY61IfLXcOqSu4o272PTIsrlOxchUGRKP4dhVbBQOvDk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508309; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6iHPJFfV/9vWifWqb0iM28PQLKjUavjqG0T5tG7KkDY=; b=CBMCvbPxLhwDS8O8Wuv/Jy4bkYnZ1SsDjmrF3GKgeubC9018Pr9+uxbnZKWidw3XTzEN6/b48clemhTn1r+yOdY2keSjM8IDGqfS3WvZkuVuvTN2LqQ7dKAY4Fb+mDO5P/HPRdom+uOsmJKSx/EwK6jQPqj9TgNnswk5geghjhc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508309390622.0232304004967; Fri, 19 May 2023 07:58:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01Tl-00072S-Mw; Fri, 19 May 2023 10:53:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q01Tf-0006ru-P2 for qemu-devel@nongnu.org; Fri, 19 May 2023 10:53:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q01Tc-0003t5-Cj for qemu-devel@nongnu.org; Fri, 19 May 2023 10:53:07 -0400 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-581-NrQFOboOPWK1tEuPbCcjLg-1; Fri, 19 May 2023 10:53:00 -0400 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-4ef455ba61cso2271874e87.0 for ; Fri, 19 May 2023 07:53:00 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id d5-20020ac244c5000000b004d5a5d90d83sm626319lfm.60.2023.05.19.07.52.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:52:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507983; h=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=6iHPJFfV/9vWifWqb0iM28PQLKjUavjqG0T5tG7KkDY=; b=U4I5keXEoQYTmmBdeYadoe/NY4DT3xXa72Kk1Oqbsz5UaqfTSV1P5Gt2YKWKfyRLF7leP6 bPAXDuMTINrhxmqXrlGNZb8zkDd69ADMs0bqXgIHMolOCUil2LgczHSzLenHYQ7sY17r7Z S9+cZDOyzXihjWvnLlabKMPtxb9dvYE= X-MC-Unique: NrQFOboOPWK1tEuPbCcjLg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507979; x=1687099979; 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=6iHPJFfV/9vWifWqb0iM28PQLKjUavjqG0T5tG7KkDY=; b=cD5YyvH04wX9IC5q03i64MOb5I0+JPGenSEw4IcfM8e4Tkb0ehujMBN0Dh+EZUf7TL qjBmuedPSpv2y3D8F6iNy4YtLy1rbzKzMN4UeNoRhoiCwKEolno/+D47HwLZ0d67QDoc uk/ueCOGkLSejMIykTR5PoGI/Gk1vFoDX8FOK1zGLgiuH3GamG3arz7Y164bfpDFzCHT Ss/wwb8h2YwBa9BjgcEYwBK6TJWm/2y8f/Lt9tJBFezKE5Q+eep6k2oEnv00g9d83X9c HlhsgLpL98p4DYln50LW8KYfTLjRzHTDJJp3JhfZa1P8ganhqZnSKesYD71ur/PIcHCo C72g== X-Gm-Message-State: AC+VfDyOmO2BwS7JCn6+xeOXd4Ivlj1eNHNtlLW7t0kLhVHXIdr6eMCN klLK80SMB0+73/n0VcczvjsUBaoEjpcIBXpAoVnpTWSc99/i9NolsQPgtaaHgdk94RAsBOuf57c siwj2AAbjsAHwKb9PIZRuuTQxiaO+UO8Be2iMUVzkmIsCJV6EwmtkkJKkIieWbyWO1siP X-Received: by 2002:ac2:4556:0:b0:4f1:5015:43c4 with SMTP id j22-20020ac24556000000b004f1501543c4mr978931lfm.38.1684507979066; Fri, 19 May 2023 07:52:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4SC6vwFKscVqaQGy9EbZqcVFaBBikaNwXTMe8eAbS8p4H/D7/mGMittX8t/pzJb6GvADXeDQ== X-Received: by 2002:ac2:4556:0:b0:4f1:5015:43c4 with SMTP id j22-20020ac24556000000b004f1501543c4mr978921lfm.38.1684507978767; Fri, 19 May 2023 07:52:58 -0700 (PDT) Date: Fri, 19 May 2023 10:52:53 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Ira Weiny , Fan Ni , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Subject: [PULL 37/40] hw/cxl: rename mailbox return code type from ret_code to CXLRetCode Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508310001100001 From: Jonathan Cameron Given the increasing usage of this mailbox return code type, now is a good time to switch to QEMU style naming. Reviewed-by: Ira Weiny Reviewed-by: Fan Ni Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Jonathan Cameron Message-Id: <20230423162013.4535-2-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/cxl/cxl-mailbox-utils.c | 64 +++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index ed663cc04a..7b2aef0d67 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -23,7 +23,7 @@ * FOO =3D 0x7f, * #define BAR 0 * 2. Implement the handler - * static ret_code cmd_foo_bar(struct cxl_cmd *cmd, + * static CXLRetCode cmd_foo_bar(struct cxl_cmd *cmd, * CXLDeviceState *cxl_dstate, uint16_t *= len) * 3. Add the command to the cxl_cmd_set[][] * [FOO][BAR] =3D { "FOO_BAR", cmd_foo_bar, x, y }, @@ -90,10 +90,10 @@ typedef enum { CXL_MBOX_UNSUPPORTED_MAILBOX =3D 0x15, CXL_MBOX_INVALID_PAYLOAD_LENGTH =3D 0x16, CXL_MBOX_MAX =3D 0x17 -} ret_code; +} CXLRetCode; =20 struct cxl_cmd; -typedef ret_code (*opcode_handler)(struct cxl_cmd *cmd, +typedef CXLRetCode (*opcode_handler)(struct cxl_cmd *cmd, CXLDeviceState *cxl_dstate, uint16_t *l= en); struct cxl_cmd { const char *name; @@ -105,16 +105,16 @@ struct cxl_cmd { =20 #define DEFINE_MAILBOX_HANDLER_ZEROED(name, size) \ uint16_t __zero##name =3D size; = \ - static ret_code cmd_##name(struct cxl_cmd *cmd, \ - CXLDeviceState *cxl_dstate, uint16_t *len) \ + static CXLRetCode cmd_##name(struct cxl_cmd *cmd, = \ + CXLDeviceState *cxl_dstate, uint16_t *len= ) \ { \ *len =3D __zero##name; = \ memset(cmd->payload, 0, *len); \ return CXL_MBOX_SUCCESS; \ } #define DEFINE_MAILBOX_HANDLER_NOP(name) \ - static ret_code cmd_##name(struct cxl_cmd *cmd, \ - CXLDeviceState *cxl_dstate, uint16_t *len) \ + static CXLRetCode cmd_##name(struct cxl_cmd *cmd, = \ + CXLDeviceState *cxl_dstate, uint16_t *len= ) \ { \ return CXL_MBOX_SUCCESS; \ } @@ -125,9 +125,9 @@ DEFINE_MAILBOX_HANDLER_ZEROED(events_get_interrupt_poli= cy, 4); DEFINE_MAILBOX_HANDLER_NOP(events_set_interrupt_policy); =20 /* 8.2.9.2.1 */ -static ret_code cmd_firmware_update_get_info(struct cxl_cmd *cmd, - CXLDeviceState *cxl_dstate, - uint16_t *len) +static CXLRetCode cmd_firmware_update_get_info(struct cxl_cmd *cmd, + CXLDeviceState *cxl_dstate, + uint16_t *len) { struct { uint8_t slots_supported; @@ -159,9 +159,9 @@ static ret_code cmd_firmware_update_get_info(struct cxl= _cmd *cmd, } =20 /* 8.2.9.3.1 */ -static ret_code cmd_timestamp_get(struct cxl_cmd *cmd, - CXLDeviceState *cxl_dstate, - uint16_t *len) +static CXLRetCode cmd_timestamp_get(struct cxl_cmd *cmd, + CXLDeviceState *cxl_dstate, + uint16_t *len) { uint64_t time, delta; uint64_t final_time =3D 0; @@ -181,7 +181,7 @@ static ret_code cmd_timestamp_get(struct cxl_cmd *cmd, } =20 /* 8.2.9.3.2 */ -static ret_code cmd_timestamp_set(struct cxl_cmd *cmd, +static CXLRetCode cmd_timestamp_set(struct cxl_cmd *cmd, CXLDeviceState *cxl_dstate, uint16_t *len) { @@ -201,9 +201,9 @@ static const QemuUUID cel_uuid =3D { }; =20 /* 8.2.9.4.1 */ -static ret_code cmd_logs_get_supported(struct cxl_cmd *cmd, - CXLDeviceState *cxl_dstate, - uint16_t *len) +static CXLRetCode cmd_logs_get_supported(struct cxl_cmd *cmd, + CXLDeviceState *cxl_dstate, + uint16_t *len) { struct { uint16_t entries; @@ -224,9 +224,9 @@ static ret_code cmd_logs_get_supported(struct cxl_cmd *= cmd, } =20 /* 8.2.9.4.2 */ -static ret_code cmd_logs_get_log(struct cxl_cmd *cmd, - CXLDeviceState *cxl_dstate, - uint16_t *len) +static CXLRetCode cmd_logs_get_log(struct cxl_cmd *cmd, + CXLDeviceState *cxl_dstate, + uint16_t *len) { struct { QemuUUID uuid; @@ -265,9 +265,9 @@ static ret_code cmd_logs_get_log(struct cxl_cmd *cmd, } =20 /* 8.2.9.5.1.1 */ -static ret_code cmd_identify_memory_device(struct cxl_cmd *cmd, - CXLDeviceState *cxl_dstate, - uint16_t *len) +static CXLRetCode cmd_identify_memory_device(struct cxl_cmd *cmd, + CXLDeviceState *cxl_dstate, + uint16_t *len) { struct { char fw_revision[0x10]; @@ -309,9 +309,9 @@ static ret_code cmd_identify_memory_device(struct cxl_c= md *cmd, return CXL_MBOX_SUCCESS; } =20 -static ret_code cmd_ccls_get_partition_info(struct cxl_cmd *cmd, - CXLDeviceState *cxl_dstate, - uint16_t *len) +static CXLRetCode cmd_ccls_get_partition_info(struct cxl_cmd *cmd, + CXLDeviceState *cxl_dstate, + uint16_t *len) { struct { uint64_t active_vmem; @@ -339,9 +339,9 @@ static ret_code cmd_ccls_get_partition_info(struct cxl_= cmd *cmd, return CXL_MBOX_SUCCESS; } =20 -static ret_code cmd_ccls_get_lsa(struct cxl_cmd *cmd, - CXLDeviceState *cxl_dstate, - uint16_t *len) +static CXLRetCode cmd_ccls_get_lsa(struct cxl_cmd *cmd, + CXLDeviceState *cxl_dstate, + uint16_t *len) { struct { uint32_t offset; @@ -364,9 +364,9 @@ static ret_code cmd_ccls_get_lsa(struct cxl_cmd *cmd, return CXL_MBOX_SUCCESS; } =20 -static ret_code cmd_ccls_set_lsa(struct cxl_cmd *cmd, - CXLDeviceState *cxl_dstate, - uint16_t *len) +static CXLRetCode cmd_ccls_set_lsa(struct cxl_cmd *cmd, + CXLDeviceState *cxl_dstate, + uint16_t *len) { struct set_lsa_pl { uint32_t offset; --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508195; cv=none; d=zohomail.com; s=zohoarc; b=ku23OwyiHKX/wkGKDqoDcbvGUBrkTbsS03qm8yYUkYAtVnqEbf11IGa1S/P7k65BG8lgoRO2otISRwJdr6CPwt4TM4jGLbbs48BHAt6bj5/+pUve9QnNwDn6yStcJdYX36skwdp4Mcyv+pPHae6gmHgWeQqaFHOwq2bep3BazuY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508195; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RNlRLeBH0sdjVgB3c/rYKTW280v9Im/ZQre+6tEqB58=; b=VfhYJEynGO3ANcEQ+LK01TwiffEXOSz7YTN/m5jz/BxNT19rSJ11oYd4hRWB4bPLdK/pcJ7DNPRkRkbe7D/ABGAmTRri24MoK5PnMkhvzfosCcFZ9Jew1GlfySqP52/0uIcOHjtXVzf7wXCmuZ8bYZo4diVXdJeZWXYiaE5/BbQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508195036194.22673801317558; Fri, 19 May 2023 07:56:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01Tn-00075x-Eo; Fri, 19 May 2023 10:53: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 1q01Tj-0006uL-Sb for qemu-devel@nongnu.org; Fri, 19 May 2023 10:53:11 -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 1q01Tf-0003tT-Pp for qemu-devel@nongnu.org; Fri, 19 May 2023 10:53:09 -0400 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-471-EczBs_2kOzKYyvkWhlKaVg-1; Fri, 19 May 2023 10:53:06 -0400 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-4f251247084so2217543e87.3 for ; Fri, 19 May 2023 07:53:05 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id q11-20020ac25a0b000000b004f3b0cf4925sm181248lfn.142.2023.05.19.07.53.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:53:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507987; h=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=RNlRLeBH0sdjVgB3c/rYKTW280v9Im/ZQre+6tEqB58=; b=VX77f6oRITFABemHU16KE5DkQk1twvWwyikf9JdsEsaVz/OMrTuxlmtJkD9Cj5ZHetTIh9 6TqPzDaftRkuxLDYTYrYeZfTYIfqH9MWLl859Ofut2HKN/t8VEGHLzEDVf8Buy1Jx9BlAB R1cEpwCMQGwUDscHDO5pXbIa+pouzjs= X-MC-Unique: EczBs_2kOzKYyvkWhlKaVg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507984; x=1687099984; 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=RNlRLeBH0sdjVgB3c/rYKTW280v9Im/ZQre+6tEqB58=; b=KxglCQaBcxMhp1wYKbBEsl42maR030pkE0ta4UNQ5+GRkwLRjIEOw01H8q1EiEdqkK oYBWzcmEeupgbQEevM453lk8u6BYwdEdmeo1gygxZRHPbBL4I1fbyhuy7TvM9AoxP4xA zesJ2NSgKLsECPILwHmE1D7iICkV5/b0tPUsLCAhzxLM67fZUL/0jfhsHAVLuRWajB6q Wb+0zZ1rOCAL1e5X88JIG90Oqd3dbJRyuDg7HxXpDosN+LjtemUcrcnGhH6vCluOaLNI KClo65oILvaTqnPodGRU30p8PIGA7FmsQV3EJOgHoUF8lCwOvINf8cgOlGWlv3mlbNDr BmFQ== X-Gm-Message-State: AC+VfDznkU+wgZgtax4kdhcQWSFK3iiS8Ell5CHhffj27vtMxSGusWlv mepVoY5TzuFENYImNkq6x5h/0fPPIkvAvm1SgWBFick5K8LuxQSF3+jfL4RsSGRL7C8N74k4J33 MvQbgex882gZly9U+soO0ATHkRKCwOjBPdER3aHwMv5ND7/K9muOYoo0aGadddA69u9LM X-Received: by 2002:ac2:5503:0:b0:4ec:8816:f4fc with SMTP id j3-20020ac25503000000b004ec8816f4fcmr870740lfk.6.1684507984052; Fri, 19 May 2023 07:53:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4RKWZNi97LwlIa55UseygQIS9nIJ+Ri1wNFQcNQ5qyG6ZbMb5+hcmKTKUPURdOcj3ZcIvPPQ== X-Received: by 2002:ac2:5503:0:b0:4ec:8816:f4fc with SMTP id j3-20020ac25503000000b004ec8816f4fcmr870731lfk.6.1684507983771; Fri, 19 May 2023 07:53:03 -0700 (PDT) Date: Fri, 19 May 2023 10:52:59 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Ira Weiny , Fan Ni , Jonathan Cameron Subject: [PULL 38/40] hw/cxl: Introduce cxl_device_get_timestamp() utility function Message-ID: <547a652fd1e10c2b6a2b9b91084e4c1cea8665a2.1684507742.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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508196813100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ira Weiny There are new users of this functionality coming shortly so factor it out from the GET_TIMESTAMP mailbox command handling. Signed-off-by: Ira Weiny Reviewed-by: Fan Ni Signed-off-by: Jonathan Cameron Message-Id: <20230423162013.4535-3-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/cxl/cxl_device.h | 2 ++ hw/cxl/cxl-device-utils.c | 15 +++++++++++++++ hw/cxl/cxl-mailbox-utils.c | 11 +---------- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h index edb9791bab..02befda0f6 100644 --- a/include/hw/cxl/cxl_device.h +++ b/include/hw/cxl/cxl_device.h @@ -287,4 +287,6 @@ MemTxResult cxl_type3_read(PCIDevice *d, hwaddr host_ad= dr, uint64_t *data, MemTxResult cxl_type3_write(PCIDevice *d, hwaddr host_addr, uint64_t data, unsigned size, MemTxAttrs attrs); =20 +uint64_t cxl_device_get_timestamp(CXLDeviceState *cxlds); + #endif diff --git a/hw/cxl/cxl-device-utils.c b/hw/cxl/cxl-device-utils.c index 4c5e88aaf5..86e1cea8ce 100644 --- a/hw/cxl/cxl-device-utils.c +++ b/hw/cxl/cxl-device-utils.c @@ -269,3 +269,18 @@ void cxl_device_register_init_common(CXLDeviceState *c= xl_dstate) =20 cxl_initialize_mailbox(cxl_dstate); } + +uint64_t cxl_device_get_timestamp(CXLDeviceState *cxl_dstate) +{ + uint64_t time, delta; + uint64_t final_time =3D 0; + + if (cxl_dstate->timestamp.set) { + /* Find the delta from the last time the host set the time. */ + time =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); + delta =3D time - cxl_dstate->timestamp.last_set; + final_time =3D cxl_dstate->timestamp.host_set + delta; + } + + return final_time; +} diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index 7b2aef0d67..702e16ca20 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -163,17 +163,8 @@ static CXLRetCode cmd_timestamp_get(struct cxl_cmd *cm= d, CXLDeviceState *cxl_dstate, uint16_t *len) { - uint64_t time, delta; - uint64_t final_time =3D 0; + uint64_t final_time =3D cxl_device_get_timestamp(cxl_dstate); =20 - if (cxl_dstate->timestamp.set) { - /* First find the delta from the last time the host set the time. = */ - time =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); - delta =3D time - cxl_dstate->timestamp.last_set; - final_time =3D cxl_dstate->timestamp.host_set + delta; - } - - /* Then adjust the actual time */ stq_le_p(cmd->payload, final_time); *len =3D 8; =20 --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508299; cv=none; d=zohomail.com; s=zohoarc; b=gGKtXTp2gw8r+kxG/Q7aMdvKU986HvRr3PN/OTouHS5F53qURxBvEpxYfWbQr4wiJg0JGpssf6MwIXGaeGWr6yu9gNpNx+sp/swu6osKa2lqGPzFrcPgqvi1m0pcbL4ZLsXWUXwhl15VM/yg40FDQTC9Fam1DXWGhoTWRtwximc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508299; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SIwPOy9IFrAU9M9SkijDEWY4vpGWfJ1D2bxOZki4CAo=; b=VfdO2MF5ihtxNOWe529HRlLkAfJY9ijRKMoiD/dunIua1DqCURKd1yI82/JpoS2eOiehn6IGYmuiN44PlYR6Riwh3HGIDzF4aMsji2/DL8X6heKkfZVg+yhJmmw1ZHj0UNyumn5zSwMaqGqFA+OZUcHp5rK0rwWf+whgjfrqILQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684508299611242.08579548146918; Fri, 19 May 2023 07:58:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01Tr-0007F6-BH; Fri, 19 May 2023 10:53:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q01To-00076b-Qo for qemu-devel@nongnu.org; Fri, 19 May 2023 10:53: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 1q01Tn-0003uE-00 for qemu-devel@nongnu.org; Fri, 19 May 2023 10:53:16 -0400 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-639-yz5wwexvMBOdM4JJLncCuA-1; Fri, 19 May 2023 10:53:13 -0400 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-4edb90ccaadso2124483e87.3 for ; Fri, 19 May 2023 07:53:12 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id m11-20020ac24acb000000b004edb2cb3500sm616448lfp.279.2023.05.19.07.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:53:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684507994; h=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=SIwPOy9IFrAU9M9SkijDEWY4vpGWfJ1D2bxOZki4CAo=; b=M+fVnhLRpXpYYeRT4oKONuig0qkRq+Obfn4/VdgSqjpqrHkK/PqfD8YO9Gpr5fkQiPj2ZX ntqt6JQnvFxgpON+/Po4Be9pYW3hkoRVnBsOlLtmf3Gl3l9fK7AJbgVcpg2jlffMhNYp8i pZRqNHQBDlAlT4yrkxTisoICFu8R2dA= X-MC-Unique: yz5wwexvMBOdM4JJLncCuA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507991; x=1687099991; 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=SIwPOy9IFrAU9M9SkijDEWY4vpGWfJ1D2bxOZki4CAo=; b=hEJui+GsFTa0JtM0daZlYAlst5P20+5E4sJDkv6dPAZWUf8UYRjRI1JcxSPEvT6gQ+ oP7cSesb0IoxxcRPe5wyueQBu8QoD9Ggi1owqE2NVmBHbBI+7XA/2GFffo5oAYDiRPG6 cq7GYL+4SLSa8wZXU6KdN1L/3/Coi0Ge2DVXQd5+tyA3l2u5CHFvT1y9Fpg5NTqWjEt8 ebRgEa1KMrbMFu62MIFPNLOWFMJJY3gkGkl9Ohw2kt9yA79GPDn6z8wItC4l2fSlqn8Z PrPL5Zvlr/ffL6M/OUaulX37i+2vlQ0jp/mokayWkIzSCYcQiju6+1q5wTKr0Negg/5e ZPKA== X-Gm-Message-State: AC+VfDwVXtAsJQP8q+i1TegRkfn7avcFvXXndi/LWZcCFYWwPINR3Jq3 ghQw6RBcR9sRnaVxh7WK9R6boZlZ5h9oJp50b5fW0pA/5JjPV073S8PIcl3A9nQcilE7a+shPl7 cFOE3WnnFxpTgWZnHjTD0UegilbYsWAVjuIyKWWdwMUmvRrW7KysbHCkSatULUhfBzKBe X-Received: by 2002:ac2:5509:0:b0:4f2:5e4b:3e3f with SMTP id j9-20020ac25509000000b004f25e4b3e3fmr867029lfk.61.1684507991291; Fri, 19 May 2023 07:53:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ44vVdzAZp217TDY4Z85O38dNUIhebdgdo58YHdkQmMSXLhKgQmx8dldM9Kny6g/MzACnALfQ== X-Received: by 2002:ac2:5509:0:b0:4f2:5e4b:3e3f with SMTP id j9-20020ac25509000000b004f25e4b3e3fmr867010lfk.61.1684507990924; Fri, 19 May 2023 07:53:10 -0700 (PDT) Date: Fri, 19 May 2023 10:53:04 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Thomas Huth , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?B?SGVydsOp?= Poussineau , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Aurelien Jarno Subject: [PULL 39/40] hw/i386/pc: Create RTC controllers in south bridges 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508300111100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Bernhard Beschow Just like in the real hardware (and in PIIX4), create the RTC controllers in the south bridges. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin Reviewed-by: Thomas Huth Message-Id: <20230519084734.220480-2-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/southbridge/ich9.h | 2 ++ include/hw/southbridge/piix.h | 3 +++ hw/i386/pc.c | 12 +++++++++++- hw/i386/pc_piix.c | 8 ++++++++ hw/i386/pc_q35.c | 2 ++ hw/isa/lpc_ich9.c | 8 ++++++++ hw/isa/piix3.c | 15 +++++++++++++++ hw/isa/Kconfig | 2 ++ 8 files changed, 51 insertions(+), 1 deletion(-) diff --git a/include/hw/southbridge/ich9.h b/include/hw/southbridge/ich9.h index 7004eecbf9..fd01649d04 100644 --- a/include/hw/southbridge/ich9.h +++ b/include/hw/southbridge/ich9.h @@ -6,6 +6,7 @@ #include "hw/intc/ioapic.h" #include "hw/pci/pci.h" #include "hw/pci/pci_device.h" +#include "hw/rtc/mc146818rtc.h" #include "exec/memory.h" #include "qemu/notify.h" #include "qom/object.h" @@ -30,6 +31,7 @@ struct ICH9LPCState { */ uint8_t irr[PCI_SLOT_MAX][PCI_NUM_PINS]; =20 + MC146818RtcState rtc; APMState apm; ICH9LPCPMRegs pm; uint32_t sci_level; /* track sci level */ diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index 0bf48e936d..a840340308 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -13,6 +13,7 @@ #define HW_SOUTHBRIDGE_PIIX_H =20 #include "hw/pci/pci_device.h" +#include "hw/rtc/mc146818rtc.h" =20 /* PIRQRC[A:D]: PIRQx Route Control Registers */ #define PIIX_PIRQCA 0x60 @@ -51,6 +52,8 @@ struct PIIXState { /* This member isn't used. Just for save/load compatibility */ int32_t pci_irq_levels_vmstate[PIIX_NUM_PIRQS]; =20 + MC146818RtcState rtc; + /* Reset Control Register contents */ uint8_t rcr; =20 diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 03da571bda..4a73786e20 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1318,7 +1318,17 @@ void pc_basic_device_init(struct PCMachineState *pcm= s, pit_alt_irq =3D qdev_get_gpio_in(hpet, HPET_LEGACY_PIT_INT); rtc_irq =3D qdev_get_gpio_in(hpet, HPET_LEGACY_RTC_INT); } - *rtc_state =3D ISA_DEVICE(mc146818_rtc_init(isa_bus, 2000, rtc_irq)); + + if (rtc_irq) { + qdev_connect_gpio_out(DEVICE(*rtc_state), 0, rtc_irq); + } else { + uint32_t irq =3D object_property_get_uint(OBJECT(*rtc_state), + "irq", + &error_fatal); + isa_connect_gpio_out(*rtc_state, 0, irq); + } + object_property_add_alias(OBJECT(pcms), "rtc-time", OBJECT(*rtc_state), + "date"); =20 #ifdef CONFIG_XEN_EMU if (xen_mode =3D=3D XEN_EMULATE) { diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 1acf02e711..34e81b79d0 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -32,6 +32,7 @@ #include "hw/i386/pc.h" #include "hw/i386/apic.h" #include "hw/pci-host/i440fx.h" +#include "hw/rtc/mc146818rtc.h" #include "hw/southbridge/piix.h" #include "hw/display/ramfb.h" #include "hw/firmware/smbios.h" @@ -240,10 +241,17 @@ static void pc_init1(MachineState *machine, piix3->pic =3D x86ms->gsi; piix3_devfn =3D piix3->dev.devfn; isa_bus =3D ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0")); + rtc_state =3D ISA_DEVICE(object_resolve_path_component(OBJECT(pci_= dev), + "rtc")); } else { pci_bus =3D NULL; isa_bus =3D isa_bus_new(NULL, system_memory, system_io, &error_abort); + + rtc_state =3D isa_new(TYPE_MC146818_RTC); + qdev_prop_set_int32(DEVICE(rtc_state), "base_year", 2000); + isa_realize_and_unref(rtc_state, isa_bus, &error_fatal); + i8257_dma_init(isa_bus, 0); pcms->hpet_enabled =3D false; } diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index c1535af739..8faeb6ce05 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -241,6 +241,8 @@ static void pc_q35_init(MachineState *machine) x86_machine_is_smm_enabled(x86ms)); pci_realize_and_unref(lpc, host_bus, &error_fatal); =20 + rtc_state =3D ISA_DEVICE(object_resolve_path_component(OBJECT(lpc), "r= tc")); + object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP, TYPE_HOTPLUG_HANDLER, (Object **)&x86ms->acpi_dev, diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index 9714b0001e..9c47a2f6c7 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -658,6 +658,8 @@ static void ich9_lpc_initfn(Object *obj) static const uint8_t acpi_enable_cmd =3D ICH9_APM_ACPI_ENABLE; static const uint8_t acpi_disable_cmd =3D ICH9_APM_ACPI_DISABLE; =20 + object_initialize_child(obj, "rtc", &lpc->rtc, TYPE_MC146818_RTC); + object_property_add_uint8_ptr(obj, ACPI_PM_PROP_SCI_INT, &lpc->sci_gsi, OBJ_PROP_FLAG_READ); object_property_add_uint8_ptr(OBJECT(lpc), ACPI_PM_PROP_ACPI_ENABLE_CM= D, @@ -723,6 +725,12 @@ static void ich9_lpc_realize(PCIDevice *d, Error **err= p) =20 i8257_dma_init(isa_bus, 0); =20 + /* RTC */ + qdev_prop_set_int32(DEVICE(&lpc->rtc), "base_year", 2000); + if (!qdev_realize(DEVICE(&lpc->rtc), BUS(isa_bus), errp)) { + return; + } + pci_bus_irqs(pci_bus, ich9_lpc_set_irq, d, ICH9_LPC_NB_PIRQS); pci_bus_map_irqs(pci_bus, ich9_lpc_map_irq); pci_bus_set_route_irq_fn(pci_bus, ich9_route_intx_pin_to_irq); diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index a9cb39bf21..f9103ea45a 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -28,6 +28,7 @@ #include "hw/dma/i8257.h" #include "hw/southbridge/piix.h" #include "hw/irq.h" +#include "hw/qdev-properties.h" #include "hw/isa/isa.h" #include "hw/xen/xen.h" #include "sysemu/runstate.h" @@ -301,6 +302,12 @@ static void pci_piix3_realize(PCIDevice *dev, Error **= errp) PIIX_RCR_IOPORT, &d->rcr_mem, 1); =20 i8257_dma_init(isa_bus, 0); + + /* RTC */ + qdev_prop_set_int32(DEVICE(&d->rtc), "base_year", 2000); + if (!qdev_realize(DEVICE(&d->rtc), BUS(isa_bus), errp)) { + return; + } } =20 static void build_pci_isa_aml(AcpiDevAmlIf *adev, Aml *scope) @@ -324,6 +331,13 @@ static void build_pci_isa_aml(AcpiDevAmlIf *adev, Aml = *scope) qbus_build_aml(bus, scope); } =20 +static void pci_piix3_init(Object *obj) +{ + PIIX3State *d =3D PIIX3_PCI_DEVICE(obj); + + object_initialize_child(obj, "rtc", &d->rtc, TYPE_MC146818_RTC); +} + static void pci_piix3_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -350,6 +364,7 @@ static const TypeInfo piix3_pci_type_info =3D { .name =3D TYPE_PIIX3_PCI_DEVICE, .parent =3D TYPE_PCI_DEVICE, .instance_size =3D sizeof(PIIX3State), + .instance_init =3D pci_piix3_init, .abstract =3D true, .class_init =3D pci_piix3_class_init, .interfaces =3D (InterfaceInfo[]) { diff --git a/hw/isa/Kconfig b/hw/isa/Kconfig index 0156a66889..c10cbc5fc1 100644 --- a/hw/isa/Kconfig +++ b/hw/isa/Kconfig @@ -35,6 +35,7 @@ config PIIX3 bool select I8257 select ISA_BUS + select MC146818RTC =20 config PIIX4 bool @@ -79,3 +80,4 @@ config LPC_ICH9 select I8257 select ISA_BUS select ACPI_ICH9 + select MC146818RTC --=20 MST From nobody Sun May 19 13:14:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684508018; cv=none; d=zohomail.com; s=zohoarc; b=D4N3E7lav+UHbcbI5U80xwM6rPtHFXExUa2onLBbWvXwVlymPODd4r79/d2wcV7vztlpYpxIy+1FujN3alrW1QknK9zZab70U+OgAAQWEf8E6DB7mTAcDqWSl7cHzx7sUP1tshjQtESXKVBdIOl8CcPz+2CNH8259cwkSJYCRR4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684508018; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1tmyLUCgie0guMo2DyzPBcQwQPzOLQHwY6RFHxL/fUs=; b=We6v6Qj/vS6Oz0OIl6dUef4fOhxISLM/i36onuVd9bkJ1B1TomnzUeggqB9mc3C76BMP1cZXaZYnQMG2d3iZhE2hdO3xHhbFcSA5PN5cAcszgatoqPUvarwaBm8CxAVtWy0sXe/izZzQZLxSmvvILMmcahblqzv/qp1vn1w2Hyo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168450801875613.181631931164134; Fri, 19 May 2023 07:53:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q01Tw-0007iJ-3U; Fri, 19 May 2023 10:53: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 1q01Tu-0007dt-VD for qemu-devel@nongnu.org; Fri, 19 May 2023 10:53: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 1q01Tt-0003vP-8Q for qemu-devel@nongnu.org; Fri, 19 May 2023 10:53:22 -0400 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-613-ywOHwfm5Na2A1ubnt5yRyA-1; Fri, 19 May 2023 10:53:19 -0400 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-4f225b6dc0dso2288832e87.2 for ; Fri, 19 May 2023 07:53:19 -0700 (PDT) Received: from redhat.com ([176.12.184.180]) by smtp.gmail.com with ESMTPSA id b20-20020ac247f4000000b004efff420b0asm623388lfp.108.2023.05.19.07.53.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 07:53:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684508000; h=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=1tmyLUCgie0guMo2DyzPBcQwQPzOLQHwY6RFHxL/fUs=; b=hsAhfu3t2JT/LZScNKpegadTd9HxH29tfo4UGmiqwQPkt8FY5w5Je3ELonLElsvDuMTCXQ tr4GWTpvI/HnmSm9bJRhh65f+61ihA0xe3aEAUbcdwa9v7upvtfyfYBL7fyY+KUQ86gGkn pY1uEC0uPdb0OhezmblS86URE0HHy4M= X-MC-Unique: ywOHwfm5Na2A1ubnt5yRyA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684507997; x=1687099997; 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=1tmyLUCgie0guMo2DyzPBcQwQPzOLQHwY6RFHxL/fUs=; b=Dod4tJsfeElqgaoTSahjXFZX3B+4HYeUz6k7q278EcAL66jieLxcI9hMYZXAAeZZ7o JroX3gzrna3L5XZFn5MfQxUps2MtEZgWvcRE+OgJWzZbLVNBbCho5pNKi5ZPhXGBm/Aq adscItkRNS2RjenBo0pxU0oqwPEVCUzz7+IjHjIuWCJmx0odpYIGm2DAHrzHXyBi4QDV uOqnnJ1aSCb1A8u07n0LzXdCBqP/ORRlbEs4SStTVrKtRvkVE/9QIL7agfJcModqIFaD yV8qT5wY8zl9M7o7UOSV/dSBiY/wr+qxeeoIWevugY5/GqUXDBIhCtMEO4f5ztBBebmB CHoA== X-Gm-Message-State: AC+VfDyS83P5ZsX+4UbDyLgsw8B6HWC6Mnoyl532tlo4TBw0oL1N3cIl UxihCIgepCwQlFPdCgmc2A3YMF1SjSwfln5U0y+ERL1FhqfNw9awSL9Js7D2X8zuvmWYhlHZepS NKLhAXcdjIwLbuffSJ0JoU4US+eCYUmDc/Kgs8fevFPoxw9wIS94X1O5uKW8aCrwHlAKP X-Received: by 2002:ac2:5225:0:b0:4f2:455d:18bd with SMTP id i5-20020ac25225000000b004f2455d18bdmr857052lfl.16.1684507997548; Fri, 19 May 2023 07:53:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5JToqUeyw+GCIgpbJzHS3bQZ0F7ms86q2zGO5EbYfPAdje4GLsSQoS3aZtDH68nRIHuS/hgw== X-Received: by 2002:ac2:5225:0:b0:4f2:455d:18bd with SMTP id i5-20020ac25225000000b004f2455d18bdmr857038lfl.16.1684507997170; Fri, 19 May 2023 07:53:17 -0700 (PDT) Date: Fri, 19 May 2023 10:53:11 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Bernhard Beschow , Thomas Huth , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 40/40] hw/i386/pc: No need for rtc_state to be an out-parameter Message-ID: <87af48a49c0a5663b3fff58c3407393772d3c448.1684507742.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684508020198100003 From: Bernhard Beschow Now that the RTC is created as part of the southbridges it doesn't need to be an out-parameter any longer. Signed-off-by: Bernhard Beschow Reviewed-by: Peter Maydell Reviewed-by: Michael S. Tsirkin Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230519084734.220480-3-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/pc.h | 2 +- hw/i386/pc.c | 12 ++++++------ hw/i386/pc_piix.c | 2 +- hw/i386/pc_q35.c | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 4e638564ca..79e755879d 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -167,7 +167,7 @@ uint64_t pc_pci_hole64_start(void); DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus); void pc_basic_device_init(struct PCMachineState *pcms, ISABus *isa_bus, qemu_irq *gsi, - ISADevice **rtc_state, + ISADevice *rtc_state, bool create_fdctrl, uint32_t hpet_irqs); void pc_cmos_init(PCMachineState *pcms, diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 4a73786e20..b3d826a83a 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1265,7 +1265,7 @@ static void pc_superio_init(ISABus *isa_bus, bool cre= ate_fdctrl, =20 void pc_basic_device_init(struct PCMachineState *pcms, ISABus *isa_bus, qemu_irq *gsi, - ISADevice **rtc_state, + ISADevice *rtc_state, bool create_fdctrl, uint32_t hpet_irqs) { @@ -1320,14 +1320,14 @@ void pc_basic_device_init(struct PCMachineState *pc= ms, } =20 if (rtc_irq) { - qdev_connect_gpio_out(DEVICE(*rtc_state), 0, rtc_irq); + qdev_connect_gpio_out(DEVICE(rtc_state), 0, rtc_irq); } else { - uint32_t irq =3D object_property_get_uint(OBJECT(*rtc_state), + uint32_t irq =3D object_property_get_uint(OBJECT(rtc_state), "irq", &error_fatal); - isa_connect_gpio_out(*rtc_state, 0, irq); + isa_connect_gpio_out(rtc_state, 0, irq); } - object_property_add_alias(OBJECT(pcms), "rtc-time", OBJECT(*rtc_state), + object_property_add_alias(OBJECT(pcms), "rtc-time", OBJECT(rtc_state), "date"); =20 #ifdef CONFIG_XEN_EMU @@ -1341,7 +1341,7 @@ void pc_basic_device_init(struct PCMachineState *pcms, } #endif =20 - qemu_register_boot_set(pc_boot_set, *rtc_state); + qemu_register_boot_set(pc_boot_set, rtc_state); =20 if (!xen_enabled() && (x86ms->pit =3D=3D ON_OFF_AUTO_AUTO || x86ms->pit =3D=3D ON_OFF_AU= TO_ON)) { diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 34e81b79d0..10070ea9a5 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -277,7 +277,7 @@ static void pc_init1(MachineState *machine, } =20 /* init basic PC hardware */ - pc_basic_device_init(pcms, isa_bus, x86ms->gsi, &rtc_state, true, + pc_basic_device_init(pcms, isa_bus, x86ms->gsi, rtc_state, true, 0x4); =20 pc_nic_init(pcmc, isa_bus, pci_bus); diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 8faeb6ce05..8030d53da6 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -292,7 +292,7 @@ static void pc_q35_init(MachineState *machine) } =20 /* init basic PC hardware */ - pc_basic_device_init(pcms, isa_bus, x86ms->gsi, &rtc_state, !mc->no_fl= oppy, + pc_basic_device_init(pcms, isa_bus, x86ms->gsi, rtc_state, !mc->no_flo= ppy, 0xff0104); =20 if (pcms->sata_enabled) { --=20 MST