From nobody Mon Feb 9 16:50:42 2026 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=1660767114; cv=none; d=zohomail.com; s=zohoarc; b=A+1EATz49kngOrenBBI4Z3pFwrBUiBHsrKyQxoP9ReuggoQ9Rv2ZASInozoCJCQ4+oN4CRZo/Xy8g7RSbfrNX78qFj0z+/cPgzow0Ts97RueErhhmvaB9TYJfPcWbHF04+4nO7OO8AcI+UjZiitDw2yqnZ6JjSooV5l+yDTVpuE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660767114; 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=k2ZpeeYKQErXhazsoSi6NbKbSpJUbceXzvANU3WD8iY=; b=hK4Uhwi6QI5S3VHABdsfR2YBJHCfIPa4QVd+ia/nd6D+rBanfzRItG1IUQaTKeVaWZl+PP249GhiAt7qbvE/q5XwrAv6w8C4gacYAnIeesHXXn94M5DlaX/tali8NFblFwUnExwQs5AIIwLyqcQMQY7dIFXtxwPQl/3PZ88XriE= 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 1660767114235224.134125603852; Wed, 17 Aug 2022 13:11:54 -0700 (PDT) Received: from localhost ([::1]:44724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOPOL-00034q-48 for importer@patchew.org; Wed, 17 Aug 2022 16:11:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPJ3-00035y-Up for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:58657) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPJ2-0000In-G4 for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:25 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-439-lytPjezzMpmE41zIteNBbw-1; Wed, 17 Aug 2022 16:06:22 -0400 Received: by mail-wm1-f71.google.com with SMTP id 203-20020a1c02d4000000b003a5f5bce876so1547984wmc.2 for ; Wed, 17 Aug 2022 13:06:22 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id d11-20020adffbcb000000b00224f7c1328dsm463251wrs.67.2022.08.17.13.06.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 13:06:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660766783; h=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=k2ZpeeYKQErXhazsoSi6NbKbSpJUbceXzvANU3WD8iY=; b=UIESwbus61MLrC2tqVJJNxHXHJeI9RYJxNyqTKXj2s2t+UCsB/5z3yXSqriiOl0WzcjwKO vEhY50YrI8PGRre85OzBTAct+lcy4eronaP98JJqwKMITUrh+g2aG9QpPy1F0/vqDcm7Pw VyVPN/4/wPUpqRsATItGpUXqVMW6ARQ= X-MC-Unique: lytPjezzMpmE41zIteNBbw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=k2ZpeeYKQErXhazsoSi6NbKbSpJUbceXzvANU3WD8iY=; b=Xeyy3tmR4O1ab0jALlLH25qU2muUBICa563qGx6hlf3fjvzQhTg+miDWm6yt3xUH1n oM8Mpv4cPFrhIQnH9fNgtYfdx1tDD6NlBM76Oe5w5tBCUHhlnbZv6DzzJWX8w2J2APhO Agyj0FQvNK2I+NGuw0JJxqPch0SSCfl34FjICzFaV66c2EHNUFu9MS+QMstuiQ8fp0Zh IPlk4Ypus8l38EDFGBFnWC18e6FxxtkiG2nahARXOG9jQ0aKfxj5ybAHapnfzT1xFV+I mf0Pn4VORty+wrpFpivdfozav0xzCYB6HM58Lq9h6KlTeHi2B3fX/vVqOEWxekMIyRMt RfAA== X-Gm-Message-State: ACgBeo00yDu/dH5H0W0bNw15f29HJ9PITCyPujTNF3+9bchCrexn62uG dzy5Nv4g/hbxv8M6BE32USBJc5tuZiLuRAMJNBZCGnflkEqJ8uO7lkAeUprGsKTMLGVr9Bg99pX Is1OXs7iyIXNpmWGqIH7v1IrlMq6A4SpYkJr+kJkCCxX9tUoRUP929EuPRuv/ X-Received: by 2002:a7b:c5c5:0:b0:3a5:3e42:fa18 with SMTP id n5-20020a7bc5c5000000b003a53e42fa18mr3026228wmk.178.1660766781259; Wed, 17 Aug 2022 13:06:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR7i2BOD6HaZeZ0j18q5sfQqJb2hcNGZ92TRqD7+yX6pePq8Fx2fSSK0Th8x+n3seH81n0RzTA== X-Received: by 2002:a7b:c5c5:0:b0:3a5:3e42:fa18 with SMTP id n5-20020a7bc5c5000000b003a53e42fa18mr3026213wmk.178.1660766780978; Wed, 17 Aug 2022 13:06:20 -0700 (PDT) Date: Wed, 17 Aug 2022 16:06:17 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Bobo WL , Ben Widawsky Subject: [PULL 08/12] hw/cxl: Add stub write function for RO MemoryRegionOps entries. Message-ID: <20220817200536.350795-9-mst@redhat.com> References: <20220817200536.350795-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817200536.350795-1-mst@redhat.com> 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: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1660767116234100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jonathan Cameron There is no checking on the availability of a write callback. Hence QEMU crashes if a write does occur to one of these regions. Discovered whilst chasing a Linux kernel bug that incorrectly wrote into one of these regions. Fixes: 6364adacdf ("hw/cxl/device: Implement the CAP array (8.2.8.1-2)") Reported-by: Bobo WL Signed-off-by: Jonathan Cameron Message-Id: <20220817145759.32603-2-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/cxl/cxl-device-utils.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/cxl/cxl-device-utils.c b/hw/cxl/cxl-device-utils.c index 687759b301..83ce7a8270 100644 --- a/hw/cxl/cxl-device-utils.c +++ b/hw/cxl/cxl-device-utils.c @@ -141,9 +141,15 @@ static uint64_t mdev_reg_read(void *opaque, hwaddr off= set, unsigned size) return retval; } =20 +static void ro_reg_write(void *opaque, hwaddr offset, uint64_t value, + unsigned size) +{ + /* Many register sets are read only */ +} + static const MemoryRegionOps mdev_ops =3D { .read =3D mdev_reg_read, - .write =3D NULL, /* memory device register is read only */ + .write =3D ro_reg_write, .endianness =3D DEVICE_LITTLE_ENDIAN, .valid =3D { .min_access_size =3D 1, @@ -173,7 +179,7 @@ static const MemoryRegionOps mailbox_ops =3D { =20 static const MemoryRegionOps dev_ops =3D { .read =3D dev_reg_read, - .write =3D NULL, /* status register is read only */ + .write =3D ro_reg_write, .endianness =3D DEVICE_LITTLE_ENDIAN, .valid =3D { .min_access_size =3D 1, @@ -188,7 +194,7 @@ static const MemoryRegionOps dev_ops =3D { =20 static const MemoryRegionOps caps_ops =3D { .read =3D caps_reg_read, - .write =3D NULL, /* caps registers are read only */ + .write =3D ro_reg_write, .endianness =3D DEVICE_LITTLE_ENDIAN, .valid =3D { .min_access_size =3D 1, --=20 MST