From nobody Mon Feb 9 16:18:25 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=1652736269; cv=none; d=zohomail.com; s=zohoarc; b=asDWJLJnl/D6FLl9tg4ks+hW+LWrf24XZ7cfXL4O61sXjCVVnedvb1Yu2gkHBNWPaOm/HQnrKNhsQa9ZOJ2jHhUHNAgkYE49eQS/Wd7BZxG83ziO+XbrJxxWwBxsh0XvJs/KZtviH1xQx0oLxbntlCjZ2QzNIIt4kfOUQUvkOTQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652736269; 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=ffHa/fT6FD5ALi+KFZhbi+0qweg5bNEW0JFNey8KOhE=; b=SkCw5IK+OHYeljIWe93gTjMf+kySMe1PQLT3ktatrsflDhvFlk1hS8GOjFi5OKa4IB1oIsYGONK0jF7rKz7hyLCFHBGsnOzcRrMgU+asi8yHCDJz01qXbPdzmHChxD75g0GugOka0UYiPkzl7+TjGjMqtA8aZJvCa24KleKcxcQ= 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 1652736269982161.4942928383523; Mon, 16 May 2022 14:24:29 -0700 (PDT) Received: from localhost ([::1]:52804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nqiCZ-0002H0-B2 for importer@patchew.org; Mon, 16 May 2022 17:24:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58694) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqhhI-000613-Cs for qemu-devel@nongnu.org; Mon, 16 May 2022 16:52:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:31887) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqhhF-0006Tx-8E for qemu-devel@nongnu.org; Mon, 16 May 2022 16:52:06 -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-401-U2YAuKU7OVOnkjVo4dPIow-1; Mon, 16 May 2022 16:52:03 -0400 Received: by mail-ed1-f69.google.com with SMTP id o10-20020aa7c7ca000000b0042a4f08405fso6817993eds.22 for ; Mon, 16 May 2022 13:52:03 -0700 (PDT) Received: from redhat.com ([2.55.131.38]) by smtp.gmail.com with ESMTPSA id g26-20020a056402181a00b0042617ba638esm5626213edy.24.2022.05.16.13.51.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 13:52:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652734324; 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=ffHa/fT6FD5ALi+KFZhbi+0qweg5bNEW0JFNey8KOhE=; b=gEYRJy1gQAY7KR3G7aKHTQQKN0i7zwO0BAmq9qAjS74xlk1Q+kmQSJXO8BQc0voR32qA7C 2LMVHF2nB5vqyLB7+cN7SNg4KtLN9YwoUnpid6UY4UuR7eEv5pmC4zvYzbRFSXl+LLYuTR YnGQpi3notHWUMOpQx9w2hZRY/5HcgU= X-MC-Unique: U2YAuKU7OVOnkjVo4dPIow-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=ffHa/fT6FD5ALi+KFZhbi+0qweg5bNEW0JFNey8KOhE=; b=tc9s6VMPQVbO0L8bkLGeHxWy1ChKhLYg3RQG+JkQhcUx3i5wO/j04xwaWG7f1IX74y 2lg1dMgRGGib+TVRrGIHRzv0ONuriT0eCpfP4Claz/mn698u23I6Hb7TXelreNOSrkvz d3bqt0M3WvinZKdukRBP+UxJKYOFwvOQzYxZGH7e+ZhTMB53eXKaMPPbx/4yvgsNvSxJ 8T7M5Jwpz5wRGC3Qi9X3/jRfgps/gCuY5mVuivBIAoaY2kxU1BRERGGHaZUqIm/kNflc o708YbEUqkGXImxnUYiBXGxoGBL0P7aNdLDb9glEfYso97o8kRxcLYii8izFfnz03VYI Kl1w== X-Gm-Message-State: AOAM531zxGlHcn3QQg/TEzHZtF5Et3WfM1wqIQqHfEAQJqlmVpfO1yOR uPf73QWcKsvPx2Y6XQVTxFJsxmIHm5rypGubVka3t14JlE1aiwGRSkDpC3K8MmQhUR1VGm0o6Ly v2nYCtTmX84aSVADZ+V/OWhvFBnglkEJ2dYCLjEbPedXhs7oYKBE59WwBCH/s X-Received: by 2002:aa7:c2d4:0:b0:42a:a9a6:e73c with SMTP id m20-20020aa7c2d4000000b0042aa9a6e73cmr10401622edp.115.1652734322054; Mon, 16 May 2022 13:52:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOo0hOchNVxEa8Y7MW4uIW/z+s/gNEaJFPm22HDdObQTBSl07Wa7xHg7xT8ScVO7P6dkkENQ== X-Received: by 2002:aa7:c2d4:0:b0:42a:a9a6:e73c with SMTP id m20-20020aa7c2d4000000b0042aa9a6e73cmr10401604edp.115.1652734321857; Mon, 16 May 2022 13:52:01 -0700 (PDT) Date: Mon, 16 May 2022 16:51:57 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Ben Widawsky , Alison Schofield , Jonathan Cameron , Alex =?utf-8?Q?Benn=C3=A9e?= , Igor Mammedov , Ani Sinha Subject: [PULL v2 30/86] acpi/cxl: Introduce CFMWS structures in CEDT Message-ID: <20220516204913.542894-31-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.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: 1652736270396100001 From: Ben Widawsky The CEDT CXL Fixed Window Memory Window Structures (CFMWs) define regions of the host phyiscal address map which (via an impdef means) are configured such that they have a particular interleave setup across one or more CXL Host Bridges. Reported-by: Alison Schofield Signed-off-by: Ben Widawsky Signed-off-by: Jonathan Cameron Reviewed-by: Alex Benn=C3=A9e Message-Id: <20220429144110.25167-29-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/cxl.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/hw/acpi/cxl.c b/hw/acpi/cxl.c index aa4af86a4c..31d5235136 100644 --- a/hw/acpi/cxl.c +++ b/hw/acpi/cxl.c @@ -60,6 +60,64 @@ static void cedt_build_chbs(GArray *table_data, PXBDev *= cxl) build_append_int_noprefix(table_data, memory_region_size(mr), 8); } =20 +/* + * CFMWS entries in CXL 2.0 ECN: CEDT CFMWS & QTG _DSM. + * Interleave ways encoding in CXL 2.0 ECN: 3, 6, 12 and 16-way memory + * interleaving. + */ +static void cedt_build_cfmws(GArray *table_data, MachineState *ms) +{ + CXLState *cxls =3D ms->cxl_devices_state; + GList *it; + + for (it =3D cxls->fixed_windows; it; it =3D it->next) { + CXLFixedWindow *fw =3D it->data; + int i; + + /* Type */ + build_append_int_noprefix(table_data, 1, 1); + + /* Reserved */ + build_append_int_noprefix(table_data, 0, 1); + + /* Record Length */ + build_append_int_noprefix(table_data, 36 + 4 * fw->num_targets, 2); + + /* Reserved */ + build_append_int_noprefix(table_data, 0, 4); + + /* Base HPA */ + build_append_int_noprefix(table_data, fw->mr.addr, 8); + + /* Window Size */ + build_append_int_noprefix(table_data, fw->size, 8); + + /* Host Bridge Interleave Ways */ + build_append_int_noprefix(table_data, fw->enc_int_ways, 1); + + /* Host Bridge Interleave Arithmetic */ + build_append_int_noprefix(table_data, 0, 1); + + /* Reserved */ + build_append_int_noprefix(table_data, 0, 2); + + /* Host Bridge Interleave Granularity */ + build_append_int_noprefix(table_data, fw->enc_int_gran, 4); + + /* Window Restrictions */ + build_append_int_noprefix(table_data, 0x0f, 2); /* No restrictions= */ + + /* QTG ID */ + build_append_int_noprefix(table_data, 0, 2); + + /* Host Bridge List (list of UIDs - currently bus_nr) */ + for (i =3D 0; i < fw->num_targets; i++) { + g_assert(fw->target_hbs[i]); + build_append_int_noprefix(table_data, fw->target_hbs[i]->bus_n= r, 4); + } + } +} + static int cxl_foreach_pxb_hb(Object *obj, void *opaque) { Aml *cedt =3D opaque; @@ -86,6 +144,7 @@ void cxl_build_cedt(MachineState *ms, GArray *table_offs= ets, GArray *table_data, /* reserve space for CEDT header */ =20 object_child_foreach_recursive(object_get_root(), cxl_foreach_pxb_hb, = cedt); + cedt_build_cfmws(cedt->buf, ms); =20 /* copy AML table into ACPI tables blob and patch header there */ g_array_append_vals(table_data, cedt->buf->data, cedt->buf->len); --=20 MST