From nobody Mon Feb 9 14:37:49 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=1652734597; cv=none; d=zohomail.com; s=zohoarc; b=bhqhO0+BpLSgjIIQ9hM6o3QFDeV6Md9u2i2QHk70aAOTzPTgySZBh3DP8taSbXS1eD8HAceNylhmB18Zm4eb44cdb+xjq5fylDL20fJusWD0CqF0tk+t2EK8oZQHApP0hEb2VGUUQjMnulhEmpv2vdUxgkJ5vY+O7I4RQeOosEc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652734597; 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=EVeb92muGpGF+5fS1YTFGba+yxQKZdSBlvAWWWx2YjA=; b=Jvv3pxfZB2DzLrEVBGmCPBVR8sAcqud1ViZSGAWUxbVDGTwXn2xj459rkpCF/R2SCzFAiBL2FOLjSqRQusZvuMNosUbIIZy+vwqu6+d9C8YwIEb+PEGQfqxb9wFdY20zFy6ejrvDtw57mMe6i6zsTUHGcrrWwv5uLnz34sbiIZ4= 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 1652734597983937.5365921312111; Mon, 16 May 2022 13:56:37 -0700 (PDT) Received: from localhost ([::1]:41242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nqhlc-00052F-S8 for importer@patchew.org; Mon, 16 May 2022 16:56:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqhg0-0004TJ-JE for qemu-devel@nongnu.org; Mon, 16 May 2022 16:50:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:23926) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqhfx-0006Fc-Im for qemu-devel@nongnu.org; Mon, 16 May 2022 16:50:47 -0400 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-594-slfbWLXWNeGtK0JiQRnruQ-1; Mon, 16 May 2022 16:50:44 -0400 Received: by mail-ed1-f69.google.com with SMTP id n7-20020a05640206c700b0042aaeb9d702so2913424edy.19 for ; Mon, 16 May 2022 13:50:43 -0700 (PDT) Received: from redhat.com ([2.55.131.38]) by smtp.gmail.com with ESMTPSA id da12-20020a056402176c00b0042aaa626ac0sm3073226edb.38.2022.05.16.13.50.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 13:50:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652734245; h=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=EVeb92muGpGF+5fS1YTFGba+yxQKZdSBlvAWWWx2YjA=; b=djVNOr8MChITNaSewYtYr9gb1pgMFubzbhe/NPGR3zvDbl5xYj1xYgoeEZn72Wcxx4Aabr jYcpev7KfvUho18W0LUuABAEKWOTy652lk/9GffCr3HyWaiqgJHCBYOv9VkqgPsqqc5Di1 BrgSZ7qVZexGkGviUtZWPtD0rTSCTCI= X-MC-Unique: slfbWLXWNeGtK0JiQRnruQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=EVeb92muGpGF+5fS1YTFGba+yxQKZdSBlvAWWWx2YjA=; b=fC/mURbJ1lkNL0JxPsDiDoGRd/sJKiOhRRpwDIsL4zTGlNaIQFN69uq05zLI3wrJ0u YX+h1bLkCDtU+Be35V1bUan8d249dcMgVREOM0QBJSDe6C5YK4fd5/i7kviO7hKWg6lX 96/ikEUG35VLKsUTCUatCqod6NXMBSeq3chtHnuACYvbOmvNhaO1GBWYtwcKvj+aVC3L PlVGPwNXvOF1Ae8AgDzYAxfAoko7bYCdVAW5Sbt7j6UQhj7NG0ozG64+YVEzWV4f7KC1 qqYRL3AdTJEW+u//P15AuYi/MddmZaSfDE34t68RfUOLJSaXiW/NNuOMt74E0XknZ5Z2 EASg== X-Gm-Message-State: AOAM53267c13DXAtVGayA6HPPxEadpOdBEP5oVP7Hw89o5f3tXEa9/nk EHxKm2Wd+YnyKPhX/VZpGFC+OsoNC1f9s/K/8Y7VA7aEOqGWA5psK/930ck0jfkgEZAO+qoVRZZ q0/P5TrwiVwYVYHUiQT2umM3hrmDOLyEszJly/AcSBF+7y9haDNBnfhdajCKT X-Received: by 2002:a05:6402:354f:b0:418:849a:c66a with SMTP id f15-20020a056402354f00b00418849ac66amr15209379edd.234.1652734242652; Mon, 16 May 2022 13:50:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDvS1UC9PXRaGs1Bl2trqHsue5REYSWo0ouNduH73mkrePKonmFsWtzL3gSEz+D6kdBKyQ5g== X-Received: by 2002:a05:6402:354f:b0:418:849a:c66a with SMTP id f15-20020a056402354f00b00418849ac66amr15209355edd.234.1652734242355; Mon, 16 May 2022 13:50:42 -0700 (PDT) Date: Mon, 16 May 2022 16:50:39 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Ben Widawsky , Jonathan Cameron , Alex =?utf-8?Q?Benn=C3=A9e?= Subject: [PULL v2 10/86] hw/cxl/device: Add cheap EVENTS implementation (8.2.9.1) Message-ID: <20220516204913.542894-11-mst@redhat.com> References: <20220516204913.542894-1-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20220516204913.542894-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.133.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: 1652734599258100001 From: Ben Widawsky Using the previously implemented stubbed helpers, it is now possible to easily add the missing, required commands to the implementation. Signed-off-by: Ben Widawsky Signed-off-by: Jonathan Cameron Reviewed-by: Alex Benn=C3=A9e Message-Id: <20220429144110.25167-9-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/cxl/cxl-mailbox-utils.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index 2557f41f61..fb1f53f48e 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -38,6 +38,14 @@ * a register interface that already deals with it. */ =20 +enum { + EVENTS =3D 0x01, + #define GET_RECORDS 0x0 + #define CLEAR_RECORDS 0x1 + #define GET_INTERRUPT_POLICY 0x2 + #define SET_INTERRUPT_POLICY 0x3 +}; + /* 8.2.8.4.5.1 Command Return Codes */ typedef enum { CXL_MBOX_SUCCESS =3D 0x0, @@ -93,9 +101,26 @@ struct cxl_cmd { return CXL_MBOX_SUCCESS; \ } =20 +DEFINE_MAILBOX_HANDLER_ZEROED(events_get_records, 0x20); +DEFINE_MAILBOX_HANDLER_NOP(events_clear_records); +DEFINE_MAILBOX_HANDLER_ZEROED(events_get_interrupt_policy, 4); +DEFINE_MAILBOX_HANDLER_NOP(events_set_interrupt_policy); + static QemuUUID cel_uuid; =20 -static struct cxl_cmd cxl_cmd_set[256][256] =3D {}; +#define IMMEDIATE_CONFIG_CHANGE (1 << 1) +#define IMMEDIATE_LOG_CHANGE (1 << 4) + +static struct cxl_cmd cxl_cmd_set[256][256] =3D { + [EVENTS][GET_RECORDS] =3D { "EVENTS_GET_RECORDS", + cmd_events_get_records, 1, 0 }, + [EVENTS][CLEAR_RECORDS] =3D { "EVENTS_CLEAR_RECORDS", + cmd_events_clear_records, ~0, IMMEDIATE_LOG_CHANGE }, + [EVENTS][GET_INTERRUPT_POLICY] =3D { "EVENTS_GET_INTERRUPT_POLICY", + cmd_events_get_interrupt_policy, 0, 0 }, + [EVENTS][SET_INTERRUPT_POLICY] =3D { "EVENTS_SET_INTERRUPT_POLICY", + cmd_events_set_interrupt_policy, 4, IMMEDIATE_CONFIG_CHANGE }, +}; =20 void cxl_process_mailbox(CXLDeviceState *cxl_dstate) { --=20 MST