From patchwork Mon Aug 5 18:06:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 816741 Delivered-To: patch@linaro.org Received: by 2002:adf:e00d:0:b0:367:895a:4699 with SMTP id s13csp1469784wrh; Mon, 5 Aug 2024 11:08:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVOwnU9YUsJ644dM4LnkSlim230satx0IGjStDntyyrOKZk5pczRv9y3tMuGc4KnbrETRi2SgfX6kg5HpUGacLz X-Google-Smtp-Source: AGHT+IEfnJKMD9FdG+EmwFzLoGHz52M3i52CDDHr50mwrX4nzWqASWjgDqQzeubXg7XL7FaMZNhr X-Received: by 2002:a0c:fe61:0:b0:6b5:1d2f:1d3 with SMTP id 6a1803df08f44-6bb91a8dd23mr237398436d6.0.1722881280066; Mon, 05 Aug 2024 11:08:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722881280; cv=none; d=google.com; s=arc-20160816; b=g9XJ65arRccu/LtIJMPoBikPajcc+OMssTQgp+jc1UeJHGKZHd6a80j/037vqEOPmY xVLcoVH0zOvDPMaU5nifANo58LWLQLWH2gAHyuhCvB7J5bS1fS8Nea7NLmQnWdeX7Sje IKC9GrhFBSYrhcjTIyW7UlwbDklw8djJPH5g8EPyv1ZeL2fA7CSmnV5pXaguKG54Vvw3 cAopyc5g9PaU8z1MV+o+XIxSkrTPCi4hZjPLtjgLMgnAKYNjsN4YwK3FcpAlYYlwsNog 5f1uXc994zJk6eZm82VOWRchbMNUnJXHInlpUEhKhLnyrTGR9DwLSFkrfJ27flWKcjn4 556A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Qa8CKbLhoz34ttiNqF/zHY4zDmsX/Q9TUl4u9/0D30I=; fh=9FIv2ryHyUdV0M0E/xImFOb7ha8RVmpB9WW8IcVSbKs=; b=PqERvKPP0//oUl77FeKw/k96ES/Hn2QUobqhkAXhjb7mftIdCunWnYlOy5Ll5zab4H 6j4R1fIngXWz4UCy/7ARoL3Yt2fZWh/MFfWHIeSR3KUfs8ObZISd74+Mpu93aJBRHtuT SAh9uX8bsIh+JeEWDcGs2LVUgQ1igrmIzq5zgjKVV7eQwruh700ZyWAUxDOVXqyl2tTj bmBBjANsZKjvVApGsWtcj4ihE2dM98NvItnsH5Ws/B2zYbMux6HSr6iuM+1ljL9KPJYZ SRs7CL9XholUYz8KM/ek4DeEr4wnD5jVIQ1M3QTo2q6ojOitS1MOym5LjkkNVh17AjYa btFw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SAYDUyqh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6bb9c88f685si97501656d6.417.2024.08.05.11.07.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Aug 2024 11:08:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SAYDUyqh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sb26R-0005a1-A0; Mon, 05 Aug 2024 14:06: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 1sb26Q-0005Vt-1N for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:06:38 -0400 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sb26N-0006MV-Ch for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:06:36 -0400 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5ab2baf13d9so14733719a12.2 for ; Mon, 05 Aug 2024 11:06:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722881193; x=1723485993; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Qa8CKbLhoz34ttiNqF/zHY4zDmsX/Q9TUl4u9/0D30I=; b=SAYDUyqhHj+pa+Wtpy5E500Cooem3yYhsA5JJ6Gl6kB4fbZIjhNMngDnMwWvdB38/4 5xH0HuOO1XcLPaxtQkVNOKZ85XzbVHV2yIQ9mxUVN/Kd/mU3DRJfruYoH8V9RgwIou51 aNr16jL9I56Oj/ZXEW0ArF9U2QuOqx3ZlzSBgAsBkOKv2hy/C7rnyENxYnZaLLdk5CS+ GMam93ZIs7SRzu1JVEhBodJ77DPPgQ1DCprdnvD+MqF6IBdwokW0oMfseZ5D/GxveA10 VMPDZR8yMCxsaYFbtkd4fbVx9jCzTWpXdpmsNSn/wtYbnJEe47lV3AzmZd+K+30+Mm+P YYcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722881193; x=1723485993; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Qa8CKbLhoz34ttiNqF/zHY4zDmsX/Q9TUl4u9/0D30I=; b=Uuyok6Pxkml/keX5X0ShBhRlCpaKo4SUvO9a7Z78145UunTAmIFeDVgCtRLSIlEM3J roor/T+FuB5hSyVTpfK3mUxnl9hcJYREy7S5G1ESrlK/CLQazf9OydQVaz8znCt5kMIg rS2wGTTF1VPRqMeOrXISjBTovKXtYunEa/gFLNmPoXXJ8s4Y4T4H9qFeIKt6l61p2T7C VtLTC0o6FyDMwIkWEUq6K4wT+PLMAk9ArdYhyHJ8R3UdiXmKl/nZkINSe+lxBbfj6AAh HosZjgSpTJCPmdy9iBCq7MuPZgATBalZX2Vlh3zHs/+T8vRlWSiSbnIXpse6X7noZsbo CO3w== X-Gm-Message-State: AOJu0YwknKz7BjUMVY8dL3s0SgGtjezM1e9IVFi39NF6w57NcUYA+Pti jO9X0pnOr4t5gT76LQD/nJchmO5k37oj8+1oy9XlvaMQ0J7Yg49ADOAicMWO8B30Y2kA7D05lAE 6 X-Received: by 2002:a05:6402:2055:b0:5a1:a7cb:8f86 with SMTP id 4fb4d7f45d1cf-5b7f0dccf33mr8499034a12.0.1722881193360; Mon, 05 Aug 2024 11:06:33 -0700 (PDT) Received: from m1x-phil.lan (cor91-h02-176-184-30-206.dsl.sta.abo.bbox.fr. [176.184.30.206]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5b83b82f308sm5174778a12.63.2024.08.05.11.06.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 05 Aug 2024 11:06:32 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Bibo Mao Cc: Song Gao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Jiaxun Yang Subject: [PATCH-for-9.1 v6 01/15] hw/intc/loongson_ipi: Rename LoongsonIPI -> LoongsonIPIState Date: Mon, 5 Aug 2024 20:06:08 +0200 Message-ID: <20240805180622.21001-2-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240805180622.21001-1-philmd@linaro.org> References: <20240805180622.21001-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::535; envelope-from=philmd@linaro.org; helo=mail-ed1-x535.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bibo Mao We'll have to add LoongsonIPIClass in few commits, so rename LoongsonIPI as LoongsonIPIState for clarity. Signed-off-by: Bibo Mao [PMD: Extracted from bigger commit, added commit description] Co-Developed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bibo Mao Tested-by: Bibo Mao Acked-by: Song Gao Reviewed-by: Richard Henderson Reviewed-by: Jiaxun Yang Tested-by: Jiaxun Yang Message-Id: <20240718133312.10324-4-philmd@linaro.org> --- include/hw/intc/loongson_ipi.h | 6 +++--- hw/intc/loongson_ipi.c | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/hw/intc/loongson_ipi.h b/include/hw/intc/loongson_ipi.h index 3f795edbf3..efb772f384 100644 --- a/include/hw/intc/loongson_ipi.h +++ b/include/hw/intc/loongson_ipi.h @@ -31,10 +31,10 @@ #define IPI_MBX_NUM 4 #define TYPE_LOONGSON_IPI "loongson_ipi" -OBJECT_DECLARE_SIMPLE_TYPE(LoongsonIPI, LOONGSON_IPI) +OBJECT_DECLARE_SIMPLE_TYPE(LoongsonIPIState, LOONGSON_IPI) typedef struct IPICore { - LoongsonIPI *ipi; + LoongsonIPIState *ipi; MemoryRegion *ipi_mmio_mem; uint32_t status; uint32_t en; @@ -45,7 +45,7 @@ typedef struct IPICore { qemu_irq irq; } IPICore; -struct LoongsonIPI { +struct LoongsonIPIState { SysBusDevice parent_obj; MemoryRegion ipi_iocsr_mem; MemoryRegion ipi64_iocsr_mem; diff --git a/hw/intc/loongson_ipi.c b/hw/intc/loongson_ipi.c index 682cec96f3..903483ae80 100644 --- a/hw/intc/loongson_ipi.c +++ b/hw/intc/loongson_ipi.c @@ -64,7 +64,7 @@ static MemTxResult loongson_ipi_iocsr_readl(void *opaque, hwaddr addr, uint64_t *data, unsigned size, MemTxAttrs attrs) { - LoongsonIPI *ipi = opaque; + LoongsonIPIState *ipi = opaque; IPICore *s; if (attrs.requester_id >= ipi->num_cpu) { @@ -160,7 +160,7 @@ static MemTxResult loongson_ipi_core_writel(void *opaque, hwaddr addr, MemTxAttrs attrs) { IPICore *s = opaque; - LoongsonIPI *ipi = s->ipi; + LoongsonIPIState *ipi = s->ipi; int index = 0; uint32_t cpuid; uint8_t vector; @@ -214,7 +214,7 @@ static MemTxResult loongson_ipi_iocsr_writel(void *opaque, hwaddr addr, uint64_t val, unsigned size, MemTxAttrs attrs) { - LoongsonIPI *ipi = opaque; + LoongsonIPIState *ipi = opaque; IPICore *s; if (attrs.requester_id >= ipi->num_cpu) { @@ -277,7 +277,7 @@ static const MemoryRegionOps loongson_ipi64_ops = { static void loongson_ipi_realize(DeviceState *dev, Error **errp) { - LoongsonIPI *s = LOONGSON_IPI(dev); + LoongsonIPIState *s = LOONGSON_IPI(dev); SysBusDevice *sbd = SYS_BUS_DEVICE(dev); int i; @@ -320,7 +320,7 @@ static void loongson_ipi_realize(DeviceState *dev, Error **errp) static void loongson_ipi_unrealize(DeviceState *dev) { - LoongsonIPI *s = LOONGSON_IPI(dev); + LoongsonIPIState *s = LOONGSON_IPI(dev); g_free(s->cpu); } @@ -344,14 +344,14 @@ static const VMStateDescription vmstate_loongson_ipi = { .version_id = 2, .minimum_version_id = 2, .fields = (const VMStateField[]) { - VMSTATE_STRUCT_VARRAY_POINTER_UINT32(cpu, LoongsonIPI, num_cpu, + VMSTATE_STRUCT_VARRAY_POINTER_UINT32(cpu, LoongsonIPIState, num_cpu, vmstate_ipi_core, IPICore), VMSTATE_END_OF_LIST() } }; static Property ipi_properties[] = { - DEFINE_PROP_UINT32("num-cpu", LoongsonIPI, num_cpu, 1), + DEFINE_PROP_UINT32("num-cpu", LoongsonIPIState, num_cpu, 1), DEFINE_PROP_END_OF_LIST(), }; @@ -369,7 +369,7 @@ static const TypeInfo loongson_ipi_types[] = { { .name = TYPE_LOONGSON_IPI, .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(LoongsonIPI), + .instance_size = sizeof(LoongsonIPIState), .class_init = loongson_ipi_class_init, } }; From patchwork Mon Aug 5 18:06:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 816743 Delivered-To: patch@linaro.org Received: by 2002:adf:e00d:0:b0:367:895a:4699 with SMTP id s13csp1469770wrh; Mon, 5 Aug 2024 11:07:59 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWEvCNEsTUX5J7L+nKU6LwLTIJWCzBb6/5USDrtqfXtlONUr+OO7jk6ctweLcExFCwtINsWMDd51zOPG1yudf20 X-Google-Smtp-Source: AGHT+IHa6p0jK1E85sThZxNZ6BbDgw3DId4BIvfh9wxls9z4UTXpmaPabVGaQbpN+zvKDZv84QmM X-Received: by 2002:a05:6902:1505:b0:e0b:f4bd:24d2 with SMTP id 3f1490d57ef6-e0bf4bd2569mr10255308276.30.1722881278770; Mon, 05 Aug 2024 11:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722881278; cv=none; d=google.com; s=arc-20160816; b=lWQTyIhGLji9MyooIYd3vicvaWrCJq+7JlaMcOElwv9Rc7QHGKvGw2usP9HBEwNj/L utWioFivg3URfAQba6YnnG6TWnFtKmMfysAoC/ALoeB9ABss1PfJBek6ISVz5R2G3tuS baHCFPyfea5QpGVy0mTA3Me8Az0n3XJ601AENB9u+lW8mPUS6ohSuCCiDEPJhio6q6ZT gjmcjALB7j2o1Cs2axmdq1I3jhqW0gM1FosDYYQBOA2XMONQUnyd3cquj18Zr9sSrtk2 17bdU3cE8JDRhsRNkJ0mPW7pDT/35cW19P57llYaoqG1L7j+QP4bpfZQE6K/grlssQmd RG1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=X5uNst4W6LAAfy5PWyCP4yG159IePDhcmfia8qBHksY=; fh=9FIv2ryHyUdV0M0E/xImFOb7ha8RVmpB9WW8IcVSbKs=; b=Gsr4PZoxja1m3+M0al5TtrnVen8OuoTTLyQHajSlCzhux+HMVDoFVpbBinJcidah1f 3DBxlPeoeCZB766Ormct83LYgSG6QeGiP0SlKUKbv5xhzcnGC2ypQybbYoeFTFkFev5m 7HlSCen+Jbnnz51S7XUQ+pjW4WvA5GpG7rtzLUCcXYDaWrG5AFIMeYfypCOWMxyEsnvL T+ynMH42F0f8DJikOJMcUba+x9eMjn6/mmHTEcQDVQY2iLF3qsAJsu2jAB79niNm04cx X5i52Tjh1kO79IG6DAj4NtRRWCswsCuJ44UP7v/qIbno6i6u/t9JK2/iKXP7ipiYoLNu iAGg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y1Xw4TQt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7a3514ee7fcsi960366185a.329.2024.08.05.11.07.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Aug 2024 11:07:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y1Xw4TQt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sb26W-0005kQ-F9; Mon, 05 Aug 2024 14:06: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 1sb26V-0005jg-9d for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:06:43 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sb26T-0006O9-Ij for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:06:43 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-42819654737so67693345e9.1 for ; Mon, 05 Aug 2024 11:06:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722881200; x=1723486000; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=X5uNst4W6LAAfy5PWyCP4yG159IePDhcmfia8qBHksY=; b=y1Xw4TQtsidYL/UnDxqVe8SG3Gacakh4ZjFJhQv3Y55GTQDto7e6hRhjJaATYdrluW mZ/v07m77zR5PbIiALA3jj/dTMLjltqogzp5Iv5l6Z/jKldd8DdJZA0u/n5/JzqGU87t qS7bcDyFxK+RIylLOLr9LdyDNoW7R94WsUKh8ZcZ5HJTDM9TYQGtqAKf73bmJCiX/RuZ SIK3CPUMbiqVy9xk2Qt931TXbuFNs+CUUfR0Z7I3JOsHtKyWhgj+nOQnsZUBuXh15QFR en7oAjXiqNy/Z8JcHPBdq+pEIF4ersYSSF2S225vBZR1zLhxrNkp+ueoK/xD42mW95S4 1QWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722881200; x=1723486000; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=X5uNst4W6LAAfy5PWyCP4yG159IePDhcmfia8qBHksY=; b=ttVykInKF8s47l4BcSgAzCSDclomauEwGWGnJaxYuYrNByaYTqcniX8Yn140/EyoEy bGoQ6HDgfFV+gW7QdrhVXhGpnFh1llL9cd7yDItNoP797g1FRF+qoXRMIDJpqoLy/rrQ 6a7xzNe92aOBYX6FJaZ9o+yDBG+U1uNiNP++FNO5a9ZH8g7tEdO5Hxi0Llo+OgJOSuMB KoQLPf8H80B69Hg1cZUS74HuvNj1lprLwOVQFeRjpca0BxRbUrYTogGxCKDsGe6BfFzk ccye73IPEEDWcBFLNH+Fr1A/67tH7LYLf+Gy31oTDT/O+YMbcNYGH7iT27g5TulPk0sl RFdg== X-Gm-Message-State: AOJu0YylbqqGbe4WiPeFBztTICzGPeZV7sH1vodb3nqE/pL5DP9MT8jr 4TcARZk6gGOGALhCNgGHdT27h4eMJ69EXIpQCwySjIaF4NDdhTMwv1MlKxVUDcp/1KdCfByGZGl X X-Received: by 2002:a5d:4fc7:0:b0:368:7fd3:291c with SMTP id ffacd0b85a97d-36bbc180c19mr7926345f8f.60.1722881199386; Mon, 05 Aug 2024 11:06:39 -0700 (PDT) Received: from m1x-phil.lan (cor91-h02-176-184-30-206.dsl.sta.abo.bbox.fr. [176.184.30.206]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36bbd06fbfdsm10519622f8f.106.2024.08.05.11.06.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 05 Aug 2024 11:06:38 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Bibo Mao Cc: Song Gao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Jiaxun Yang Subject: [PATCH-for-9.1 v6 02/15] hw/intc/loongson_ipi: Extract loongson_ipi_common_realize() Date: Mon, 5 Aug 2024 20:06:09 +0200 Message-ID: <20240805180622.21001-3-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240805180622.21001-1-philmd@linaro.org> References: <20240805180622.21001-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bibo Mao In preparation to extract common IPI code in few commits, extract loongson_ipi_common_realize(). Signed-off-by: Bibo Mao [PMD: Extracted from bigger commit, added commit description] Co-Developed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bibo Mao Tested-by: Bibo Mao Acked-by: Song Gao Reviewed-by: Richard Henderson Reviewed-by: Jiaxun Yang Tested-by: Jiaxun Yang Message-Id: <20240718133312.10324-6-philmd@linaro.org> --- hw/intc/loongson_ipi.c | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/hw/intc/loongson_ipi.c b/hw/intc/loongson_ipi.c index 903483ae80..8aab7e48e8 100644 --- a/hw/intc/loongson_ipi.c +++ b/hw/intc/loongson_ipi.c @@ -275,7 +275,7 @@ static const MemoryRegionOps loongson_ipi64_ops = { .endianness = DEVICE_LITTLE_ENDIAN, }; -static void loongson_ipi_realize(DeviceState *dev, Error **errp) +static void loongson_ipi_common_realize(DeviceState *dev, Error **errp) { LoongsonIPIState *s = LOONGSON_IPI(dev); SysBusDevice *sbd = SYS_BUS_DEVICE(dev); @@ -301,30 +301,46 @@ static void loongson_ipi_realize(DeviceState *dev, Error **errp) sysbus_init_mmio(sbd, &s->ipi64_iocsr_mem); s->cpu = g_new0(IPICore, s->num_cpu); - if (s->cpu == NULL) { - error_setg(errp, "Memory allocation for IPICore faile"); - return; - } - for (i = 0; i < s->num_cpu; i++) { s->cpu[i].ipi = s; - s->cpu[i].ipi_mmio_mem = g_new0(MemoryRegion, 1); - g_autofree char *name = g_strdup_printf("loongson_ipi_cpu%d_mmio", i); - memory_region_init_io(s->cpu[i].ipi_mmio_mem, OBJECT(dev), - &loongson_ipi_core_ops, &s->cpu[i], name, 0x48); - sysbus_init_mmio(sbd, s->cpu[i].ipi_mmio_mem); qdev_init_gpio_out(dev, &s->cpu[i].irq, 1); } } -static void loongson_ipi_unrealize(DeviceState *dev) +static void loongson_ipi_realize(DeviceState *dev, Error **errp) +{ + LoongsonIPIState *s = LOONGSON_IPI(dev); + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); + Error *local_err = NULL; + + loongson_ipi_common_realize(dev, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + + for (unsigned i = 0; i < s->num_cpu; i++) { + s->cpu[i].ipi_mmio_mem = g_new0(MemoryRegion, 1); + g_autofree char *name = g_strdup_printf("loongson_ipi_cpu%d_mmio", i); + memory_region_init_io(s->cpu[i].ipi_mmio_mem, OBJECT(dev), + &loongson_ipi_core_ops, &s->cpu[i], name, 0x48); + sysbus_init_mmio(sbd, s->cpu[i].ipi_mmio_mem); + } +} + +static void loongson_ipi_common_unrealize(DeviceState *dev) { LoongsonIPIState *s = LOONGSON_IPI(dev); g_free(s->cpu); } +static void loongson_ipi_unrealize(DeviceState *dev) +{ + loongson_ipi_common_unrealize(dev); +} + static const VMStateDescription vmstate_ipi_core = { .name = "ipi-single", .version_id = 2, From patchwork Mon Aug 5 18:06:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 816737 Delivered-To: patch@linaro.org Received: by 2002:adf:e00d:0:b0:367:895a:4699 with SMTP id s13csp1469685wrh; Mon, 5 Aug 2024 11:07:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXsjyrrFcTS44/t/QDPCSuBqRKr/4yGdEhL7FtNQboFXvosdlOADV3d+U2+/QFbBXWBnbeBXhR8VYQn/aQcdwEN X-Google-Smtp-Source: AGHT+IHAeNL26QTC/G5gIxGZo9un71isr/hPQr5Co8QibDWbuAw0yYUJmmvBb/UmfbVLvjIFmsVc X-Received: by 2002:a05:6830:2114:b0:703:6641:cea5 with SMTP id 46e09a7af769-709b3234b23mr15812451a34.16.1722881268137; Mon, 05 Aug 2024 11:07:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722881268; cv=none; d=google.com; s=arc-20160816; b=ORUoVlDTyMQIRDCVlE/zaImoubMgYbLXjrYdI4loAHt9i4sAgyrm+NoB96fgPx8hfo 4eOR19xzRzsgNGS458nvd3kXCFK9QpTPxyi6zBGRmkM/FX5FTlbqnI5bjiCsgDHYOaEs 9muJZUyi9sJn9ab8vk+uf3G9fZzWKZHMbgj+r+EwhMybByilAmCzdmX+bdyk+QA3r1l4 AiIBdC7e00m3G2gbMLtoCUFvMwRggy7/p1eZM9agV8cWK+4vwlwbtXqlEpVtIorz8eFo IQs6GIYu4xPba23Eya3JbcXrK+mu208lc0N3/PkTGgeHaZzg1YvTOGvPW2TDgkjEjxgf kLRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MqeGnZInvHvb7oL2hFm59TF6/LgyPKhgLDZR7Hn5KKQ=; fh=9FIv2ryHyUdV0M0E/xImFOb7ha8RVmpB9WW8IcVSbKs=; b=hgqC+Pqj9lAA2RDOYzKD9BppMaAQnq3rh47wMA3Ntzxf3MmZyvSQpAW0cun2GA/Yt9 VFKhYjUYj0kRFx3eDHd5U6A0VlGaqOKsLuDW2ZhleMICsA/6kGYiOrfIwmvX0sBCMt7y IFUaUrwfpm+SGBzZGeEPhR3QREluj5J+/Q73+j/Ckkip9yTGH/+tRCOizuPvYoPqloR+ wFWvISMHmVocCthjSbLQ7k1wY/vaqN79QyMEGegb5+jtyanrQhTXZ4CU5RaRktEe5/sM gxvrXThVkyFHOAFEFG8BbMW8kDy5XXNRnrscar7EF8Q0+pTChJWx/lKFZF1yJwdRkjFb fzCw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r5PAXhbJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6bb9c8e059fsi95330346d6.580.2024.08.05.11.07.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Aug 2024 11:07:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r5PAXhbJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sb26f-0005zo-PX; Mon, 05 Aug 2024 14:06: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 1sb26e-0005yP-E6 for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:06:52 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sb26Z-0006OJ-U0 for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:06:52 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-42122ac2f38so110375e9.1 for ; Mon, 05 Aug 2024 11:06:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722881206; x=1723486006; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MqeGnZInvHvb7oL2hFm59TF6/LgyPKhgLDZR7Hn5KKQ=; b=r5PAXhbJFwXxiz7JkIzg3tjW3ZCCAVjyECtGVqd5Y+aq6emGg89KIWgPIPEfr8HzAm tXJFd15jA7kG/g19MpA8GYrZJXRskmWsf+SFyM1RnTv6vAcKL8wDPXFMs/Rpd2Zv2YHe nnGzmj0mXNVOoAznjt8pblPlIvVdChp86h6X6O2wKZPjXK1iFZ0sYrrYerH8R66F7Bx8 e1TUIuSYzzdy5PbxxJ9C5GPf6kUeeinc2m8pHJFgONZbGbml4K8dfq6eZl+FpfJkCot1 HZm4gurUzJQfzPUTjOGPAANTtkVuBfU036rs0YrdgiSEUyOV+NI0YEVY989WzLScAUn9 k1Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722881206; x=1723486006; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MqeGnZInvHvb7oL2hFm59TF6/LgyPKhgLDZR7Hn5KKQ=; b=G0z2rQBM76dKGmgA43UOLy8/EoFIcZ0rw1wYumXOoGHOCrDJyFCtEUwHAt6VzBWmfP 6RExVHRTW0YRJuXl0ImfH6ymQ9LmLT/a3bajXplXPP8uG/HD9PZzED+vxHRDegmMzLnY MYeC1zP2Wm87UFWYRmlIxWGxnpKnozGBNeqofMjTl5gYEWp9k6E1HlS2BdUfUXbpFU06 2VYUtXPlqSJkH7bFUeQoqsiCQIjHMdo2sI/7GcamypvXwazfNljbyXa6LIUjaekSFnN7 b/vWzYb53PCUKTL02dpyg4wKf6oZDmjPEi/TqFZZfjJCZeLI6zjK+5UyM4+JMIXgCbN7 /7gg== X-Gm-Message-State: AOJu0YwLm2EJdF7qDYMFwVuQgEwe7rk6qUQ6S+FIvf3JP4iLFivSK35T bqrCFiAswu+WODmfxPTKyrPaqvhSdM4aB+Lgqnqf1SMamr9yM4QrTsSckmrwiBDTES4YrB73pWm l X-Received: by 2002:a05:600c:1c8b:b0:428:e820:37dc with SMTP id 5b1f17b1804b1-428e8203a6bmr94500865e9.7.1722881205614; Mon, 05 Aug 2024 11:06:45 -0700 (PDT) Received: from m1x-phil.lan (cor91-h02-176-184-30-206.dsl.sta.abo.bbox.fr. [176.184.30.206]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-428e6e01d0asm148028795e9.16.2024.08.05.11.06.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 05 Aug 2024 11:06:45 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Bibo Mao Cc: Song Gao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Jiaxun Yang Subject: [PATCH-for-9.1 v6 03/15] hw/intc/loongson_ipi: Add TYPE_LOONGSON_IPI_COMMON stub Date: Mon, 5 Aug 2024 20:06:10 +0200 Message-ID: <20240805180622.21001-4-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240805180622.21001-1-philmd@linaro.org> References: <20240805180622.21001-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bibo Mao Introduce LOONGSON_IPI_COMMON stubs, QDev parent of LOONGSON_IPI. Signed-off-by: Bibo Mao [PMD: Extracted from bigger commit, added commit description] Co-Developed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bibo Mao Tested-by: Bibo Mao Acked-by: Song Gao Reviewed-by: Richard Henderson Reviewed-by: Jiaxun Yang Tested-by: Jiaxun Yang Message-Id: <20240718133312.10324-7-philmd@linaro.org> --- MAINTAINERS | 4 ++++ include/hw/intc/loongson_ipi.h | 14 ++++++++++++-- include/hw/intc/loongson_ipi_common.h | 26 ++++++++++++++++++++++++++ hw/intc/loongson_ipi.c | 10 +++++++--- hw/intc/loongson_ipi_common.c | 22 ++++++++++++++++++++++ hw/intc/Kconfig | 4 ++++ hw/intc/meson.build | 1 + 7 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 include/hw/intc/loongson_ipi_common.h create mode 100644 hw/intc/loongson_ipi_common.c diff --git a/MAINTAINERS b/MAINTAINERS index e34c2bd4cd..5ca701cf0c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1250,8 +1250,10 @@ F: configs/devices/loongarch64-softmmu/default.mak F: hw/loongarch/ F: include/hw/loongarch/virt.h F: include/hw/intc/loongarch_*.h +F: include/hw/intc/loongson_ipi_common.h F: include/hw/intc/loongson_ipi.h F: hw/intc/loongarch_*.c +F: hw/intc/loongson_ipi_common.c F: hw/intc/loongson_ipi.c F: include/hw/pci-host/ls7a.h F: hw/rtc/ls7a_rtc.c @@ -1386,11 +1388,13 @@ Loongson-3 virtual platforms M: Huacai Chen R: Jiaxun Yang S: Maintained +F: hw/intc/loongson_ipi_common.c F: hw/intc/loongson_ipi.c F: hw/intc/loongson_liointc.c F: hw/mips/loongson3_bootp.c F: hw/mips/loongson3_bootp.h F: hw/mips/loongson3_virt.c +F: include/hw/intc/loongson_ipi_common.h F: include/hw/intc/loongson_ipi.h F: include/hw/intc/loongson_liointc.h F: tests/avocado/machine_mips_loongson3v.py diff --git a/include/hw/intc/loongson_ipi.h b/include/hw/intc/loongson_ipi.h index efb772f384..9c9030761e 100644 --- a/include/hw/intc/loongson_ipi.h +++ b/include/hw/intc/loongson_ipi.h @@ -8,6 +8,8 @@ #ifndef HW_LOONGSON_IPI_H #define HW_LOONGSON_IPI_H +#include "qom/object.h" +#include "hw/intc/loongson_ipi_common.h" #include "hw/sysbus.h" /* Mainy used by iocsr read and write */ @@ -31,7 +33,7 @@ #define IPI_MBX_NUM 4 #define TYPE_LOONGSON_IPI "loongson_ipi" -OBJECT_DECLARE_SIMPLE_TYPE(LoongsonIPIState, LOONGSON_IPI) +OBJECT_DECLARE_TYPE(LoongsonIPIState, LoongsonIPIClass, LOONGSON_IPI) typedef struct IPICore { LoongsonIPIState *ipi; @@ -45,8 +47,16 @@ typedef struct IPICore { qemu_irq irq; } IPICore; +struct LoongsonIPIClass { + LoongsonIPICommonClass parent_class; + + DeviceRealize parent_realize; + DeviceUnrealize parent_unrealize; +}; + struct LoongsonIPIState { - SysBusDevice parent_obj; + LoongsonIPICommonState parent_obj; + MemoryRegion ipi_iocsr_mem; MemoryRegion ipi64_iocsr_mem; uint32_t num_cpu; diff --git a/include/hw/intc/loongson_ipi_common.h b/include/hw/intc/loongson_ipi_common.h new file mode 100644 index 0000000000..70ac69d0ba --- /dev/null +++ b/include/hw/intc/loongson_ipi_common.h @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Loongson ipi interrupt header files + * + * Copyright (C) 2021 Loongson Technology Corporation Limited + */ + +#ifndef HW_LOONGSON_IPI_COMMON_H +#define HW_LOONGSON_IPI_COMMON_H + +#include "qom/object.h" +#include "hw/sysbus.h" + +#define TYPE_LOONGSON_IPI_COMMON "loongson_ipi_common" +OBJECT_DECLARE_TYPE(LoongsonIPICommonState, + LoongsonIPICommonClass, LOONGSON_IPI_COMMON) + +struct LoongsonIPICommonState { + SysBusDevice parent_obj; +}; + +struct LoongsonIPICommonClass { + SysBusDeviceClass parent_class; +}; + +#endif diff --git a/hw/intc/loongson_ipi.c b/hw/intc/loongson_ipi.c index 8aab7e48e8..7d15c28e94 100644 --- a/hw/intc/loongson_ipi.c +++ b/hw/intc/loongson_ipi.c @@ -374,9 +374,12 @@ static Property ipi_properties[] = { static void loongson_ipi_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); + LoongsonIPIClass *lic = LOONGSON_IPI_CLASS(klass); - dc->realize = loongson_ipi_realize; - dc->unrealize = loongson_ipi_unrealize; + device_class_set_parent_realize(dc, loongson_ipi_realize, + &lic->parent_realize); + device_class_set_parent_unrealize(dc, loongson_ipi_unrealize, + &lic->parent_unrealize); device_class_set_props(dc, ipi_properties); dc->vmsd = &vmstate_loongson_ipi; } @@ -384,8 +387,9 @@ static void loongson_ipi_class_init(ObjectClass *klass, void *data) static const TypeInfo loongson_ipi_types[] = { { .name = TYPE_LOONGSON_IPI, - .parent = TYPE_SYS_BUS_DEVICE, + .parent = TYPE_LOONGSON_IPI_COMMON, .instance_size = sizeof(LoongsonIPIState), + .class_size = sizeof(LoongsonIPIClass), .class_init = loongson_ipi_class_init, } }; diff --git a/hw/intc/loongson_ipi_common.c b/hw/intc/loongson_ipi_common.c new file mode 100644 index 0000000000..43002fe556 --- /dev/null +++ b/hw/intc/loongson_ipi_common.c @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Loongson IPI interrupt common support + * + * Copyright (C) 2021 Loongson Technology Corporation Limited + */ + +#include "qemu/osdep.h" +#include "hw/sysbus.h" +#include "hw/intc/loongson_ipi_common.h" + +static const TypeInfo loongarch_ipi_common_types[] = { + { + .name = TYPE_LOONGSON_IPI_COMMON, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(LoongsonIPICommonState), + .class_size = sizeof(LoongsonIPICommonClass), + .abstract = true, + } +}; + +DEFINE_TYPES(loongarch_ipi_common_types) diff --git a/hw/intc/Kconfig b/hw/intc/Kconfig index 58b6d3a710..a2a0fdca85 100644 --- a/hw/intc/Kconfig +++ b/hw/intc/Kconfig @@ -87,8 +87,12 @@ config GOLDFISH_PIC config M68K_IRQC bool +config LOONGSON_IPI_COMMON + bool + config LOONGSON_IPI bool + select LOONGSON_IPI_COMMON config LOONGARCH_PCH_PIC bool diff --git a/hw/intc/meson.build b/hw/intc/meson.build index afd1aa51ee..a09a527207 100644 --- a/hw/intc/meson.build +++ b/hw/intc/meson.build @@ -69,6 +69,7 @@ specific_ss.add(when: 'CONFIG_XIVE', if_true: files('xive.c')) specific_ss.add(when: ['CONFIG_KVM', 'CONFIG_XIVE'], if_true: files('spapr_xive_kvm.c')) specific_ss.add(when: 'CONFIG_M68K_IRQC', if_true: files('m68k_irqc.c')) +specific_ss.add(when: 'CONFIG_LOONGSON_IPI_COMMON', if_true: files('loongson_ipi_common.c')) specific_ss.add(when: 'CONFIG_LOONGSON_IPI', if_true: files('loongson_ipi.c')) specific_ss.add(when: 'CONFIG_LOONGARCH_PCH_PIC', if_true: files('loongarch_pch_pic.c')) specific_ss.add(when: 'CONFIG_LOONGARCH_PCH_MSI', if_true: files('loongarch_pch_msi.c')) From patchwork Mon Aug 5 18:06:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 816742 Delivered-To: patch@linaro.org Received: by 2002:adf:e00d:0:b0:367:895a:4699 with SMTP id s13csp1469789wrh; Mon, 5 Aug 2024 11:08:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXM1l2s7oL0iohq21KgyFh2TT2Wf1FtEHIydPBK04EJ16lPOFTQxIz1D45pZgPP6BqwAkKykxkGN2idrWrAYd6/ X-Google-Smtp-Source: AGHT+IHmzCBy9b3zr6wtUoNfIUbd58Sv9Hjp3HUfqvu8Svzis0hOooU0TOGhyf3i7SnVZlt5Y5tK X-Received: by 2002:a05:620a:4143:b0:79f:b72:fb30 with SMTP id af79cd13be357-7a34efc81ebmr1296818185a.59.1722881280588; Mon, 05 Aug 2024 11:08:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722881280; cv=none; d=google.com; s=arc-20160816; b=kcGFxgd71r2jRVQ65A22DaVR6KCz2d8b58tMkGDWM+YpL1fnD4sAOYcSic/bJOFeNz H67FXO6uxUbzn0beDNi4IMzlITTIq+XlB4VfGtizPGkpGdnMrPIIviPzqTrR8rmgASgh 28JPT93oGIGXtAUxIed7cIkVWjxRkyk5aIYXzXmwuDOM6yMohWomzBLcoyhXAFcvzDA5 wWftFme8yiEWBkxpOf64U9NBl0GCsB54XUfDDDExgYGv1MdPVOF9xVusj3/XLSiUKVQY 8wPj2nJsxUSx5UnB57dKbeFoH46tgG/r0LeSuXA+kS9Abe6AFiMH/wU/eejX5QD6W9nA PbFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tcvWw4VD2EULzwQDC9M8lg6CF9IpMcNlyvAmzky8oRU=; fh=9FIv2ryHyUdV0M0E/xImFOb7ha8RVmpB9WW8IcVSbKs=; b=rv2m1t8fp/yM8OoETVfV0VzFtAdDVV3TldGZx1SmD77zdS0RxCZxls5hTsbM0fapXO nJE8la93V2JQd0CzqU1aIkxNLShBotalggggjqfMrGEMC9uusg1zbwkCTyqCUdZBw2w8 3yYkftjD3tlUPoxMiZZgwnZ5aQ/G0xDDCp8S3H+XH4F1x5s7Re6yv41rvcskzzUFg0n/ FEvxpN+rnh5DucQglQ+Df8off2rh09etxVw9+eUGoCnaGHyUZesZfW0A8UPOU4R8CaND xN8Id5pbv1HYhyXFIxuyzmXa81rw3+g98dU69DKqWoqQm6J6PjlIcZ2gazD8a9cD1lnc tefQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mJwGhNpA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7a34f775b39si1057708885a.479.2024.08.05.11.08.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Aug 2024 11:08:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mJwGhNpA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sb26i-0006CN-Sp; Mon, 05 Aug 2024 14:06:56 -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 1sb26h-00065v-8M for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:06:55 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sb26f-0006OU-IX for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:06:54 -0400 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-36ba3b06186so3035450f8f.2 for ; Mon, 05 Aug 2024 11:06:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722881211; x=1723486011; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tcvWw4VD2EULzwQDC9M8lg6CF9IpMcNlyvAmzky8oRU=; b=mJwGhNpA2l5O3pbypFBkVsHPFaVWSMJCviMT7EU2bHEViyP5pOb2BM4Cj7k1aGxCX4 VN13tJ+SdtQfOqZe/M27bYt5G3WJc6XNJSXYzZM+dKJBZe3kLKvP8j8zR4trUA6uCj6z UwYVXop1myjGk0RxFmASWUiBfIgegfNXOgGIO46A6ygpWvbnZD+IL3drDm5ls0ki8PNL OAtI8AK4AVlz0mtGXJT4hXUQcxTazHlnDRfNhn0n9zN/f0/JX3H21Ba/ihDweLgatuGn VfOIfGI4tWkCnzu/9DJ/BplR+KjCLozvHokKoL8oJ7II7/ZAany7NlmAmRwpGHnJF9Id mPCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722881211; x=1723486011; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tcvWw4VD2EULzwQDC9M8lg6CF9IpMcNlyvAmzky8oRU=; b=Loh73YOQsvRiryM96b4Rp1E4NIwbJbuIGF7rlaPL2ABbOEJyRgacCjPCTy2O83TKfV 0NC/aYHufb2daDfSEX8ZXqSRqVdpoOwQ2PCuO8STKmiSIBB56GkpKjc4sMqxSqWhvzow QmBLeDACRXtwtoUMA2Ah4TI83Xius+8/CYNRhVQoIPEG3rdDEnS3vkBB5unCDIfBOUlw Vao7cK89v/Gu44fPRyiD4XUsUmUIkHGIsnCudtp8rC2b8CRVMx5++nqIG2vCuo2m0Z/d qHpEpByPxAHRkk2MAFDp08nb3uzqoqa1crk4Pt0NthdhN1mbkDv7k7UANspZbTnmZm+j wVyw== X-Gm-Message-State: AOJu0YwMB0O1R01k9K0c+8fxWXrPKDfM6g4DWC8GfQL3nOjJ5DuEbOd9 bKsnrIcsK5Q1ne8pocEq1TjLgtInO9bXiY5XW79OdRQ/wVWeQfaVyMrlCahXU1m0eS24k5QbD/x r X-Received: by 2002:a5d:4f11:0:b0:368:12ef:92d0 with SMTP id ffacd0b85a97d-36bbc1d2d8emr8952432f8f.51.1722881211600; Mon, 05 Aug 2024 11:06:51 -0700 (PDT) Received: from m1x-phil.lan (cor91-h02-176-184-30-206.dsl.sta.abo.bbox.fr. [176.184.30.206]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36bbd0597a7sm10684615f8f.75.2024.08.05.11.06.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 05 Aug 2024 11:06:51 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Bibo Mao Cc: Song Gao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Jiaxun Yang Subject: [PATCH-for-9.1 v6 04/15] hw/intc/loongson_ipi: Move common definitions to loongson_ipi_common.h Date: Mon, 5 Aug 2024 20:06:11 +0200 Message-ID: <20240805180622.21001-5-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240805180622.21001-1-philmd@linaro.org> References: <20240805180622.21001-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=philmd@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bibo Mao Signed-off-by: Bibo Mao [PMD: Extracted from bigger commit, added commit description] Co-Developed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bibo Mao Tested-by: Bibo Mao Acked-by: Song Gao Reviewed-by: Richard Henderson Reviewed-by: Jiaxun Yang Tested-by: Jiaxun Yang Message-Id: <20240718133312.10324-8-philmd@linaro.org> --- include/hw/intc/loongson_ipi.h | 18 ------------------ include/hw/intc/loongson_ipi_common.h | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/include/hw/intc/loongson_ipi.h b/include/hw/intc/loongson_ipi.h index 9c9030761e..70e00dc1a7 100644 --- a/include/hw/intc/loongson_ipi.h +++ b/include/hw/intc/loongson_ipi.h @@ -12,24 +12,6 @@ #include "hw/intc/loongson_ipi_common.h" #include "hw/sysbus.h" -/* Mainy used by iocsr read and write */ -#define SMP_IPI_MAILBOX 0x1000ULL -#define CORE_STATUS_OFF 0x0 -#define CORE_EN_OFF 0x4 -#define CORE_SET_OFF 0x8 -#define CORE_CLEAR_OFF 0xc -#define CORE_BUF_20 0x20 -#define CORE_BUF_28 0x28 -#define CORE_BUF_30 0x30 -#define CORE_BUF_38 0x38 -#define IOCSR_IPI_SEND 0x40 -#define IOCSR_MAIL_SEND 0x48 -#define IOCSR_ANY_SEND 0x158 - -#define MAIL_SEND_ADDR (SMP_IPI_MAILBOX + IOCSR_MAIL_SEND) -#define MAIL_SEND_OFFSET 0 -#define ANY_SEND_OFFSET (IOCSR_ANY_SEND - IOCSR_MAIL_SEND) - #define IPI_MBX_NUM 4 #define TYPE_LOONGSON_IPI "loongson_ipi" diff --git a/include/hw/intc/loongson_ipi_common.h b/include/hw/intc/loongson_ipi_common.h index 70ac69d0ba..b43b77bda6 100644 --- a/include/hw/intc/loongson_ipi_common.h +++ b/include/hw/intc/loongson_ipi_common.h @@ -23,4 +23,23 @@ struct LoongsonIPICommonClass { SysBusDeviceClass parent_class; }; +/* Mainy used by iocsr read and write */ +#define SMP_IPI_MAILBOX 0x1000ULL + +#define CORE_STATUS_OFF 0x0 +#define CORE_EN_OFF 0x4 +#define CORE_SET_OFF 0x8 +#define CORE_CLEAR_OFF 0xc +#define CORE_BUF_20 0x20 +#define CORE_BUF_28 0x28 +#define CORE_BUF_30 0x30 +#define CORE_BUF_38 0x38 +#define IOCSR_IPI_SEND 0x40 +#define IOCSR_MAIL_SEND 0x48 +#define IOCSR_ANY_SEND 0x158 + +#define MAIL_SEND_ADDR (SMP_IPI_MAILBOX + IOCSR_MAIL_SEND) +#define MAIL_SEND_OFFSET 0 +#define ANY_SEND_OFFSET (IOCSR_ANY_SEND - IOCSR_MAIL_SEND) + #endif From patchwork Mon Aug 5 18:06:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 816746 Delivered-To: patch@linaro.org Received: by 2002:adf:e00d:0:b0:367:895a:4699 with SMTP id s13csp1469966wrh; Mon, 5 Aug 2024 11:08:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXa7N1ry2KKAohNGgg1ABv+M9Ys6hTN7l5KbdKZrPRpaZMdQK6KyN4pCAAIipfX3Aj1SnueFs3wetIh6s4u12hf X-Google-Smtp-Source: AGHT+IEkI84Z/DhxV/O5io9vQ2ETsS/nx4rnAnYCAz2koGQxUmzQ25otr0z5MXWGjJEumoDGrbet X-Received: by 2002:a05:6808:148b:b0:3d9:e0b3:6d1d with SMTP id 5614622812f47-3db55849312mr15550242b6e.51.1722881304249; Mon, 05 Aug 2024 11:08:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722881304; cv=none; d=google.com; s=arc-20160816; b=HWmMcPs8dISm/knVwCX3KzRjN/i8uRa/ytlHd0pBVlScTNobMfTkijWBZVHOrpLp7A V/bOuThfRGyjH5j7fHwPJSqyFmbKcw0JrRBDX0TKnpKAAcNocPe9bm8yOiPCChSECA8l 6rrWTlneRjX50WBID47DzI+bCMBh83PSs1gCz1NGCU+qDkqhk/ng/9wHc9clVgLxUU5V Wl0zTYaG/mduUnbF84Vmpa5B/dh/eakoC15TV3rjTjBliHdKuA/73tEZA3CTMY+3SccP iwrMl1nv1x/RXxQogSfDuk0IC0fo25bAFW6DSJYlQV1lhkkq4n1YkYzGzAVPMgVZfDvK f70g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UiHMMAZSBCaFrOKQJaxByo1l7oxpgp4DVAjVwFZv5Rw=; fh=9FIv2ryHyUdV0M0E/xImFOb7ha8RVmpB9WW8IcVSbKs=; b=vDLgqMYueI/7Zk4dNODDRTXpJ84/1jjEhcs0GpVajjRwvSoXfsRbYNgnQaBkwWJUvZ dDB+zl3O5DM6+Yj2Hd4JMmbufh/66VLDA9OL+vU2/OPtY+IPPjrhWxiOFW2tdzl55cQx qX5WwIBzPyiuWRHnYs/UvJQfIHTkIaPjMBlRyhpogKf+cmIBPJNYUzFMZioMJ8HuTPwz 1j2FZACAylpP9vdneJXywAXgCdV6RxAqfuSY1D07MuBvBfxaqkCUcR8A/EkCzm9HbrAF pdYRDS366a1FfFpQ8uOiJX5PBxMETIGEuKaQJH2RvuwrBwkbAI4VF+PNEoUYxSXtXb2q VYXA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cCPQLLjJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4518a766bd4si95524831cf.355.2024.08.05.11.08.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Aug 2024 11:08:24 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cCPQLLjJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sb26w-0006gg-J6; Mon, 05 Aug 2024 14:07:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sb26p-0006PX-7K for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:07:04 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sb26n-0006On-51 for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:07:02 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-427fc97a88cso75608645e9.0 for ; Mon, 05 Aug 2024 11:06:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722881218; x=1723486018; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UiHMMAZSBCaFrOKQJaxByo1l7oxpgp4DVAjVwFZv5Rw=; b=cCPQLLjJrobU4it2HjgVBugtIaWTYf6f+1/646eiEMFBFzh06sspxCZzRf4V/I2Lif xa08suK4wgPAESJ2Hg18BRxmnM8hJvfahebqC7x+DGqxPia5QaTto7j1TEqAUoj4JAG4 YQGVZuSmE81INydvpo/R9BsTZZXwEiL1iyUsXqwD6mKeBovtH8Z4CeDmEtUosgrQKqZR 0S56/CK4hswWbeh4rfOUeQLZcxJv3ovTd909umeGMCsNr+SFmV3ES1JNTLnHbjRtV+Ty 5HyTQTMhrqKUpZFaPlPLsSEkbzfNAh4Zu93TOHFzw16zwUO658UjSQADqqjPx2mmshRP EhRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722881218; x=1723486018; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UiHMMAZSBCaFrOKQJaxByo1l7oxpgp4DVAjVwFZv5Rw=; b=RlMcaoUzU6c3TBR8BdcFwRTQTPtzRqn5KfOulXzeSbIKi7RAVD7eFnhooex/nXYfEb C9a4HnVxaV3XPLl9toxErvbJwyTU7hNmXsGmaxSYfLkOUcarQ55bsW7v2fQDbJlJV9W8 5yiEB4Q4Idfuo++GHYpQoWqfHobs10SClIDCKxU95tMAO3GWcfoZ8a0TfuW2yxYh50VZ qtvuBIsakFWtu9MX2Fer+NHySb5fMGstRnlS7qb7uA14AK+iRxBThd0orfWhImJibxST JxmYHjsqLyYA0p6LyRrlStuD675i0FuwHpMNbwnzs8Ch3e08MnbQ/QiRcav7cmrfizxL ByVQ== X-Gm-Message-State: AOJu0YzAP/QugUaLpxMOjPtGfTGQNS4uOa87FVKO0CpSHIG/ZZondfGa MC4DwGBAqf15JrmU5j9eBljwKSMKBSNdzwcFIqv5Zu51lz7tQCHMkFjyVFFq9jc0qlrgeR/fgr+ C X-Received: by 2002:a05:600c:4f4f:b0:428:eb6:2e73 with SMTP id 5b1f17b1804b1-428e6b7c989mr86361525e9.29.1722881218122; Mon, 05 Aug 2024 11:06:58 -0700 (PDT) Received: from m1x-phil.lan (cor91-h02-176-184-30-206.dsl.sta.abo.bbox.fr. [176.184.30.206]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-428e6e9d887sm148883495e9.43.2024.08.05.11.06.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 05 Aug 2024 11:06:57 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Bibo Mao Cc: Song Gao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Jiaxun Yang Subject: [PATCH-for-9.1 v6 05/15] hw/intc/loongson_ipi: Move IPICore::mmio_mem to LoongsonIPIState Date: Mon, 5 Aug 2024 20:06:12 +0200 Message-ID: <20240805180622.21001-6-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240805180622.21001-1-philmd@linaro.org> References: <20240805180622.21001-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bibo Mao It is easier to manage one array of MMIO MR rather than one per vCPU. Signed-off-by: Bibo Mao [PMD: Extracted from bigger commit, added commit description] Co-Developed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bibo Mao Tested-by: Bibo Mao Acked-by: Song Gao Reviewed-by: Richard Henderson Reviewed-by: Jiaxun Yang Tested-by: Jiaxun Yang Message-Id: <20240718133312.10324-9-philmd@linaro.org> --- include/hw/intc/loongson_ipi.h | 2 +- hw/intc/loongson_ipi.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/hw/intc/loongson_ipi.h b/include/hw/intc/loongson_ipi.h index 70e00dc1a7..5a52dfbf4d 100644 --- a/include/hw/intc/loongson_ipi.h +++ b/include/hw/intc/loongson_ipi.h @@ -19,7 +19,6 @@ OBJECT_DECLARE_TYPE(LoongsonIPIState, LoongsonIPIClass, LOONGSON_IPI) typedef struct IPICore { LoongsonIPIState *ipi; - MemoryRegion *ipi_mmio_mem; uint32_t status; uint32_t en; uint32_t set; @@ -39,6 +38,7 @@ struct LoongsonIPIClass { struct LoongsonIPIState { LoongsonIPICommonState parent_obj; + MemoryRegion *ipi_mmio_mem; MemoryRegion ipi_iocsr_mem; MemoryRegion ipi64_iocsr_mem; uint32_t num_cpu; diff --git a/hw/intc/loongson_ipi.c b/hw/intc/loongson_ipi.c index 7d15c28e94..03878b896f 100644 --- a/hw/intc/loongson_ipi.c +++ b/hw/intc/loongson_ipi.c @@ -320,12 +320,12 @@ static void loongson_ipi_realize(DeviceState *dev, Error **errp) return; } + s->ipi_mmio_mem = g_new0(MemoryRegion, s->num_cpu); for (unsigned i = 0; i < s->num_cpu; i++) { - s->cpu[i].ipi_mmio_mem = g_new0(MemoryRegion, 1); g_autofree char *name = g_strdup_printf("loongson_ipi_cpu%d_mmio", i); - memory_region_init_io(s->cpu[i].ipi_mmio_mem, OBJECT(dev), + memory_region_init_io(&s->ipi_mmio_mem[i], OBJECT(dev), &loongson_ipi_core_ops, &s->cpu[i], name, 0x48); - sysbus_init_mmio(sbd, s->cpu[i].ipi_mmio_mem); + sysbus_init_mmio(sbd, &s->ipi_mmio_mem[i]); } } @@ -338,6 +338,10 @@ static void loongson_ipi_common_unrealize(DeviceState *dev) static void loongson_ipi_unrealize(DeviceState *dev) { + LoongsonIPIState *s = LOONGSON_IPI(dev); + + g_free(s->ipi_mmio_mem); + loongson_ipi_common_unrealize(dev); } From patchwork Mon Aug 5 18:06:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 816745 Delivered-To: patch@linaro.org Received: by 2002:adf:e00d:0:b0:367:895a:4699 with SMTP id s13csp1469953wrh; Mon, 5 Aug 2024 11:08:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUuGKT96XZeuEnuygFKSbA5E5acWV2wgtnahhQp2HCAIJunGvIGV2xLOSUIq9Jb9/q0NVqP+t3YGww4vn2eYny9 X-Google-Smtp-Source: AGHT+IFFvmEz7VGiBVLTIKLxH+CQWMJnMxYpSjqqw/NuALoYdo3TxXPCT3PCvrqVIrDXlSrGh/QS X-Received: by 2002:a05:6808:1525:b0:3d9:3ded:1fc3 with SMTP id 5614622812f47-3db5580a527mr15279924b6e.17.1722881302572; Mon, 05 Aug 2024 11:08:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722881302; cv=none; d=google.com; s=arc-20160816; b=JeDIQc5mZtLEmoGOcGCn0sXu94K7PSDxy4cpMheO8f5spiZi5tcHfm0Iq5S7bubmKm Jy7MqlyLFR5vBuF9k7S0otlobLwJnW9r6XEwpcR7Ae5LbFyq7E4L71NG089Dg/0sREEp Dn7S1tQVn+VqTNVJ0hO5NxX09fI4tgvCzHwONKBKDbZ+IiSxp0OhnM/XU4pG+eaWtVe6 zRDnSNACikhG4ax9ZKmmpVlLa7rYkJyr9hTyDwfL+TxDJpyq3zwBRy7USyUHFQGS5ku9 8wn6hGCZXHm4C3TcDTZ8kxE62wTiNFm3TLpPnKafHt6SAQz8psEtmeOPDrq+3dwnPP6i MBMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BZWaQyKyexW3bnn4M8r/s9Z7AMSU2Vex5ont4FDielg=; fh=9FIv2ryHyUdV0M0E/xImFOb7ha8RVmpB9WW8IcVSbKs=; b=ugJKO0ROLay7R4h6rNxKrh75kKg3giTaMPGshOWRY5I7ZISPDsZ8JHTLn4bLrSSh9l YTVLLpRadfwIcMIY5aJnBtnCHpHkNx81YOT8y8MRLWGQcmK/PTn/xHnzL6X76Qjanc76 iQJTSERioFZ7hLumQMOAWyctEnko8ImJItli7Tv/jr1MxmiLJ4jwHSudNJz8x850y0eE TvBhbvt5/rQC4EzwnSKB0m+hi5SX2jl7AFuamLBGeNxAZ5JN8TNfkuD4WZ4fofCFfQ1O 1xTzPtPOm2lbfLX8gBuH6N+DvBk4b44XkYkmnI3CUoVtfp5XqJEQQpVIawoaGeetIlF9 hblw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jBXNXeFO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7a34f78b494si1045784585a.560.2024.08.05.11.08.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Aug 2024 11:08:22 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jBXNXeFO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sb26z-0006z9-Cb; Mon, 05 Aug 2024 14:07: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 1sb26u-0006da-QH for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:07:10 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sb26s-0006P2-Mz for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:07:08 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-428e0d18666so33815945e9.3 for ; Mon, 05 Aug 2024 11:07:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722881224; x=1723486024; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BZWaQyKyexW3bnn4M8r/s9Z7AMSU2Vex5ont4FDielg=; b=jBXNXeFOEhsa/F6X6nmT/SVmUlterKy0oVWzujWdJsHG/hDu0j96fQFp03LtV7dvjF qG4YgY7xPfOayIOZH/78Jj0sRfcVHyG5zvfxgIWLXOHBXSmVeLIo9ALXER080/l5YRC2 rnJ5o9PxWjw9+kPD3GVKXx36vsicjg8pRCbkURfJyaFGWTmeNVK7HJsq+t3L3097KOqS FJx5jHPkR0KAkLcYzyRthP0kl2B5laXpJQHkb5095mqAWXwfojb0ZeUNMEOVkEmgF/Fc txTrGwrbscLA2Ddu5YbWwcBOjnvAAdqLlttoAV1p5H+r0is1tE5kDnJshKFEl0WvC+L4 orcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722881224; x=1723486024; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BZWaQyKyexW3bnn4M8r/s9Z7AMSU2Vex5ont4FDielg=; b=XfzZLLLoah9ounDlsiEC7uAXfu+N84FC2/IwNzC7LGw7H9F20XgraC2ui9Na2PoRUv Ed5o6OW4qCISeprxjNbyvod2uC4wsGEEpEtXrrgDcjjJyvOC2epUaY8/4eIOVbmCNjZq wxRit6vtxXtUs5VEt1txb7IB/DcHc5wraSF/hQAdb34k0Ay0cvdAn28einBeVzgQamCr fX7M5Zf5SLHHVYvE4XfmP5QKwv8/UbH/j1sN9y6CJ6mlperXrbyrpYQ7Jq4pUoV3U5pu +kj1PfTk0gPr9hwbpOPxpI2VkBjmQjce9sXbNDrK8UmHYNbdFBDmhPo41lmkGwwszPzt 9B6Q== X-Gm-Message-State: AOJu0YzBUJhzLi2q6nhOx11pZ85rdPP0TTYfeoIK/Uey/vO56P9I5ybd Pau603jZ3rIKPNsyFc0ABwWF6FUbl6k96y0c2AXXMO+IYY8wgcRZyHIUcNNqN7aphaa0dzeOPkw a X-Received: by 2002:a05:600c:4746:b0:428:1799:35e3 with SMTP id 5b1f17b1804b1-428e6b2c884mr81053365e9.21.1722881224592; Mon, 05 Aug 2024 11:07:04 -0700 (PDT) Received: from m1x-phil.lan (cor91-h02-176-184-30-206.dsl.sta.abo.bbox.fr. [176.184.30.206]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4282b89aa86sm210627885e9.3.2024.08.05.11.07.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 05 Aug 2024 11:07:04 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Bibo Mao Cc: Song Gao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Jiaxun Yang Subject: [PATCH-for-9.1 v6 06/15] hw/intc/loongson_ipi: Move IPICore structure to loongson_ipi_common.h Date: Mon, 5 Aug 2024 20:06:13 +0200 Message-ID: <20240805180622.21001-7-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240805180622.21001-1-philmd@linaro.org> References: <20240805180622.21001-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bibo Mao Move the IPICore structure and corresponding common fields of LoongsonIPICommonState to "hw/intc/loongson_ipi_common.h". Signed-off-by: Bibo Mao [PMD: Extracted from bigger commit, added commit description] Co-Developed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bibo Mao Tested-by: Bibo Mao Acked-by: Song Gao Reviewed-by: Richard Henderson Reviewed-by: Jiaxun Yang Tested-by: Jiaxun Yang Message-Id: <20240718133312.10324-10-philmd@linaro.org> --- include/hw/intc/loongson_ipi.h | 17 --------- include/hw/intc/loongson_ipi_common.h | 18 ++++++++++ hw/intc/loongson_ipi.c | 50 ++++++--------------------- hw/intc/loongson_ipi_common.c | 42 ++++++++++++++++++++++ 4 files changed, 70 insertions(+), 57 deletions(-) diff --git a/include/hw/intc/loongson_ipi.h b/include/hw/intc/loongson_ipi.h index 5a52dfbf4d..4e517cc8dc 100644 --- a/include/hw/intc/loongson_ipi.h +++ b/include/hw/intc/loongson_ipi.h @@ -12,22 +12,9 @@ #include "hw/intc/loongson_ipi_common.h" #include "hw/sysbus.h" -#define IPI_MBX_NUM 4 - #define TYPE_LOONGSON_IPI "loongson_ipi" OBJECT_DECLARE_TYPE(LoongsonIPIState, LoongsonIPIClass, LOONGSON_IPI) -typedef struct IPICore { - LoongsonIPIState *ipi; - uint32_t status; - uint32_t en; - uint32_t set; - uint32_t clear; - /* 64bit buf divide into 2 32bit buf */ - uint32_t buf[IPI_MBX_NUM * 2]; - qemu_irq irq; -} IPICore; - struct LoongsonIPIClass { LoongsonIPICommonClass parent_class; @@ -39,10 +26,6 @@ struct LoongsonIPIState { LoongsonIPICommonState parent_obj; MemoryRegion *ipi_mmio_mem; - MemoryRegion ipi_iocsr_mem; - MemoryRegion ipi64_iocsr_mem; - uint32_t num_cpu; - IPICore *cpu; }; #endif diff --git a/include/hw/intc/loongson_ipi_common.h b/include/hw/intc/loongson_ipi_common.h index b43b77bda6..967c70ad1c 100644 --- a/include/hw/intc/loongson_ipi_common.h +++ b/include/hw/intc/loongson_ipi_common.h @@ -11,12 +11,30 @@ #include "qom/object.h" #include "hw/sysbus.h" +#define IPI_MBX_NUM 4 + #define TYPE_LOONGSON_IPI_COMMON "loongson_ipi_common" OBJECT_DECLARE_TYPE(LoongsonIPICommonState, LoongsonIPICommonClass, LOONGSON_IPI_COMMON) +typedef struct IPICore { + LoongsonIPICommonState *ipi; + uint32_t status; + uint32_t en; + uint32_t set; + uint32_t clear; + /* 64bit buf divide into 2 32-bit buf */ + uint32_t buf[IPI_MBX_NUM * 2]; + qemu_irq irq; +} IPICore; + struct LoongsonIPICommonState { SysBusDevice parent_obj; + + MemoryRegion ipi_iocsr_mem; + MemoryRegion ipi64_iocsr_mem; + uint32_t num_cpu; + IPICore *cpu; }; struct LoongsonIPICommonClass { diff --git a/hw/intc/loongson_ipi.c b/hw/intc/loongson_ipi.c index 03878b896f..347bc26729 100644 --- a/hw/intc/loongson_ipi.c +++ b/hw/intc/loongson_ipi.c @@ -64,7 +64,7 @@ static MemTxResult loongson_ipi_iocsr_readl(void *opaque, hwaddr addr, uint64_t *data, unsigned size, MemTxAttrs attrs) { - LoongsonIPIState *ipi = opaque; + LoongsonIPICommonState *ipi = opaque; IPICore *s; if (attrs.requester_id >= ipi->num_cpu) { @@ -160,7 +160,7 @@ static MemTxResult loongson_ipi_core_writel(void *opaque, hwaddr addr, MemTxAttrs attrs) { IPICore *s = opaque; - LoongsonIPIState *ipi = s->ipi; + LoongsonIPICommonState *ipi = s->ipi; int index = 0; uint32_t cpuid; uint8_t vector; @@ -214,7 +214,7 @@ static MemTxResult loongson_ipi_iocsr_writel(void *opaque, hwaddr addr, uint64_t val, unsigned size, MemTxAttrs attrs) { - LoongsonIPIState *ipi = opaque; + LoongsonIPICommonState *ipi = opaque; IPICore *s; if (attrs.requester_id >= ipi->num_cpu) { @@ -277,7 +277,7 @@ static const MemoryRegionOps loongson_ipi64_ops = { static void loongson_ipi_common_realize(DeviceState *dev, Error **errp) { - LoongsonIPIState *s = LOONGSON_IPI(dev); + LoongsonIPICommonState *s = LOONGSON_IPI_COMMON(dev); SysBusDevice *sbd = SYS_BUS_DEVICE(dev); int i; @@ -310,6 +310,7 @@ static void loongson_ipi_common_realize(DeviceState *dev, Error **errp) static void loongson_ipi_realize(DeviceState *dev, Error **errp) { + LoongsonIPICommonState *sc = LOONGSON_IPI_COMMON(dev); LoongsonIPIState *s = LOONGSON_IPI(dev); SysBusDevice *sbd = SYS_BUS_DEVICE(dev); Error *local_err = NULL; @@ -320,18 +321,19 @@ static void loongson_ipi_realize(DeviceState *dev, Error **errp) return; } - s->ipi_mmio_mem = g_new0(MemoryRegion, s->num_cpu); - for (unsigned i = 0; i < s->num_cpu; i++) { + s->ipi_mmio_mem = g_new0(MemoryRegion, sc->num_cpu); + for (unsigned i = 0; i < sc->num_cpu; i++) { g_autofree char *name = g_strdup_printf("loongson_ipi_cpu%d_mmio", i); + memory_region_init_io(&s->ipi_mmio_mem[i], OBJECT(dev), - &loongson_ipi_core_ops, &s->cpu[i], name, 0x48); + &loongson_ipi_core_ops, &sc->cpu[i], name, 0x48); sysbus_init_mmio(sbd, &s->ipi_mmio_mem[i]); } } static void loongson_ipi_common_unrealize(DeviceState *dev) { - LoongsonIPIState *s = LOONGSON_IPI(dev); + LoongsonIPICommonState *s = LOONGSON_IPI_COMMON(dev); g_free(s->cpu); } @@ -345,36 +347,6 @@ static void loongson_ipi_unrealize(DeviceState *dev) loongson_ipi_common_unrealize(dev); } -static const VMStateDescription vmstate_ipi_core = { - .name = "ipi-single", - .version_id = 2, - .minimum_version_id = 2, - .fields = (const VMStateField[]) { - VMSTATE_UINT32(status, IPICore), - VMSTATE_UINT32(en, IPICore), - VMSTATE_UINT32(set, IPICore), - VMSTATE_UINT32(clear, IPICore), - VMSTATE_UINT32_ARRAY(buf, IPICore, IPI_MBX_NUM * 2), - VMSTATE_END_OF_LIST() - } -}; - -static const VMStateDescription vmstate_loongson_ipi = { - .name = TYPE_LOONGSON_IPI, - .version_id = 2, - .minimum_version_id = 2, - .fields = (const VMStateField[]) { - VMSTATE_STRUCT_VARRAY_POINTER_UINT32(cpu, LoongsonIPIState, num_cpu, - vmstate_ipi_core, IPICore), - VMSTATE_END_OF_LIST() - } -}; - -static Property ipi_properties[] = { - DEFINE_PROP_UINT32("num-cpu", LoongsonIPIState, num_cpu, 1), - DEFINE_PROP_END_OF_LIST(), -}; - static void loongson_ipi_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); @@ -384,8 +356,6 @@ static void loongson_ipi_class_init(ObjectClass *klass, void *data) &lic->parent_realize); device_class_set_parent_unrealize(dc, loongson_ipi_unrealize, &lic->parent_unrealize); - device_class_set_props(dc, ipi_properties); - dc->vmsd = &vmstate_loongson_ipi; } static const TypeInfo loongson_ipi_types[] = { diff --git a/hw/intc/loongson_ipi_common.c b/hw/intc/loongson_ipi_common.c index 43002fe556..47796f7ece 100644 --- a/hw/intc/loongson_ipi_common.c +++ b/hw/intc/loongson_ipi_common.c @@ -8,6 +8,47 @@ #include "qemu/osdep.h" #include "hw/sysbus.h" #include "hw/intc/loongson_ipi_common.h" +#include "hw/qdev-properties.h" +#include "migration/vmstate.h" + +static const VMStateDescription vmstate_ipi_core = { + .name = "ipi-single", + .version_id = 2, + .minimum_version_id = 2, + .fields = (const VMStateField[]) { + VMSTATE_UINT32(status, IPICore), + VMSTATE_UINT32(en, IPICore), + VMSTATE_UINT32(set, IPICore), + VMSTATE_UINT32(clear, IPICore), + VMSTATE_UINT32_ARRAY(buf, IPICore, IPI_MBX_NUM * 2), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_loongson_ipi_common = { + .name = "loongson_ipi", + .version_id = 2, + .minimum_version_id = 2, + .fields = (const VMStateField[]) { + VMSTATE_STRUCT_VARRAY_POINTER_UINT32(cpu, LoongsonIPICommonState, + num_cpu, vmstate_ipi_core, + IPICore), + VMSTATE_END_OF_LIST() + } +}; + +static Property ipi_common_properties[] = { + DEFINE_PROP_UINT32("num-cpu", LoongsonIPICommonState, num_cpu, 1), + DEFINE_PROP_END_OF_LIST(), +}; + +static void loongson_ipi_common_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + device_class_set_props(dc, ipi_common_properties); + dc->vmsd = &vmstate_loongson_ipi_common; +} static const TypeInfo loongarch_ipi_common_types[] = { { @@ -15,6 +56,7 @@ static const TypeInfo loongarch_ipi_common_types[] = { .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(LoongsonIPICommonState), .class_size = sizeof(LoongsonIPICommonClass), + .class_init = loongson_ipi_common_class_init, .abstract = true, } }; From patchwork Mon Aug 5 18:06:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 816748 Delivered-To: patch@linaro.org Received: by 2002:adf:e00d:0:b0:367:895a:4699 with SMTP id s13csp1469968wrh; Mon, 5 Aug 2024 11:08:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWrqDXUWB3HttVc4GNwBHi+Bk0RSudg+CDurm/njru+HvSIrE1MgqdehlPpy8F3gEg61fIfJ8383jY1POCkuJhW X-Google-Smtp-Source: AGHT+IEKGIlizV1xq+y6sGnL0ZACTsY4cncwYH9lUpnlEgE7g4hQrRTiBHClZrMUASwNepv1+hge X-Received: by 2002:ac8:7d05:0:b0:44f:fe5b:d9c6 with SMTP id d75a77b69052e-4518934ad04mr162196891cf.56.1722881304420; Mon, 05 Aug 2024 11:08:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722881304; cv=none; d=google.com; s=arc-20160816; b=OV7NMtmpc6SgWH3hbgLa4zdN/zmPXOs73PPzVMIj6TdHSUTBN2AA9tBrC4Gnk7usaO +oSE17hlARL74uBJCMqMZiycvM8S3lJ+Ang1fncmTI056q7hrBKenrocOcD648VemhAf DZ+iGE448CDPourwDvXxWEpbQudzXEIG/gPeOCL+mpm0Apy2cuTqqpNYDiivYOLIvwkt UngafLEfv971Il/fxArUpOOQnvDDu5Ms8k7032EBiLP0ORRvdm+6j61qvizVNBcetRfX iwgHjzZsJ7JJQ7M+xAbkks3nfLczeQZoBZ/XJa4eme18YdljjJ4Zxc3bW8N7e9HIRPgL FpAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3YLnD1bvOSagZksuJngTTm11SWw5YIwVbzELXEazT0M=; fh=9FIv2ryHyUdV0M0E/xImFOb7ha8RVmpB9WW8IcVSbKs=; b=kE1W2qBiTPJKWxchrSnxmLe2eML06WmkSxwDbIQGMXW0svr2srpG6RwltNdoMzH64Y 5eAcptVjsdG6IxQ7ZiDGxK5Lxz7xmKipews3BJnq+V2BixCMwzT+2B7q8ZKWhuOzhxDg je53uOdiZhkO40hq2SbE086sr5e4YNQlvkBgSX4QAHfooYUW1DP4gsjWrWu0l4kQpKAk LK5NLkGkJUadEjD320WYvKR3KE5zqXH7Tc5rLmZED9Z0C6OQXQts5CPLJ9QUBNmbz7J8 vVn4oCM44sxq5FposYyZ2/JLtuoTQ5aXiPu520jgiYm0et/N24tmLKoAcaVjIjGn/7BG hIUg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QfjR9fNn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4518a6bf3d6si104972721cf.119.2024.08.05.11.08.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Aug 2024 11:08:24 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QfjR9fNn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sb271-00077r-H6; Mon, 05 Aug 2024 14:07: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 1sb270-000739-CF for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:07:14 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sb26y-0006PW-J0 for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:07:14 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-3684407b2deso5805145f8f.1 for ; Mon, 05 Aug 2024 11:07:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722881231; x=1723486031; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3YLnD1bvOSagZksuJngTTm11SWw5YIwVbzELXEazT0M=; b=QfjR9fNn2wtc6YoJbTsfAnh71LF6GXFykA5xlRn3L9uqYusU3d9aYiMQvkCzCQLq+p zDKHOQEw9yQepjEwhY2ICSV5SwYL+PIIEowfs99lyMbuwYpKfD4blDRp2Fjh62q1FQQ3 Eef3oY8K5OP3zhxSGEzB6oHyMTxASU9Gi1Yzaoo7GCIbrqgfWhnTw6QeecFXsyXTCDtX Qu9nls1D+tjxncnbncuXhLpMOG+BAlAuJPPxEqyN5B4Z/bxmr85ILT1c2S7nY03VmjiZ GKVTJ1zntDKywA7gT/M2CNnvV86vk7X7PFnphnT+eWodl2c+euPXkNcjJarmXdQJAkee nNhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722881231; x=1723486031; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3YLnD1bvOSagZksuJngTTm11SWw5YIwVbzELXEazT0M=; b=kWiSvpAyAq0fRkZwBWpHnQm4MrUZwaB0bAU2JA1Ltx/58coDxLJLDIAL9twkkXl9/e UDwReFYQKBtCHFz8FxIhwUUX8Y2ykEkPdjvmEzXC46nPPLOEwzFf//o9u7RG/Lek76cj +5f21dHClmKpTHsECskX5FEgXzVT7wAJdIq39C6p17TSBLlC8N2MQcmshi2tYO/3scie qv+KNt2sYS51h2HBP/bywdyyTgmewRvFh/mhly2NA/JpLRTNhHGAmbP7Ph62HwZGKkRu FswUzFUWIg8WpUAUWlBqVEv/DtaSEop12xitv86docQVqBSFs9hVfJPjNYMoC1jN++Ed FP0A== X-Gm-Message-State: AOJu0YyoztHnMCbjKQeQqqy5VHLaO2JXHk6BEnJschL2dmfeH4Mc5Zto onOYaTouTZmxBfw3ccHd2k3wWKH7JibwFL8UcFN4Luws0hoizTk9+U8Jki7knlZhVBw/gNYny+p 7 X-Received: by 2002:adf:fa02:0:b0:367:993e:874f with SMTP id ffacd0b85a97d-36bbc0ecfd1mr7877810f8f.34.1722881230676; Mon, 05 Aug 2024 11:07:10 -0700 (PDT) Received: from m1x-phil.lan (cor91-h02-176-184-30-206.dsl.sta.abo.bbox.fr. [176.184.30.206]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36bbd06e100sm10685978f8f.98.2024.08.05.11.07.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 05 Aug 2024 11:07:10 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Bibo Mao Cc: Song Gao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Jiaxun Yang Subject: [PATCH-for-9.1 v6 07/15] hw/intc/loongson_ipi: Pass LoongsonIPICommonState to send_ipi_data() Date: Mon, 5 Aug 2024 20:06:14 +0200 Message-ID: <20240805180622.21001-8-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240805180622.21001-1-philmd@linaro.org> References: <20240805180622.21001-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=philmd@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bibo Mao In order to get LoongsonIPICommonClass in send_ipi_data() in the next commit, propagate LoongsonIPICommonState. Signed-off-by: Bibo Mao [PMD: Extracted from bigger commit, added commit description] Co-Developed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bibo Mao Tested-by: Bibo Mao Acked-by: Song Gao Reviewed-by: Richard Henderson Reviewed-by: Jiaxun Yang Tested-by: Jiaxun Yang Message-Id: <20240718133312.10324-11-philmd@linaro.org> --- hw/intc/loongson_ipi.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/hw/intc/loongson_ipi.c b/hw/intc/loongson_ipi.c index 347bc26729..8bf16f26d4 100644 --- a/hw/intc/loongson_ipi.c +++ b/hw/intc/loongson_ipi.c @@ -88,8 +88,8 @@ static AddressSpace *get_cpu_iocsr_as(CPUState *cpu) return NULL; } -static MemTxResult send_ipi_data(CPUState *cpu, uint64_t val, hwaddr addr, - MemTxAttrs attrs) +static MemTxResult send_ipi_data(LoongsonIPICommonState *ipi, CPUState *cpu, + uint64_t val, hwaddr addr, MemTxAttrs attrs) { int i, mask = 0, data = 0; AddressSpace *iocsr_as = get_cpu_iocsr_as(cpu); @@ -119,7 +119,8 @@ static MemTxResult send_ipi_data(CPUState *cpu, uint64_t val, hwaddr addr, return MEMTX_OK; } -static MemTxResult mail_send(uint64_t val, MemTxAttrs attrs) +static MemTxResult mail_send(LoongsonIPICommonState *ipi, + uint64_t val, MemTxAttrs attrs) { uint32_t cpuid; hwaddr addr; @@ -134,10 +135,11 @@ static MemTxResult mail_send(uint64_t val, MemTxAttrs attrs) /* override requester_id */ addr = SMP_IPI_MAILBOX + CORE_BUF_20 + (val & 0x1c); attrs.requester_id = cs->cpu_index; - return send_ipi_data(cs, val, addr, attrs); + return send_ipi_data(ipi, cs, val, addr, attrs); } -static MemTxResult any_send(uint64_t val, MemTxAttrs attrs) +static MemTxResult any_send(LoongsonIPICommonState *ipi, + uint64_t val, MemTxAttrs attrs) { uint32_t cpuid; hwaddr addr; @@ -152,7 +154,7 @@ static MemTxResult any_send(uint64_t val, MemTxAttrs attrs) /* override requester_id */ addr = val & 0xffff; attrs.requester_id = cs->cpu_index; - return send_ipi_data(cs, val, addr, attrs); + return send_ipi_data(ipi, cs, val, addr, attrs); } static MemTxResult loongson_ipi_core_writel(void *opaque, hwaddr addr, @@ -249,15 +251,16 @@ static const MemoryRegionOps loongson_ipi_iocsr_ops = { static MemTxResult loongson_ipi_writeq(void *opaque, hwaddr addr, uint64_t val, unsigned size, MemTxAttrs attrs) { + LoongsonIPICommonState *ipi = opaque; MemTxResult ret = MEMTX_OK; addr &= 0xfff; switch (addr) { case MAIL_SEND_OFFSET: - ret = mail_send(val, attrs); + ret = mail_send(ipi, val, attrs); break; case ANY_SEND_OFFSET: - ret = any_send(val, attrs); + ret = any_send(ipi, val, attrs); break; default: break; From patchwork Mon Aug 5 18:06:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 816739 Delivered-To: patch@linaro.org Received: by 2002:adf:e00d:0:b0:367:895a:4699 with SMTP id s13csp1469780wrh; Mon, 5 Aug 2024 11:08:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUWd5X0YIxuUuE07hHqHsZmkxElwlelo+OOXEUDzhdeLIAiudRsgiUPkMG4KEtRtPNuNn5lmnrvUXoprAXYwQ8s X-Google-Smtp-Source: AGHT+IG5RjM2RxaO+KVD1mXo2xtH1iRPTMc3Oyj24wmFON65bFF154UY3NBA1VBo+0zv717Xibkj X-Received: by 2002:ac8:584e:0:b0:446:5a11:948 with SMTP id d75a77b69052e-4518921e4ecmr160700221cf.18.1722881279829; Mon, 05 Aug 2024 11:07:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722881279; cv=none; d=google.com; s=arc-20160816; b=AgdUCD2gHAkCqu+NbCRc0PgzTnLDcAKs5lSs+mCZHJ6Raug2Ikx5HGLwjIVJRiiOOR 2MThIaSaDfNdjatL9+n835hDM8BCNqjdDGRx7/TxsGYxc24B2Sp2DpORlXJiJJYIvVp+ JvYbcC46eNKM4W1yTWBrhWQZhXFBG6kTqSOK8RTI6ZPK8NuW13S6HCKSpq6SFpSViJqi SEX2Z6utVOw1cnHrQwSy/aPAxeNsJ9RukHyc97J42fr0Nx0PMOgfm2XjVfV4c5tQfegD FXjN4/9MbnLNoiIS4ph9lAl7S8olvn4bCFPHyjYRhQrwootaGlccvwWVT13bf+Tln1mv bAIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UhjqKVMOEvjprgDLvTe8v8tblCl0hjWaV3RiPalNFPQ=; fh=9FIv2ryHyUdV0M0E/xImFOb7ha8RVmpB9WW8IcVSbKs=; b=kCi+YndOi+dRRtdA3ZSIvp9SJDZ++moqiQ5nCeXPRDSRWqfTQRMoxTHKI+k39zz0L+ HTkoYWAtO+z83iod4SLhgth1iHhqqhsaCeUsEZt+t6ngqrKfiTq5Hg6XIeqf3bISANgs BjdwpOWfe7TZ9VBkXOrR3HOzFDqGXvNaelS6S4WRFTaP2uiHeVQmA71YgR4+4AFCCWLz ylI1LE9D/6anthscM+2qXCjJlOIesre6zB2ZzGdamUbBuSH86QWgbImKOeaUGuv466aD dIyWwCLwSZKnD6q0owKplg1DE1s7uCO3IREyAdsAVWcDP3FItBM6iu51DbxdoQ+wTbtO KheQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HK1glW2f; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4518a6be0e7si111874971cf.153.2024.08.05.11.07.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Aug 2024 11:07:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HK1glW2f; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sb279-0007ri-5a; Mon, 05 Aug 2024 14:07: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 1sb276-0007Z9-Gl for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:07:20 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sb274-0006Q0-P8 for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:07:20 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4266f3e0df8so70848145e9.2 for ; Mon, 05 Aug 2024 11:07:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722881237; x=1723486037; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UhjqKVMOEvjprgDLvTe8v8tblCl0hjWaV3RiPalNFPQ=; b=HK1glW2f/xpxfX6YsTS4znAtT7/MMw4Z3U49S5pDJfAqKTKAXrNlcaBLhuhdNr/4gX j3ZxIrGGvwjbQxO5OPcO/MOulKbodPD8byRS36yxxO480hf6jT+lqhs1z5/JxzsrtSa0 8kLj65catrML8E166PLlokhtHmbqVjuaSeB2k25gEuXndLOPR9fisgqVtrJawk/kHHGS FMEH/WWEx+gheNj5U+L+cVGCHA/m6kRD+16K08I2jK/MJHu2Tyfq/o4R+5eTiiFP9lwe xCwEQlTvHKEGTA+D+/qn71Wi8Xm921niD/gEuMGCJDWpKTN3oR4n+exiUHP8GFFoFRIt DfoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722881237; x=1723486037; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UhjqKVMOEvjprgDLvTe8v8tblCl0hjWaV3RiPalNFPQ=; b=PGaWpAiMvSQGBW5xUaN2suWLay2rrNWf0cwTto9CAJFJ74d7fkqAbAxDkfEgInEv17 QPQoK42k4Cusbe06P7rEHXAGRjNs497EvWAJIlFyKEa0eJxwuf3qszB/zqHs7D7KT47b LHm6S4OMXuN42018/g7yQPzFYNuN6CDk8/7lZWmwR7AAbalQ0hJ9I22M1Z27331xQ4Ix KIRQW2fxM7u2bEJWllRIvylmYwTFDRU1iAFE1lrnAbumjJQ9QFH+gZi8z21Udi3bC4I/ cSWEXK+HuvdchM0K3+eGxaLcqLVVw/651j5e/nTd7/sK8gEbTSmrqojvV6uMNN/aXhHm iFFA== X-Gm-Message-State: AOJu0Yy+8FN5Q3iLsfK7oJMnziMl5McOxgGOr3WU5w+8vO7/0BG8XzOT O+tjp32vrhYVvNG2LA3wH2IT0f4UxjyyYwO8uLsLfU0dvpfI5VcvnOU7jY021txeaJqwsaBPafC x X-Received: by 2002:a05:600c:4e8e:b0:426:654e:16d0 with SMTP id 5b1f17b1804b1-428e6a60397mr100328685e9.0.1722881236870; Mon, 05 Aug 2024 11:07:16 -0700 (PDT) Received: from m1x-phil.lan (cor91-h02-176-184-30-206.dsl.sta.abo.bbox.fr. [176.184.30.206]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36bbd01efe5sm10706635f8f.46.2024.08.05.11.07.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 05 Aug 2024 11:07:16 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Bibo Mao Cc: Song Gao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Jiaxun Yang Subject: [PATCH-for-9.1 v6 08/15] hw/intc/loongson_ipi: Add LoongsonIPICommonClass::get_iocsr_as handler Date: Mon, 5 Aug 2024 20:06:15 +0200 Message-ID: <20240805180622.21001-9-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240805180622.21001-1-philmd@linaro.org> References: <20240805180622.21001-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bibo Mao Allow Loongson IPI implementations to have their own get_iocsr_as() handler. Signed-off-by: Bibo Mao [PMD: Extracted from bigger commit, added commit description] Co-Developed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bibo Mao Tested-by: Bibo Mao Acked-by: Song Gao Reviewed-by: Richard Henderson Reviewed-by: Jiaxun Yang Tested-by: Jiaxun Yang Message-Id: <20240718133312.10324-12-philmd@linaro.org> --- include/hw/intc/loongson_ipi_common.h | 2 ++ hw/intc/loongson_ipi.c | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/hw/intc/loongson_ipi_common.h b/include/hw/intc/loongson_ipi_common.h index 967c70ad1c..1a2ee41cc9 100644 --- a/include/hw/intc/loongson_ipi_common.h +++ b/include/hw/intc/loongson_ipi_common.h @@ -39,6 +39,8 @@ struct LoongsonIPICommonState { struct LoongsonIPICommonClass { SysBusDeviceClass parent_class; + + AddressSpace *(*get_iocsr_as)(CPUState *cpu); }; /* Mainy used by iocsr read and write */ diff --git a/hw/intc/loongson_ipi.c b/hw/intc/loongson_ipi.c index 8bf16f26d4..eb99de9068 100644 --- a/hw/intc/loongson_ipi.c +++ b/hw/intc/loongson_ipi.c @@ -75,24 +75,30 @@ static MemTxResult loongson_ipi_iocsr_readl(void *opaque, hwaddr addr, return loongson_ipi_core_readl(s, addr, data, size, attrs); } -static AddressSpace *get_cpu_iocsr_as(CPUState *cpu) -{ #ifdef TARGET_LOONGARCH64 +static AddressSpace *get_iocsr_as(CPUState *cpu) +{ return LOONGARCH_CPU(cpu)->env.address_space_iocsr; +} #endif + #ifdef TARGET_MIPS +static AddressSpace *get_iocsr_as(CPUState *cpu) +{ if (ase_lcsr_available(&MIPS_CPU(cpu)->env)) { return &MIPS_CPU(cpu)->env.iocsr.as; } -#endif + return NULL; } +#endif static MemTxResult send_ipi_data(LoongsonIPICommonState *ipi, CPUState *cpu, uint64_t val, hwaddr addr, MemTxAttrs attrs) { + LoongsonIPICommonClass *licc = LOONGSON_IPI_COMMON_GET_CLASS(ipi); int i, mask = 0, data = 0; - AddressSpace *iocsr_as = get_cpu_iocsr_as(cpu); + AddressSpace *iocsr_as = licc->get_iocsr_as(cpu); if (!iocsr_as) { return MEMTX_DECODE_ERROR; @@ -354,11 +360,13 @@ static void loongson_ipi_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); LoongsonIPIClass *lic = LOONGSON_IPI_CLASS(klass); + LoongsonIPICommonClass *licc = LOONGSON_IPI_COMMON_CLASS(klass); device_class_set_parent_realize(dc, loongson_ipi_realize, &lic->parent_realize); device_class_set_parent_unrealize(dc, loongson_ipi_unrealize, &lic->parent_unrealize); + licc->get_iocsr_as = get_iocsr_as; } static const TypeInfo loongson_ipi_types[] = { From patchwork Mon Aug 5 18:06:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 816740 Delivered-To: patch@linaro.org Received: by 2002:adf:e00d:0:b0:367:895a:4699 with SMTP id s13csp1469782wrh; Mon, 5 Aug 2024 11:08:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXiCVC32mP+l547aErsto7NWnIriz9b/jvlQy57b4rylbL4qovFTVjApD6Xu+AQLVHlHcR8xmF0GZyPwOZJEyhI X-Google-Smtp-Source: AGHT+IGz0CbHOuNhjrFBELzjuZMBprT3bdT46FKYoiwGxbKG/ro4abcEnkVMwWm7/Wq/yf6EWf9T X-Received: by 2002:a05:620a:178f:b0:7a2:d64:14ff with SMTP id af79cd13be357-7a34eec29c9mr1581427985a.9.1722881280105; Mon, 05 Aug 2024 11:08:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722881280; cv=none; d=google.com; s=arc-20160816; b=fm3+T3tHSIUXdmnnBMhDqSoODY6zBKBNmNg0mruKqWe28ecqy/lfgVJ5E37XoKW1es e8mj075egd2RbL/d81SwtEmwTdqW5ccR+tryB5BmhEpRTNoDXLyrTDmMVUhGiY/2VGVS ru+WWVcYJ/4wCxtzEi77tNphrKd9SaCBvzTWyXjIXT30iPn/0HDHcj47XIiGz5e4hUXz gfNv+p0jRYDU1CRL4UOpu2xwwRLRyjvK0zs/wVNzHMRRL7fu5qFMPsGagx47W8QHZ8HC S20EyQnLfmWgxBE+u0yN40MqzALuRkPQBvp7e0gnFkVdyWQm+Ih1ENBGd0P/notPVyJa 0TMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TWI9WsLINkzAsWulOrb1N3N13JevfSw6Gy6N0mmyEKk=; fh=9FIv2ryHyUdV0M0E/xImFOb7ha8RVmpB9WW8IcVSbKs=; b=R1I8xzFyWPgMcIN8r2W61tbPN67RO4gPzl9Q3dBezIzewkk68jBdO5LSNKU13pdWvy rH4jZkInOuHRxmCypr2Uz7WgkEAIub906pWXG1g5qxW+CmT5ztqSb+Pavbgr/SWTwqoE 8YozJQz3jtl+xnMC0Fk4EWIBnYWIzaAbG3zMYWGrDlhktgNTEzGzXT1/Ft+dCyGzD+QO ZVntBKg4KDIXMwq1K91rILF6mUwlUofLsMMCsac+Shh6/CM6oZI2cdWpnIsOG0OUfy+K 1Gw6pwJN2QGk6TwW43OIOsXC0Ncts8fQJKuGy8WFGNmjJZxA1PU0ndSnhZIwdRWB2mXm hnLQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fHrTqtHX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7a34f74b541si1008094985a.262.2024.08.05.11.07.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Aug 2024 11:08:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fHrTqtHX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sb27F-0000RP-2i; Mon, 05 Aug 2024 14:07: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 1sb27E-0000H2-09 for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:07:28 -0400 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sb27C-0006QN-0U for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:07:27 -0400 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2f1798eaee6so18244461fa.0 for ; Mon, 05 Aug 2024 11:07:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722881244; x=1723486044; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TWI9WsLINkzAsWulOrb1N3N13JevfSw6Gy6N0mmyEKk=; b=fHrTqtHXd2ZcTORlSrRbkbNjor9biQl4Ff0C5gJky1QVXZo47A9fCXVuVAa8l2Q0U6 fR/BOuAE8hw2Uec+j14I4cFQVXeZSXEnL5jPcjMbfmeqKl4t6LTk6OHzBrsVVPVItHCV ffPkVhiy19aesTRilUjw6QvXY8YSL9kHcIkeaHYKrKLsnkaT8NQZKQn/vYf9sODRO9Gc OgO2iLm+OZh+v0tzGVTGz8jo65n7tnBDeQI4ZdZYdK5i5zKLLveMZVPjTxCmKRV8nTQl 826LGFp759bmaDuFLyLRD1HYtZUzVPCYCCWtJ7pRCiTncJd3K7nlc2Ctn7TiA8GWiw3C XxuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722881244; x=1723486044; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TWI9WsLINkzAsWulOrb1N3N13JevfSw6Gy6N0mmyEKk=; b=HPF2DaUJwwig4TvRL8miwFrFaOS2fB4uMoZyTwMa3CNlHao3QAFBk+vyeiIykEahyl Jn0iNPfWP5xQnuw/PcP1iJUaiUxWHFvR7YjAVpn4LC2qMSEOQoHdu5ZtTEc+DYvIiwht KcZhfnGLHNIvBjp/0sWheCP06f3G3EjEgEYfJd1dv62pnUI3a6n7YykKpph2Tp1zScxy x7wgVYHYFiJHE6OHhtu+qziV4iygmMpT+vv/d+K2nSu59aM6S14CvxIRjatIb09im+El 5nM3XK0E9sunUbLs3BbqD8dT2TfYZqGPCPOdRShVyVGBD/pFgeAoY3o4oaOMwRBDdLwS 9DbQ== X-Gm-Message-State: AOJu0YyjXQ2jh+UZZlW2gC1cPGtKarvYbY4alqgMtwAaKPLLuQzedWDj 9B7xaM8kXb9ENHGTgdEpDQsDHwu/Fzg4xgzIdy3ySQ4EzEm2XlBRGHIJSNJqVhB+/6j5dkZqBf4 g X-Received: by 2002:a2e:9b58:0:b0:2ed:5c34:4082 with SMTP id 38308e7fff4ca-2f15aa8354emr81576271fa.8.1722881243507; Mon, 05 Aug 2024 11:07:23 -0700 (PDT) Received: from m1x-phil.lan (cor91-h02-176-184-30-206.dsl.sta.abo.bbox.fr. [176.184.30.206]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36bbd059841sm10737504f8f.89.2024.08.05.11.07.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 05 Aug 2024 11:07:22 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Bibo Mao Cc: Song Gao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Jiaxun Yang Subject: [PATCH-for-9.1 v6 09/15] hw/intc/loongson_ipi: Add LoongsonIPICommonClass::cpu_by_arch_id handler Date: Mon, 5 Aug 2024 20:06:16 +0200 Message-ID: <20240805180622.21001-10-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240805180622.21001-1-philmd@linaro.org> References: <20240805180622.21001-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22b; envelope-from=philmd@linaro.org; helo=mail-lj1-x22b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bibo Mao Allow Loongson IPI implementations to have their own cpu_by_arch_id() handler. Signed-off-by: Bibo Mao [PMD: Extracted from bigger commit, added commit description] Co-Developed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bibo Mao Tested-by: Bibo Mao Acked-by: Song Gao Reviewed-by: Richard Henderson Reviewed-by: Jiaxun Yang Tested-by: Jiaxun Yang Message-Id: <20240718133312.10324-13-philmd@linaro.org> --- include/hw/intc/loongson_ipi_common.h | 1 + hw/intc/loongson_ipi.c | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/hw/intc/loongson_ipi_common.h b/include/hw/intc/loongson_ipi_common.h index 1a2ee41cc9..8997676f0d 100644 --- a/include/hw/intc/loongson_ipi_common.h +++ b/include/hw/intc/loongson_ipi_common.h @@ -41,6 +41,7 @@ struct LoongsonIPICommonClass { SysBusDeviceClass parent_class; AddressSpace *(*get_iocsr_as)(CPUState *cpu); + CPUState *(*cpu_by_arch_id)(int64_t id); }; /* Mainy used by iocsr read and write */ diff --git a/hw/intc/loongson_ipi.c b/hw/intc/loongson_ipi.c index eb99de9068..4a8e743528 100644 --- a/hw/intc/loongson_ipi.c +++ b/hw/intc/loongson_ipi.c @@ -128,12 +128,13 @@ static MemTxResult send_ipi_data(LoongsonIPICommonState *ipi, CPUState *cpu, static MemTxResult mail_send(LoongsonIPICommonState *ipi, uint64_t val, MemTxAttrs attrs) { + LoongsonIPICommonClass *licc = LOONGSON_IPI_COMMON_GET_CLASS(ipi); uint32_t cpuid; hwaddr addr; CPUState *cs; cpuid = extract32(val, 16, 10); - cs = cpu_by_arch_id(cpuid); + cs = licc->cpu_by_arch_id(cpuid); if (cs == NULL) { return MEMTX_DECODE_ERROR; } @@ -147,12 +148,13 @@ static MemTxResult mail_send(LoongsonIPICommonState *ipi, static MemTxResult any_send(LoongsonIPICommonState *ipi, uint64_t val, MemTxAttrs attrs) { + LoongsonIPICommonClass *licc = LOONGSON_IPI_COMMON_GET_CLASS(ipi); uint32_t cpuid; hwaddr addr; CPUState *cs; cpuid = extract32(val, 16, 10); - cs = cpu_by_arch_id(cpuid); + cs = licc->cpu_by_arch_id(cpuid); if (cs == NULL) { return MEMTX_DECODE_ERROR; } @@ -169,6 +171,7 @@ static MemTxResult loongson_ipi_core_writel(void *opaque, hwaddr addr, { IPICore *s = opaque; LoongsonIPICommonState *ipi = s->ipi; + LoongsonIPICommonClass *licc = LOONGSON_IPI_COMMON_GET_CLASS(ipi); int index = 0; uint32_t cpuid; uint8_t vector; @@ -203,7 +206,7 @@ static MemTxResult loongson_ipi_core_writel(void *opaque, hwaddr addr, cpuid = extract32(val, 16, 10); /* IPI status vector */ vector = extract8(val, 0, 5); - cs = cpu_by_arch_id(cpuid); + cs = licc->cpu_by_arch_id(cpuid); if (cs == NULL || cs->cpu_index >= ipi->num_cpu) { return MEMTX_DECODE_ERROR; } @@ -367,6 +370,7 @@ static void loongson_ipi_class_init(ObjectClass *klass, void *data) device_class_set_parent_unrealize(dc, loongson_ipi_unrealize, &lic->parent_unrealize); licc->get_iocsr_as = get_iocsr_as; + licc->cpu_by_arch_id = cpu_by_arch_id; } static const TypeInfo loongson_ipi_types[] = { From patchwork Mon Aug 5 18:06:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 816749 Delivered-To: patch@linaro.org Received: by 2002:adf:e00d:0:b0:367:895a:4699 with SMTP id s13csp1469987wrh; Mon, 5 Aug 2024 11:08:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVQU9Bbg8qwcrOE2/a1V5M+Qq/aa/PLreijh0pfHrrGaa8c1R444K83ZE3MI0AZ7xaOaGQJFLbsySi3WyjmtIw3 X-Google-Smtp-Source: AGHT+IGjjqWTH7O7vjrlEcgYOwvOTb9WdgzYY41pnae1AXYzxTETJeiBCyD7UMzHHuDURuQV4dMf X-Received: by 2002:a05:622a:341:b0:441:3bf6:d5cb with SMTP id d75a77b69052e-451892766ecmr150450811cf.6.1722881306410; Mon, 05 Aug 2024 11:08:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722881306; cv=none; d=google.com; s=arc-20160816; b=oK7lqIB3qfZVxRkG48F2qxfSuD06QGCm4Qv+Jd7opEutq5JG1+C7iyiRYGW+OV7K+B YYFd/i4z2AVNZhRp5h0QwYaMogMRFq/t5xpnnD2pIdT6308y2Oe8TR2EiRxG68Lf7p8n xZAxZbkQaP4001uBk+RulTly0roeb7hfAihSPWbHJ6i2q8Mr37U418I2bGe784ROoorq vy7ZdIGkuy8qr3qgHKLUHmII+pHfzsuxbbQlYEoyb4r+y5sKq5fXMxYXJO6q9Hq/4VXV /eC3MurX3gYjCgngpY7eqZ56GCRcvPr82Zjt0sQs3rM9hNzKFDh4kbrS323o6la0Skxv xThA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gYMjdBet7Yoml5axNQCgjfc0S4lBa+FajRuNH3b5IpI=; fh=9FIv2ryHyUdV0M0E/xImFOb7ha8RVmpB9WW8IcVSbKs=; b=tADCfyT6idC2lwV3h0uJHJp7ZoQE/F8ypOGUyLp/7ZuPOYCi+lkJ+CCofAlR/UsAs5 k3RHOcnoE/qFkX2zzFocGdCc8BaRu67lygPYlAv6htUR2O4gFcXoJQGBgfA5sLAVmpeF Wwd8/XTJZW464SRyF5+BOctoSWadG0oRk38b0QlojDC3lMXP2jF+0nKXQbs70r8f7UjQ ZM34ldY2ZSjma2urCRSx/A5ERXOnGBweEOSRYaY6xXnNchxYxF45eYLdH2YLes6ff3tG nv+/Dh0gO3AVtfFNIHt6w/OKDX1LlF8GGI4P38Qx3fQGv9DZqIVLi0YR1xEpaQc9O8SM dZzQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KQDvBtnP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4518a762708si94765521cf.375.2024.08.05.11.08.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Aug 2024 11:08:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KQDvBtnP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sb27L-0001JA-7a; Mon, 05 Aug 2024 14:07: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 1sb27K-0001F9-2A for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:07:34 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sb27H-0006QZ-W4 for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:07:33 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-428085a3ad1so75676485e9.1 for ; Mon, 05 Aug 2024 11:07:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722881250; x=1723486050; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gYMjdBet7Yoml5axNQCgjfc0S4lBa+FajRuNH3b5IpI=; b=KQDvBtnPnZRFgE+feZpLHPBY17UPbzeabHuyKljZYfldxYWZByuJdWUa3Kwtk9pwZz to4aizFDZXbY0As6K1vM9w7larkYHHJEZeR2hwRfCMTNdtNDmBSzSYWvVkgNxpt39r6J N5w1fu/WRj4fXqcZPrySXGWaa+BHsT+0c+dHvxSWFKSxc9MyunvHKhYGdEBzovYWaQK7 Y+HCHLbxp7AKukSNvBLCY4ImxtiZjQ+22DH+NBuzoPKdHCb24RpiTD8pO2J/tvAxLOVM Zs9tuFv3bSiFBGc3vuOR+XrZRvLRM/5cHCtuw+FkigglY13zCJr21WqvMvL/O7cyvayB UvlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722881250; x=1723486050; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gYMjdBet7Yoml5axNQCgjfc0S4lBa+FajRuNH3b5IpI=; b=TdMCC08MAErMBIS5Ie4MNMYZIaWom1hRdc75PltNTzPYK25pPVLV5+Jcu0Thqvc+nu ZDKGdY09G78WOyEoVizmVravxtOyenh0RKqb/l40kXV/KJX9O6DWFTYQV9Khte2aiTEc R3H5DwvAjBS5Z4LDprWeEpyOeg4Der7T1T3otEV94he0Iduuh0NU1JgsNeCiG13tTkSH z8V9MU7TwXgQw8r/mHBDH+BiJ0Vg0/JB+w/Z2+BCWfRfv9GqFiuzlIQDHoAi5myOcjjL OGFCrp/ElXZ/An4QiBJ8yWJjvSw4FrqZtlV8RVqHzGZfKm/ZIGwJQDGEQMEW3fdB7a3E QjyA== X-Gm-Message-State: AOJu0YyeT1ceQPaWVQCnKpM/cCVrlx6JCQ6qOb9eR7sTkiFCMkdWj3Ti eCkAajqpgzU0vyJpm8x8faZhiaTzDax972zp+LBhRO6kBs6LMJykBfZpkNCDiDwfbDXFYkCN+2V O X-Received: by 2002:a05:600c:5393:b0:428:1090:cfd4 with SMTP id 5b1f17b1804b1-428e6b83437mr81893475e9.33.1722881249959; Mon, 05 Aug 2024 11:07:29 -0700 (PDT) Received: from m1x-phil.lan (cor91-h02-176-184-30-206.dsl.sta.abo.bbox.fr. [176.184.30.206]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4282bb64b84sm208585055e9.32.2024.08.05.11.07.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 05 Aug 2024 11:07:29 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Bibo Mao Cc: Song Gao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Jiaxun Yang Subject: [PATCH-for-9.1 v6 10/15] hw/intc/loongson_ipi: Expose loongson_ipi_core_read/write helpers Date: Mon, 5 Aug 2024 20:06:17 +0200 Message-ID: <20240805180622.21001-11-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240805180622.21001-1-philmd@linaro.org> References: <20240805180622.21001-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bibo Mao In order to access loongson_ipi_core_read/write helpers from loongson_ipi_common.c in the next commit, make their prototype declaration public. Signed-off-by: Bibo Mao [PMD: Extracted from bigger commit, added commit description] Co-Developed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bibo Mao Tested-by: Bibo Mao Acked-by: Song Gao Reviewed-by: Richard Henderson Reviewed-by: Jiaxun Yang Tested-by: Jiaxun Yang Message-Id: <20240718133312.10324-14-philmd@linaro.org> --- include/hw/intc/loongson_ipi_common.h | 6 ++++++ hw/intc/loongson_ipi.c | 10 ++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/hw/intc/loongson_ipi_common.h b/include/hw/intc/loongson_ipi_common.h index 8997676f0d..65f8ef7957 100644 --- a/include/hw/intc/loongson_ipi_common.h +++ b/include/hw/intc/loongson_ipi_common.h @@ -10,6 +10,7 @@ #include "qom/object.h" #include "hw/sysbus.h" +#include "exec/memattrs.h" #define IPI_MBX_NUM 4 @@ -44,6 +45,11 @@ struct LoongsonIPICommonClass { CPUState *(*cpu_by_arch_id)(int64_t id); }; +MemTxResult loongson_ipi_core_readl(void *opaque, hwaddr addr, uint64_t *data, + unsigned size, MemTxAttrs attrs); +MemTxResult loongson_ipi_core_writel(void *opaque, hwaddr addr, uint64_t val, + unsigned size, MemTxAttrs attrs); + /* Mainy used by iocsr read and write */ #define SMP_IPI_MAILBOX 0x1000ULL diff --git a/hw/intc/loongson_ipi.c b/hw/intc/loongson_ipi.c index 4a8e743528..c13cb5a1d2 100644 --- a/hw/intc/loongson_ipi.c +++ b/hw/intc/loongson_ipi.c @@ -24,9 +24,8 @@ #endif #include "trace.h" -static MemTxResult loongson_ipi_core_readl(void *opaque, hwaddr addr, - uint64_t *data, - unsigned size, MemTxAttrs attrs) +MemTxResult loongson_ipi_core_readl(void *opaque, hwaddr addr, uint64_t *data, + unsigned size, MemTxAttrs attrs) { IPICore *s = opaque; uint64_t ret = 0; @@ -165,9 +164,8 @@ static MemTxResult any_send(LoongsonIPICommonState *ipi, return send_ipi_data(ipi, cs, val, addr, attrs); } -static MemTxResult loongson_ipi_core_writel(void *opaque, hwaddr addr, - uint64_t val, unsigned size, - MemTxAttrs attrs) +MemTxResult loongson_ipi_core_writel(void *opaque, hwaddr addr, uint64_t val, + unsigned size, MemTxAttrs attrs) { IPICore *s = opaque; LoongsonIPICommonState *ipi = s->ipi; From patchwork Mon Aug 5 18:06:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 816738 Delivered-To: patch@linaro.org Received: by 2002:adf:e00d:0:b0:367:895a:4699 with SMTP id s13csp1469764wrh; Mon, 5 Aug 2024 11:07:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWe1XaQQDzCg8xQXqFEjuIamGczIaDifPtea/1ym4yRYQq1o/6vNBM/k3ym2bfsaQCvi1Bz8suZBarNr+Qn1WFc X-Google-Smtp-Source: AGHT+IEhjCFHYU5jm0JLLjdTFCeuI1jpfObQBOidBTmZp7Y3wQQaRh3cyTWBu7+YMV+mLJVpPVPV X-Received: by 2002:a05:620a:240d:b0:7a2:d64:1bbf with SMTP id af79cd13be357-7a34eec99d9mr1891679185a.1.1722881277854; Mon, 05 Aug 2024 11:07:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722881277; cv=none; d=google.com; s=arc-20160816; b=NnrQEzLDwpz4sK0iOtqtA0Fg35rVK1Lkztt/M6V8zLVQbQsR2u3wVmT6Y2Da0M35cD zdPihWDe8hV4V0Td98fUrdtyy+Sft/0NO9+iPUnE/wHJnfWQCvBb/0bhlJMaOT3EirSR udayMOFvMLcC45fsUgnNG9i6+g1+XTo3qoQDKnVt9lMBbv55c7KwRlOOBR8GRinnG5Mb 6Lsjk4DRALIF+SfV8/120qSD+h+0AL+Eb17Tiu0h5ibqvuEGXu3YFDt9BlVPVbLX4XEQ Nq9mBdBuTcGjxqkC3V9BCiqU46VlKW2Ai8q1wNhOfmPRr+Umv06J/C5g06qMziIjMWMP sDNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=h7zzfsyH8hpupEvyekVMZ1KlQlyQgufOUifldcUuFfY=; fh=9FIv2ryHyUdV0M0E/xImFOb7ha8RVmpB9WW8IcVSbKs=; b=ouPOuCjH0e/aZ7mTdSj6AQI4zRfH0xLsjEOUOKSEeD+sAF4lx9YREyUhK2BVzSd/Qe SpzrRYFcWqegHSbvecrQPgtHS8FfarQMTV2hB1YQUTTa8X0j26v1ZiJPw8ZfAiElEsrn 7YeoR7Mt5I/zfgjVJyatW7ZQ112McdtMy0x6ybPNh4ttQJRgb6EidE8ZtjvFz8DNWA8f PZkFjwLImOWE+f6MQLFpuuQydfLdHxEgH6uMfAxHXO4OgNUb9CIj7j37wjNWgjQBUs9c U0o6qUUs4HgRyy+XPumyk4RsR0fR8qGOCkXLTAK55G2/OdRRaS5UIf8vz5FvxIDXh40f XshQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fOm0M2MB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7a34f7758c5si1032185585a.422.2024.08.05.11.07.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Aug 2024 11:07:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fOm0M2MB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sb27T-0002Df-Fx; Mon, 05 Aug 2024 14:07:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sb27R-000273-Mg for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:07:41 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sb27O-0006Qj-G0 for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:07:41 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4280bbdad3dso73349695e9.0 for ; Mon, 05 Aug 2024 11:07:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722881256; x=1723486056; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=h7zzfsyH8hpupEvyekVMZ1KlQlyQgufOUifldcUuFfY=; b=fOm0M2MBMVjC4AFM8RylXcb/4T0oY80tVqjZovVz7Qp1bLldaoBcGn9b2uimwZuGkS 4au8vZh0Y351BAz+tTHO67pXm0QLM+SGaA3dl+yZXX24PF+4NLHy3uQJtgSmAkU2rIAG 3e2nvTewuqq327QbD3HLT73Rk5a7XGXA50vcBlAVrIoqty7ybR3ptNXMe8ScAlm4jmI9 htVeigvMLl5970c3Qgk1nwoP6la3TRpEC3TAF2BsfCEP7qpkRbvNXGmnwTxi63dWh7b6 iV4HI9gxdlqxcRRfyw6u0VbuDjukRMoTPkpb5F328LYsiLHV8u3K4H51rfJpYP7NV07H IwYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722881256; x=1723486056; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=h7zzfsyH8hpupEvyekVMZ1KlQlyQgufOUifldcUuFfY=; b=xNl7sAObvOFJJPvh0WO0eQGTTH7fKv/5GUYO33fGcdYcKbd+azN831vkZLXle91vSC lsC19KvcHdqmB0X7eCUeoRKA3PDyBgKRkKv42kzA9nDHJ1pEPEmUafbQlmZMnIJ4KitS WzChMmGSU11O7gxSHFs2v1kXhI28m8rSOfY8xjONMTP9AxXNjTiAwS0OemcYC7YcLwmc V/Yr/+X/n9XBl9IJO6xQ5G2kxlB25T4aVX6u8SjVWQ8xMZbcj6UMw3honTOgTzYAK02z H/kdWv3bt4eVvwyR8t7NUJTTQoEsxmmmflac80H29Si42xyPgxw5kD1aPncAPaKW+oj8 g7mg== X-Gm-Message-State: AOJu0YwRirs08ZYhQ5eDXVsOixympJop4LrF9uanYgpi5txRCNDr+To+ xgsfeIWtEH7DypKcuX9xQrH9RYGILz768FeBbh8j6PZ4P4TQyLl1CwHU6K2VYCYvAJTUDQ+NTB0 W X-Received: by 2002:a5d:6b10:0:b0:368:4634:c419 with SMTP id ffacd0b85a97d-36bbc17e2bcmr8600002f8f.58.1722881256106; Mon, 05 Aug 2024 11:07:36 -0700 (PDT) Received: from m1x-phil.lan (cor91-h02-176-184-30-206.dsl.sta.abo.bbox.fr. [176.184.30.206]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36bbd06e100sm10687024f8f.98.2024.08.05.11.07.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 05 Aug 2024 11:07:35 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Bibo Mao Cc: Song Gao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Jiaxun Yang Subject: [PATCH-for-9.1 v6 11/15] hw/intc/loongson_ipi: Move common code to loongson_ipi_common.c Date: Mon, 5 Aug 2024 20:06:18 +0200 Message-ID: <20240805180622.21001-12-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240805180622.21001-1-philmd@linaro.org> References: <20240805180622.21001-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bibo Mao Move the common code from loongson_ipi.c to loongson_ipi_common.c, call parent_realize() instead of loongson_ipi_common_realize() in loongson_ipi_realize(). Signed-off-by: Bibo Mao [PMD: Extracted from bigger commit, added commit description] Co-Developed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bibo Mao Tested-by: Bibo Mao Acked-by: Song Gao Reviewed-by: Richard Henderson Reviewed-by: Jiaxun Yang Tested-by: Jiaxun Yang Message-Id: <20240718133312.10324-15-philmd@linaro.org> --- include/hw/intc/loongson_ipi_common.h | 2 + hw/intc/loongson_ipi.c | 279 +------------------------ hw/intc/loongson_ipi_common.c | 283 ++++++++++++++++++++++++++ 3 files changed, 289 insertions(+), 275 deletions(-) diff --git a/include/hw/intc/loongson_ipi_common.h b/include/hw/intc/loongson_ipi_common.h index 65f8ef7957..df9d9c5168 100644 --- a/include/hw/intc/loongson_ipi_common.h +++ b/include/hw/intc/loongson_ipi_common.h @@ -41,6 +41,8 @@ struct LoongsonIPICommonState { struct LoongsonIPICommonClass { SysBusDeviceClass parent_class; + DeviceRealize parent_realize; + DeviceUnrealize parent_unrealize; AddressSpace *(*get_iocsr_as)(CPUState *cpu); CPUState *(*cpu_by_arch_id)(int64_t id); }; diff --git a/hw/intc/loongson_ipi.c b/hw/intc/loongson_ipi.c index c13cb5a1d2..0b88ae3230 100644 --- a/hw/intc/loongson_ipi.c +++ b/hw/intc/loongson_ipi.c @@ -24,56 +24,6 @@ #endif #include "trace.h" -MemTxResult loongson_ipi_core_readl(void *opaque, hwaddr addr, uint64_t *data, - unsigned size, MemTxAttrs attrs) -{ - IPICore *s = opaque; - uint64_t ret = 0; - int index = 0; - - addr &= 0xff; - switch (addr) { - case CORE_STATUS_OFF: - ret = s->status; - break; - case CORE_EN_OFF: - ret = s->en; - break; - case CORE_SET_OFF: - ret = 0; - break; - case CORE_CLEAR_OFF: - ret = 0; - break; - case CORE_BUF_20 ... CORE_BUF_38 + 4: - index = (addr - CORE_BUF_20) >> 2; - ret = s->buf[index]; - break; - default: - qemu_log_mask(LOG_UNIMP, "invalid read: %x", (uint32_t)addr); - break; - } - - trace_loongson_ipi_read(size, (uint64_t)addr, ret); - *data = ret; - return MEMTX_OK; -} - -static MemTxResult loongson_ipi_iocsr_readl(void *opaque, hwaddr addr, - uint64_t *data, - unsigned size, MemTxAttrs attrs) -{ - LoongsonIPICommonState *ipi = opaque; - IPICore *s; - - if (attrs.requester_id >= ipi->num_cpu) { - return MEMTX_DECODE_ERROR; - } - - s = &ipi->cpu[attrs.requester_id]; - return loongson_ipi_core_readl(s, addr, data, size, attrs); -} - #ifdef TARGET_LOONGARCH64 static AddressSpace *get_iocsr_as(CPUState *cpu) { @@ -92,148 +42,6 @@ static AddressSpace *get_iocsr_as(CPUState *cpu) } #endif -static MemTxResult send_ipi_data(LoongsonIPICommonState *ipi, CPUState *cpu, - uint64_t val, hwaddr addr, MemTxAttrs attrs) -{ - LoongsonIPICommonClass *licc = LOONGSON_IPI_COMMON_GET_CLASS(ipi); - int i, mask = 0, data = 0; - AddressSpace *iocsr_as = licc->get_iocsr_as(cpu); - - if (!iocsr_as) { - return MEMTX_DECODE_ERROR; - } - - /* - * bit 27-30 is mask for byte writing, - * if the mask is 0, we need not to do anything. - */ - if ((val >> 27) & 0xf) { - data = address_space_ldl_le(iocsr_as, addr, attrs, NULL); - for (i = 0; i < 4; i++) { - /* get mask for byte writing */ - if (val & (0x1 << (27 + i))) { - mask |= 0xff << (i * 8); - } - } - } - - data &= mask; - data |= (val >> 32) & ~mask; - address_space_stl_le(iocsr_as, addr, data, attrs, NULL); - - return MEMTX_OK; -} - -static MemTxResult mail_send(LoongsonIPICommonState *ipi, - uint64_t val, MemTxAttrs attrs) -{ - LoongsonIPICommonClass *licc = LOONGSON_IPI_COMMON_GET_CLASS(ipi); - uint32_t cpuid; - hwaddr addr; - CPUState *cs; - - cpuid = extract32(val, 16, 10); - cs = licc->cpu_by_arch_id(cpuid); - if (cs == NULL) { - return MEMTX_DECODE_ERROR; - } - - /* override requester_id */ - addr = SMP_IPI_MAILBOX + CORE_BUF_20 + (val & 0x1c); - attrs.requester_id = cs->cpu_index; - return send_ipi_data(ipi, cs, val, addr, attrs); -} - -static MemTxResult any_send(LoongsonIPICommonState *ipi, - uint64_t val, MemTxAttrs attrs) -{ - LoongsonIPICommonClass *licc = LOONGSON_IPI_COMMON_GET_CLASS(ipi); - uint32_t cpuid; - hwaddr addr; - CPUState *cs; - - cpuid = extract32(val, 16, 10); - cs = licc->cpu_by_arch_id(cpuid); - if (cs == NULL) { - return MEMTX_DECODE_ERROR; - } - - /* override requester_id */ - addr = val & 0xffff; - attrs.requester_id = cs->cpu_index; - return send_ipi_data(ipi, cs, val, addr, attrs); -} - -MemTxResult loongson_ipi_core_writel(void *opaque, hwaddr addr, uint64_t val, - unsigned size, MemTxAttrs attrs) -{ - IPICore *s = opaque; - LoongsonIPICommonState *ipi = s->ipi; - LoongsonIPICommonClass *licc = LOONGSON_IPI_COMMON_GET_CLASS(ipi); - int index = 0; - uint32_t cpuid; - uint8_t vector; - CPUState *cs; - - addr &= 0xff; - trace_loongson_ipi_write(size, (uint64_t)addr, val); - switch (addr) { - case CORE_STATUS_OFF: - qemu_log_mask(LOG_GUEST_ERROR, "can not be written"); - break; - case CORE_EN_OFF: - s->en = val; - break; - case CORE_SET_OFF: - s->status |= val; - if (s->status != 0 && (s->status & s->en) != 0) { - qemu_irq_raise(s->irq); - } - break; - case CORE_CLEAR_OFF: - s->status &= ~val; - if (s->status == 0 && s->en != 0) { - qemu_irq_lower(s->irq); - } - break; - case CORE_BUF_20 ... CORE_BUF_38 + 4: - index = (addr - CORE_BUF_20) >> 2; - s->buf[index] = val; - break; - case IOCSR_IPI_SEND: - cpuid = extract32(val, 16, 10); - /* IPI status vector */ - vector = extract8(val, 0, 5); - cs = licc->cpu_by_arch_id(cpuid); - if (cs == NULL || cs->cpu_index >= ipi->num_cpu) { - return MEMTX_DECODE_ERROR; - } - loongson_ipi_core_writel(&ipi->cpu[cs->cpu_index], CORE_SET_OFF, - BIT(vector), 4, attrs); - break; - default: - qemu_log_mask(LOG_UNIMP, "invalid write: %x", (uint32_t)addr); - break; - } - - return MEMTX_OK; -} - -static MemTxResult loongson_ipi_iocsr_writel(void *opaque, hwaddr addr, - uint64_t val, unsigned size, - MemTxAttrs attrs) -{ - LoongsonIPICommonState *ipi = opaque; - IPICore *s; - - if (attrs.requester_id >= ipi->num_cpu) { - return MEMTX_DECODE_ERROR; - } - - s = &ipi->cpu[attrs.requester_id]; - return loongson_ipi_core_writel(s, addr, val, size, attrs); -} - static const MemoryRegionOps loongson_ipi_core_ops = { .read_with_attrs = loongson_ipi_core_readl, .write_with_attrs = loongson_ipi_core_writel, @@ -244,88 +52,15 @@ static const MemoryRegionOps loongson_ipi_core_ops = { .endianness = DEVICE_LITTLE_ENDIAN, }; -static const MemoryRegionOps loongson_ipi_iocsr_ops = { - .read_with_attrs = loongson_ipi_iocsr_readl, - .write_with_attrs = loongson_ipi_iocsr_writel, - .impl.min_access_size = 4, - .impl.max_access_size = 4, - .valid.min_access_size = 4, - .valid.max_access_size = 8, - .endianness = DEVICE_LITTLE_ENDIAN, -}; - -/* mail send and any send only support writeq */ -static MemTxResult loongson_ipi_writeq(void *opaque, hwaddr addr, uint64_t val, - unsigned size, MemTxAttrs attrs) -{ - LoongsonIPICommonState *ipi = opaque; - MemTxResult ret = MEMTX_OK; - - addr &= 0xfff; - switch (addr) { - case MAIL_SEND_OFFSET: - ret = mail_send(ipi, val, attrs); - break; - case ANY_SEND_OFFSET: - ret = any_send(ipi, val, attrs); - break; - default: - break; - } - - return ret; -} - -static const MemoryRegionOps loongson_ipi64_ops = { - .write_with_attrs = loongson_ipi_writeq, - .impl.min_access_size = 8, - .impl.max_access_size = 8, - .valid.min_access_size = 8, - .valid.max_access_size = 8, - .endianness = DEVICE_LITTLE_ENDIAN, -}; - -static void loongson_ipi_common_realize(DeviceState *dev, Error **errp) -{ - LoongsonIPICommonState *s = LOONGSON_IPI_COMMON(dev); - SysBusDevice *sbd = SYS_BUS_DEVICE(dev); - int i; - - if (s->num_cpu == 0) { - error_setg(errp, "num-cpu must be at least 1"); - return; - } - - memory_region_init_io(&s->ipi_iocsr_mem, OBJECT(dev), - &loongson_ipi_iocsr_ops, - s, "loongson_ipi_iocsr", 0x48); - - /* loongson_ipi_iocsr performs re-entrant IO through ipi_send */ - s->ipi_iocsr_mem.disable_reentrancy_guard = true; - - sysbus_init_mmio(sbd, &s->ipi_iocsr_mem); - - memory_region_init_io(&s->ipi64_iocsr_mem, OBJECT(dev), - &loongson_ipi64_ops, - s, "loongson_ipi64_iocsr", 0x118); - sysbus_init_mmio(sbd, &s->ipi64_iocsr_mem); - - s->cpu = g_new0(IPICore, s->num_cpu); - for (i = 0; i < s->num_cpu; i++) { - s->cpu[i].ipi = s; - - qdev_init_gpio_out(dev, &s->cpu[i].irq, 1); - } -} - static void loongson_ipi_realize(DeviceState *dev, Error **errp) { LoongsonIPICommonState *sc = LOONGSON_IPI_COMMON(dev); LoongsonIPIState *s = LOONGSON_IPI(dev); + LoongsonIPIClass *lic = LOONGSON_IPI_GET_CLASS(dev); SysBusDevice *sbd = SYS_BUS_DEVICE(dev); Error *local_err = NULL; - loongson_ipi_common_realize(dev, &local_err); + lic->parent_realize(dev, &local_err); if (local_err) { error_propagate(errp, local_err); return; @@ -341,20 +76,14 @@ static void loongson_ipi_realize(DeviceState *dev, Error **errp) } } -static void loongson_ipi_common_unrealize(DeviceState *dev) -{ - LoongsonIPICommonState *s = LOONGSON_IPI_COMMON(dev); - - g_free(s->cpu); -} - static void loongson_ipi_unrealize(DeviceState *dev) { LoongsonIPIState *s = LOONGSON_IPI(dev); + LoongsonIPIClass *k = LOONGSON_IPI_GET_CLASS(dev); g_free(s->ipi_mmio_mem); - loongson_ipi_common_unrealize(dev); + k->parent_unrealize(dev); } static void loongson_ipi_class_init(ObjectClass *klass, void *data) diff --git a/hw/intc/loongson_ipi_common.c b/hw/intc/loongson_ipi_common.c index 47796f7ece..a6ce0181f6 100644 --- a/hw/intc/loongson_ipi_common.c +++ b/hw/intc/loongson_ipi_common.c @@ -8,8 +8,286 @@ #include "qemu/osdep.h" #include "hw/sysbus.h" #include "hw/intc/loongson_ipi_common.h" +#include "hw/irq.h" #include "hw/qdev-properties.h" +#include "qapi/error.h" +#include "qemu/log.h" #include "migration/vmstate.h" +#include "trace.h" + +MemTxResult loongson_ipi_core_readl(void *opaque, hwaddr addr, uint64_t *data, + unsigned size, MemTxAttrs attrs) +{ + IPICore *s = opaque; + uint64_t ret = 0; + int index = 0; + + addr &= 0xff; + switch (addr) { + case CORE_STATUS_OFF: + ret = s->status; + break; + case CORE_EN_OFF: + ret = s->en; + break; + case CORE_SET_OFF: + ret = 0; + break; + case CORE_CLEAR_OFF: + ret = 0; + break; + case CORE_BUF_20 ... CORE_BUF_38 + 4: + index = (addr - CORE_BUF_20) >> 2; + ret = s->buf[index]; + break; + default: + qemu_log_mask(LOG_UNIMP, "invalid read: %x", (uint32_t)addr); + break; + } + + trace_loongson_ipi_read(size, (uint64_t)addr, ret); + *data = ret; + + return MEMTX_OK; +} + +static MemTxResult loongson_ipi_iocsr_readl(void *opaque, hwaddr addr, + uint64_t *data, unsigned size, + MemTxAttrs attrs) +{ + LoongsonIPICommonState *ipi = opaque; + IPICore *s; + + if (attrs.requester_id >= ipi->num_cpu) { + return MEMTX_DECODE_ERROR; + } + + s = &ipi->cpu[attrs.requester_id]; + return loongson_ipi_core_readl(s, addr, data, size, attrs); +} + +static MemTxResult send_ipi_data(LoongsonIPICommonState *ipi, CPUState *cpu, + uint64_t val, hwaddr addr, MemTxAttrs attrs) +{ + LoongsonIPICommonClass *licc = LOONGSON_IPI_COMMON_GET_CLASS(ipi); + int i, mask = 0, data = 0; + AddressSpace *iocsr_as = licc->get_iocsr_as(cpu); + + if (!iocsr_as) { + return MEMTX_DECODE_ERROR; + } + + /* + * bit 27-30 is mask for byte writing, + * if the mask is 0, we need not to do anything. + */ + if ((val >> 27) & 0xf) { + data = address_space_ldl_le(iocsr_as, addr, attrs, NULL); + for (i = 0; i < 4; i++) { + /* get mask for byte writing */ + if (val & (0x1 << (27 + i))) { + mask |= 0xff << (i * 8); + } + } + } + + data &= mask; + data |= (val >> 32) & ~mask; + address_space_stl_le(iocsr_as, addr, data, attrs, NULL); + + return MEMTX_OK; +} + +static MemTxResult mail_send(LoongsonIPICommonState *ipi, + uint64_t val, MemTxAttrs attrs) +{ + LoongsonIPICommonClass *licc = LOONGSON_IPI_COMMON_GET_CLASS(ipi); + uint32_t cpuid; + hwaddr addr; + CPUState *cs; + + cpuid = extract32(val, 16, 10); + cs = licc->cpu_by_arch_id(cpuid); + if (cs == NULL) { + return MEMTX_DECODE_ERROR; + } + + /* override requester_id */ + addr = SMP_IPI_MAILBOX + CORE_BUF_20 + (val & 0x1c); + attrs.requester_id = cs->cpu_index; + return send_ipi_data(ipi, cs, val, addr, attrs); +} + +static MemTxResult any_send(LoongsonIPICommonState *ipi, + uint64_t val, MemTxAttrs attrs) +{ + LoongsonIPICommonClass *licc = LOONGSON_IPI_COMMON_GET_CLASS(ipi); + uint32_t cpuid; + hwaddr addr; + CPUState *cs; + + cpuid = extract32(val, 16, 10); + cs = licc->cpu_by_arch_id(cpuid); + if (cs == NULL) { + return MEMTX_DECODE_ERROR; + } + + /* override requester_id */ + addr = val & 0xffff; + attrs.requester_id = cs->cpu_index; + return send_ipi_data(ipi, cs, val, addr, attrs); +} + +MemTxResult loongson_ipi_core_writel(void *opaque, hwaddr addr, uint64_t val, + unsigned size, MemTxAttrs attrs) +{ + IPICore *s = opaque; + LoongsonIPICommonState *ipi = s->ipi; + LoongsonIPICommonClass *licc = LOONGSON_IPI_COMMON_GET_CLASS(ipi); + int index = 0; + uint32_t cpuid; + uint8_t vector; + CPUState *cs; + + addr &= 0xff; + trace_loongson_ipi_write(size, (uint64_t)addr, val); + switch (addr) { + case CORE_STATUS_OFF: + qemu_log_mask(LOG_GUEST_ERROR, "can not be written"); + break; + case CORE_EN_OFF: + s->en = val; + break; + case CORE_SET_OFF: + s->status |= val; + if (s->status != 0 && (s->status & s->en) != 0) { + qemu_irq_raise(s->irq); + } + break; + case CORE_CLEAR_OFF: + s->status &= ~val; + if (s->status == 0 && s->en != 0) { + qemu_irq_lower(s->irq); + } + break; + case CORE_BUF_20 ... CORE_BUF_38 + 4: + index = (addr - CORE_BUF_20) >> 2; + s->buf[index] = val; + break; + case IOCSR_IPI_SEND: + cpuid = extract32(val, 16, 10); + /* IPI status vector */ + vector = extract8(val, 0, 5); + cs = licc->cpu_by_arch_id(cpuid); + if (cs == NULL || cs->cpu_index >= ipi->num_cpu) { + return MEMTX_DECODE_ERROR; + } + loongson_ipi_core_writel(&ipi->cpu[cs->cpu_index], CORE_SET_OFF, + BIT(vector), 4, attrs); + break; + default: + qemu_log_mask(LOG_UNIMP, "invalid write: %x", (uint32_t)addr); + break; + } + + return MEMTX_OK; +} + +static MemTxResult loongson_ipi_iocsr_writel(void *opaque, hwaddr addr, + uint64_t val, unsigned size, + MemTxAttrs attrs) +{ + LoongsonIPICommonState *ipi = opaque; + IPICore *s; + + if (attrs.requester_id >= ipi->num_cpu) { + return MEMTX_DECODE_ERROR; + } + + s = &ipi->cpu[attrs.requester_id]; + return loongson_ipi_core_writel(s, addr, val, size, attrs); +} + +static const MemoryRegionOps loongson_ipi_iocsr_ops = { + .read_with_attrs = loongson_ipi_iocsr_readl, + .write_with_attrs = loongson_ipi_iocsr_writel, + .impl.min_access_size = 4, + .impl.max_access_size = 4, + .valid.min_access_size = 4, + .valid.max_access_size = 8, + .endianness = DEVICE_LITTLE_ENDIAN, +}; + +/* mail send and any send only support writeq */ +static MemTxResult loongson_ipi_writeq(void *opaque, hwaddr addr, uint64_t val, + unsigned size, MemTxAttrs attrs) +{ + LoongsonIPICommonState *ipi = opaque; + MemTxResult ret = MEMTX_OK; + + addr &= 0xfff; + switch (addr) { + case MAIL_SEND_OFFSET: + ret = mail_send(ipi, val, attrs); + break; + case ANY_SEND_OFFSET: + ret = any_send(ipi, val, attrs); + break; + default: + break; + } + + return ret; +} + +static const MemoryRegionOps loongson_ipi64_ops = { + .write_with_attrs = loongson_ipi_writeq, + .impl.min_access_size = 8, + .impl.max_access_size = 8, + .valid.min_access_size = 8, + .valid.max_access_size = 8, + .endianness = DEVICE_LITTLE_ENDIAN, +}; + +static void loongson_ipi_common_realize(DeviceState *dev, Error **errp) +{ + LoongsonIPICommonState *s = LOONGSON_IPI_COMMON(dev); + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); + int i; + + if (s->num_cpu == 0) { + error_setg(errp, "num-cpu must be at least 1"); + return; + } + + memory_region_init_io(&s->ipi_iocsr_mem, OBJECT(dev), + &loongson_ipi_iocsr_ops, + s, "loongson_ipi_iocsr", 0x48); + + /* loongson_ipi_iocsr performs re-entrant IO through ipi_send */ + s->ipi_iocsr_mem.disable_reentrancy_guard = true; + + sysbus_init_mmio(sbd, &s->ipi_iocsr_mem); + + memory_region_init_io(&s->ipi64_iocsr_mem, OBJECT(dev), + &loongson_ipi64_ops, + s, "loongson_ipi64_iocsr", 0x118); + sysbus_init_mmio(sbd, &s->ipi64_iocsr_mem); + + s->cpu = g_new0(IPICore, s->num_cpu); + for (i = 0; i < s->num_cpu; i++) { + s->cpu[i].ipi = s; + + qdev_init_gpio_out(dev, &s->cpu[i].irq, 1); + } +} + +static void loongson_ipi_common_unrealize(DeviceState *dev) +{ + LoongsonIPICommonState *s = LOONGSON_IPI_COMMON(dev); + + g_free(s->cpu); +} static const VMStateDescription vmstate_ipi_core = { .name = "ipi-single", @@ -45,7 +323,12 @@ static Property ipi_common_properties[] = { static void loongson_ipi_common_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); + LoongsonIPICommonClass *licc = LOONGSON_IPI_COMMON_CLASS(klass); + device_class_set_parent_realize(dc, loongson_ipi_common_realize, + &licc->parent_realize); + device_class_set_parent_unrealize(dc, loongson_ipi_common_unrealize, + &licc->parent_unrealize); device_class_set_props(dc, ipi_common_properties); dc->vmsd = &vmstate_loongson_ipi_common; } From patchwork Mon Aug 5 18:06:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 816750 Delivered-To: patch@linaro.org Received: by 2002:adf:e00d:0:b0:367:895a:4699 with SMTP id s13csp1469995wrh; Mon, 5 Aug 2024 11:08:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVdUjVr3RuXcZPzl/RcBPxeYe2GjaM1WYxVzXs5OL5gBM14SKxzgX/vklUpVDXahd6uZ6v035pbyb5LF/qPB2ew X-Google-Smtp-Source: AGHT+IHAFBqTSb2JkMZY1Sb/bHwmVheYF5BUOWhQHOYlV37uJMmWyveBMDCX9QbE9DLdBGVM284t X-Received: by 2002:a05:622a:1899:b0:447:e562:b64 with SMTP id d75a77b69052e-451892c6960mr145671291cf.64.1722881307649; Mon, 05 Aug 2024 11:08:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722881307; cv=none; d=google.com; s=arc-20160816; b=MQbpRqngXAC/hGAno7B9Xf666MPaIDDilbe7l6cTR3DJCaNzWAcu1XMPPYFHvRCZhs mSHWE9EYIZ/OQNnebHJ3nkCmJHrZBaygjeZ7vQl6RKhzfV0FtWkdI+kmrIr5WjtjEGES pM0jgA741teBHT3cAmajYR8o7N1sM6drIksYe4afRfx5E8B+OWAvXnnRBRq79c89D2TA Ky7jXTiB7Pcs2dL54YMNXK2wxX9TdAMMvM3Buva9n051qAWJkyHrI2WVDh8VBzqGCHbl k1MwlPusRz7AOAmqc/tI0RoTCcAHkQzaBF9O8atuhE7GNrh4hPGrMpTJWhEgFcg6Hi1b p5EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8/kSm1HWmhuEc0hDCxHXx4k+YsK8CefOInECn4KJlHc=; fh=9FIv2ryHyUdV0M0E/xImFOb7ha8RVmpB9WW8IcVSbKs=; b=sMolGX7SyA/VILaPpTOA+G59cTfYQ6P5+gn01Z0Ngt8veBoG8ya3KH092DZyM/Xu9L yhaCPLEnn+YZcR2Y5ChS9ID9PeypuG1nH9UNhwnwxarHyxwifCQBAUFul14mwKZTOywk dDRilPH1FcCp/JPidxrYi/nQFGiLdGv+CleMROqo/wgeJKqM8j3EuoOs50EZ77XRAxYW njS5nYi+39lZwCTOxzCXWnop9+DIxw4jwe6htkx8zSFdGD47IhbkY9ZSaNvs2s7djv+W dVBpkOItC8+TdSwQWJaxerwzV8L9QTyVBp6VolsTK+kI5t3hTOPXBM5XcfSA5JSmToHw YxAw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EB3viguV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4518a7645a1si100108411cf.230.2024.08.05.11.08.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Aug 2024 11:08:27 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EB3viguV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sb27a-0002sz-Iw; Mon, 05 Aug 2024 14:07:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sb27Y-0002fR-I4 for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:07:48 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sb27W-0006SQ-GZ for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:07:48 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-3687f91af40so6439383f8f.0 for ; Mon, 05 Aug 2024 11:07:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722881262; x=1723486062; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8/kSm1HWmhuEc0hDCxHXx4k+YsK8CefOInECn4KJlHc=; b=EB3viguV6aJnJKzA3/FJgVA8VPtXvCojjwanfyfDIUYCnddhw4I1TATfDSHrJHoTRE hpN0VAr9aZDMXarL3u5keg30hjKKi7D85Dqrb3+iFxlN2dSfBzGM185si2oac8E7T81t gvHV7+yT+/jsAm8VJSIeXpEsewtxMBHHGyWkXKDWArTe+4a7LMMLLIrEbmJuIW9MPkxB sYFrgxOAgvH4GJty74LMT4qiXwK1wnraV03Tb8F/46g5DRWQlXTphEdC8kS1SCrmxboC h++uNhd1brwpif+zdlOGP4wt2j15/5j/FvOWRd00RBJPXbkOT14ae4Xxr6qXYNZjy5Tp t5HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722881262; x=1723486062; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8/kSm1HWmhuEc0hDCxHXx4k+YsK8CefOInECn4KJlHc=; b=NwE2LBUoI7IswwEyNxSIjlZRXROMVRJH0ey2zmR+fLalWqZHuLMd05zhLeSRrt11u2 XrA+DgkDjTajSXfk8P6CJpTe8BROaE+rgPVK7vGf4K6nAdGwx5OBfMVZYJH9YCBP68nF PQcnNTqkwcRc14GGcSaI3jaLygFPse19qyoEV/AkoQzgkqx4tjkv2EePHy5NXbOHMYnG pF7NKbjFLsXC3Zee4jc15En3XGninTDgxPUIe6Ti6aqiq8NYpCrDbajJX4hs5zaOVlwb NKVTuRBlOfV6/LBs8AW3jDmKvABSzMcaqp95q2cbP6pdJhkFzKRa2HG+mtUzrao8IhGL yz3Q== X-Gm-Message-State: AOJu0YwDczWlVUWWdSxRhlQpXj1Sr/oO2Pbwm79nLQBCdH9WOqQGkcSf BMXNri8F2DQhM2W1pRFjaMCjUUgn1eEqdgfrc+fUnXP2EnyedW1xQ9snJe7s4j7Ckmfk6eULe5v T X-Received: by 2002:a5d:5d86:0:b0:36b:c126:fe6d with SMTP id ffacd0b85a97d-36bc127010cmr5831283f8f.24.1722881262267; Mon, 05 Aug 2024 11:07:42 -0700 (PDT) Received: from m1x-phil.lan (cor91-h02-176-184-30-206.dsl.sta.abo.bbox.fr. [176.184.30.206]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36bbd05b92esm10890601f8f.85.2024.08.05.11.07.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 05 Aug 2024 11:07:41 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Bibo Mao Cc: Song Gao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Jiaxun Yang Subject: [PATCH-for-9.1 v6 12/15] hw/intc/loongarch_ipi: Add loongarch IPI support Date: Mon, 5 Aug 2024 20:06:19 +0200 Message-ID: <20240805180622.21001-13-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240805180622.21001-1-philmd@linaro.org> References: <20240805180622.21001-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bibo Mao Loongarch IPI is added here, it inherits from class TYPE_LOONGSON_IPI_COMMON, and two interfaces get_iocsr_as() and cpu_by_arch_id() are added for Loongarch 3A5000 machine. It can be used when ipi is emulated in userspace with KVM mode. Signed-off-by: Bibo Mao [PMD: Rebased and simplified] Co-Developed-by: Philippe Mathieu-Daudé Reviewed-by: Bibo Mao Tested-by: Bibo Mao Signed-off-by: Philippe Mathieu-Daudé Acked-by: Song Gao Reviewed-by: Richard Henderson Reviewed-by: Jiaxun Yang Tested-by: Jiaxun Yang Message-Id: <20240718133312.10324-16-philmd@linaro.org> --- include/hw/intc/loongarch_ipi.h | 25 ++++++++++++ hw/intc/loongarch_ipi.c | 68 +++++++++++++++++++++++++++++++++ hw/intc/Kconfig | 4 ++ hw/intc/meson.build | 1 + 4 files changed, 98 insertions(+) create mode 100644 include/hw/intc/loongarch_ipi.h create mode 100644 hw/intc/loongarch_ipi.c diff --git a/include/hw/intc/loongarch_ipi.h b/include/hw/intc/loongarch_ipi.h new file mode 100644 index 0000000000..276b3040a3 --- /dev/null +++ b/include/hw/intc/loongarch_ipi.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * LoongArch IPI interrupt header files + * + * Copyright (C) 2024 Loongson Technology Corporation Limited + */ + +#ifndef HW_LOONGARCH_IPI_H +#define HW_LOONGARCH_IPI_H + +#include "qom/object.h" +#include "hw/intc/loongson_ipi_common.h" + +#define TYPE_LOONGARCH_IPI "loongarch_ipi" +OBJECT_DECLARE_TYPE(LoongarchIPIState, LoongarchIPIClass, LOONGARCH_IPI) + +struct LoongarchIPIState { + LoongsonIPICommonState parent_obj; +}; + +struct LoongarchIPIClass { + LoongsonIPICommonClass parent_class; +}; + +#endif diff --git a/hw/intc/loongarch_ipi.c b/hw/intc/loongarch_ipi.c new file mode 100644 index 0000000000..2ae1a42c46 --- /dev/null +++ b/hw/intc/loongarch_ipi.c @@ -0,0 +1,68 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * LoongArch IPI interrupt support + * + * Copyright (C) 2024 Loongson Technology Corporation Limited + */ + +#include "qemu/osdep.h" +#include "hw/boards.h" +#include "hw/intc/loongarch_ipi.h" +#include "target/loongarch/cpu.h" + +static AddressSpace *get_iocsr_as(CPUState *cpu) +{ + return LOONGARCH_CPU(cpu)->env.address_space_iocsr; +} + +static int archid_cmp(const void *a, const void *b) +{ + CPUArchId *archid_a = (CPUArchId *)a; + CPUArchId *archid_b = (CPUArchId *)b; + + return archid_a->arch_id - archid_b->arch_id; +} + +static CPUArchId *find_cpu_by_archid(MachineState *ms, uint32_t id) +{ + CPUArchId apic_id, *found_cpu; + + apic_id.arch_id = id; + found_cpu = bsearch(&apic_id, ms->possible_cpus->cpus, + ms->possible_cpus->len, + sizeof(*ms->possible_cpus->cpus), + archid_cmp); + + return found_cpu; +} + +static CPUState *loongarch_cpu_by_arch_id(int64_t arch_id) +{ + MachineState *machine = MACHINE(qdev_get_machine()); + CPUArchId *archid; + + archid = find_cpu_by_archid(machine, arch_id); + if (archid) { + return CPU(archid->cpu); + } + + return NULL; +} + +static void loongarch_ipi_class_init(ObjectClass *klass, void *data) +{ + LoongsonIPICommonClass *licc = LOONGSON_IPI_COMMON_CLASS(klass); + + licc->get_iocsr_as = get_iocsr_as; + licc->cpu_by_arch_id = loongarch_cpu_by_arch_id; +} + +static const TypeInfo loongarch_ipi_types[] = { + { + .name = TYPE_LOONGARCH_IPI, + .parent = TYPE_LOONGSON_IPI_COMMON, + .class_init = loongarch_ipi_class_init, + } +}; + +DEFINE_TYPES(loongarch_ipi_types) diff --git a/hw/intc/Kconfig b/hw/intc/Kconfig index a2a0fdca85..dd405bdb5d 100644 --- a/hw/intc/Kconfig +++ b/hw/intc/Kconfig @@ -94,6 +94,10 @@ config LOONGSON_IPI bool select LOONGSON_IPI_COMMON +config LOONGARCH_IPI + bool + select LOONGSON_IPI_COMMON + config LOONGARCH_PCH_PIC bool select UNIMP diff --git a/hw/intc/meson.build b/hw/intc/meson.build index a09a527207..f4d81eb8e4 100644 --- a/hw/intc/meson.build +++ b/hw/intc/meson.build @@ -71,6 +71,7 @@ specific_ss.add(when: ['CONFIG_KVM', 'CONFIG_XIVE'], specific_ss.add(when: 'CONFIG_M68K_IRQC', if_true: files('m68k_irqc.c')) specific_ss.add(when: 'CONFIG_LOONGSON_IPI_COMMON', if_true: files('loongson_ipi_common.c')) specific_ss.add(when: 'CONFIG_LOONGSON_IPI', if_true: files('loongson_ipi.c')) +specific_ss.add(when: 'CONFIG_LOONGARCH_IPI', if_true: files('loongarch_ipi.c')) specific_ss.add(when: 'CONFIG_LOONGARCH_PCH_PIC', if_true: files('loongarch_pch_pic.c')) specific_ss.add(when: 'CONFIG_LOONGARCH_PCH_MSI', if_true: files('loongarch_pch_msi.c')) specific_ss.add(when: 'CONFIG_LOONGARCH_EXTIOI', if_true: files('loongarch_extioi.c')) From patchwork Mon Aug 5 18:06:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 816744 Delivered-To: patch@linaro.org Received: by 2002:adf:e00d:0:b0:367:895a:4699 with SMTP id s13csp1469923wrh; Mon, 5 Aug 2024 11:08:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWqOMLaO6PCVNFrQqIOf8vIV/1Oo+4MDS4DwAGBmRbVNQwjWyySQyLhKs3hSp+ysio7FsrOx6z+3ZMT57xL+y6p X-Google-Smtp-Source: AGHT+IEB31HXo26aQIWSXcrgZOTRIUfcjpjybhbCOIRZbFG3Ikc51LDc/BHieiw3eA/GRF9GkUKP X-Received: by 2002:ac8:5787:0:b0:447:f6c7:65ee with SMTP id d75a77b69052e-451845379dfmr245250131cf.10.1722881298663; Mon, 05 Aug 2024 11:08:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722881298; cv=none; d=google.com; s=arc-20160816; b=eZfARLqkBRUKJo2/bzah6Y16r9w/9GGUWYJHnZ4JvhPfiGBsg64pAWlQ9iLJwVu49U aECgNNoxEXsh1s0jxRb3ycSrd3IBliKIi8PRZFJnc2sMIKeIsBN7dSRs45GWybyLmRfd lZ0MrTaBYBsgIJJfbXFHC8c6OKKYaY1+bdVNp5FdFtj0+r3IviD0ATYkiBsqZFUY963p SkAr1pK4t78xbQQ5XVpO1/dyDRMQt8gHb/RqbJ2sg6NZy+KHhu4RVdBmEHoWCGOBEkbU cKKx93dGv8AZ4Wj7wXbLDvf8Ck+d5SVhUZ/qoA2/26AIoNr6L9kDTx6hf1szhcShTHRt 4EqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=T9ejfrRNicFtIaOENDLOGRJ84CHVlCyZuuz175O5yxE=; fh=9FIv2ryHyUdV0M0E/xImFOb7ha8RVmpB9WW8IcVSbKs=; b=uu3q5A4HCfAUrXEV7+bZ9FlfPuPrmHHv4RlS4/QYlnAGvR6JsPrDiQfmpEF7JKXswJ Zwhk7tuDJuzrP+CnNLeWZak7nwK4SYXU48N6VvTmn6//u8d9fx+rgyHXG1wGMwgld8PA RcGtnD/L+XUVqYs064wbXrLeEzNAeWAdGU3LAwnfXXTNGxCXjoG273MwXYuuL5DcFtbB pnX6CaQ83TVvJGQ8ouBrRApuS0awKIWdc6MmXQrWwbg7S1ZmlBfbEwxl3FN55UuDs+Wl C2C2fghcuqVvn8usJ1lhnlWu555lwzqczvRJ8JXmMM42DUzhfQf6+YNk7IyurUx0plfG +kjg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FOOgRTiq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4518a7631f3si110513021cf.257.2024.08.05.11.08.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Aug 2024 11:08:18 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FOOgRTiq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sb27e-0003GQ-3B; Mon, 05 Aug 2024 14:07:54 -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 1sb27c-00037r-OT for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:07:52 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sb27a-0006Sp-TH for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:07:52 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4280bbdad3dso73350655e9.0 for ; Mon, 05 Aug 2024 11:07:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722881269; x=1723486069; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T9ejfrRNicFtIaOENDLOGRJ84CHVlCyZuuz175O5yxE=; b=FOOgRTiqtxXRGpRrNyYDJR3bj/Jeq3V3VAbZL/wfWdmpilIz3k2IDHfsgTjyttCzvg ltSLXNZEjn2rlUYRG4Xrg79HjeDEjKnIZ/c10aJ5SwGFiBQ8WSadjiXyG2kZYukSxFig SBNgjbzJoClXQ5O+OaJdhX8sCRP5YO2LW/u85u5/eEzToOGQll4Yj1s/2WqQVTXSAvve TIdCR0Kfak5pa1kEkLVUitrYOhRh+2blRj2dn3/ZLizxvXrq+d9ql08gDy+hZLQ8TiUY 4b6Zoi/EdILsmWv+UFx6FwcdQCCUu+2hv9sfZrYlLBL/vfg87deWKW5RyV0JDHp3N9rX gPTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722881269; x=1723486069; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T9ejfrRNicFtIaOENDLOGRJ84CHVlCyZuuz175O5yxE=; b=rSl7Ok9cVSStM3iahOUgHPEi63frtXLZt11gYFWZ5mJ+5CIKWTcwFAIwnkrFnNluCb Wg5Hp4QOAUV5C2xYwUp64yjrYI6mkTJzB56O7igoLKDVqj7n05DMXIPE3yLepGkcNEZi KE7/bO83lrW4SNECC4M1dPPGxjJ6IY4wz7JIKASA5uCAvOYuanEFygn6/zH8tSU1NxOu 5eivMQ4mF+WonrXKhARRmSOoHrB5LXyEdwOZi44WaiR9vfVgYMUX0Hw/v0RBEEFzJHi5 51bZa900wIGiRoQOmsJAyPD9dnsaUZwT3wsa7PjcxkQ4qUqaxQr+4ZPttK7mWVBMxh89 2xOA== X-Gm-Message-State: AOJu0YyaeuJt/kObqbNa2V/yspjNYRgj1obPqeGsjtEgG5AG6yd3Yt8T LjvJzRWBaJoYR+yq0A5R/8qEf+fZW96hXPtl0qrcU9WD4xrn+WzjC8nYtReVS09tsrfptUv0rpY q X-Received: by 2002:a05:600c:3544:b0:421:7aa1:435 with SMTP id 5b1f17b1804b1-428e6b81cbamr73972275e9.25.1722881268980; Mon, 05 Aug 2024 11:07:48 -0700 (PDT) Received: from m1x-phil.lan (cor91-h02-176-184-30-206.dsl.sta.abo.bbox.fr. [176.184.30.206]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4282bb63f16sm208353415e9.33.2024.08.05.11.07.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 05 Aug 2024 11:07:48 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Bibo Mao Cc: Song Gao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Jiaxun Yang Subject: [PATCH-for-9.1 v6 13/15] hw/loongarch/virt: Replace Loongson IPI with LoongArch IPI Date: Mon, 5 Aug 2024 20:06:20 +0200 Message-ID: <20240805180622.21001-14-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240805180622.21001-1-philmd@linaro.org> References: <20240805180622.21001-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bibo Mao Loongarch IPI inherits from class LoongsonIPICommonClass, and it only contains Loongarch 3A5000 virt machine specific interfaces, rather than mix different machine implementations together. Signed-off-by: Bibo Mao [PMD: Rebased] Co-Developed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bibo Mao Tested-by: Bibo Mao Acked-by: Song Gao Reviewed-by: Richard Henderson Reviewed-by: Jiaxun Yang Tested-by: Jiaxun Yang Message-Id: <20240718133312.10324-17-philmd@linaro.org> --- include/hw/loongarch/virt.h | 1 - hw/loongarch/virt.c | 4 ++-- hw/loongarch/Kconfig | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/hw/loongarch/virt.h b/include/hw/loongarch/virt.h index 603c1cebdb..c373e48f27 100644 --- a/include/hw/loongarch/virt.h +++ b/include/hw/loongarch/virt.h @@ -11,7 +11,6 @@ #include "target/loongarch/cpu.h" #include "hw/boards.h" #include "qemu/queue.h" -#include "hw/intc/loongson_ipi.h" #include "hw/block/flash.h" #include "hw/loongarch/boot.h" diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index e592b1b6b7..29040422aa 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -23,7 +23,7 @@ #include "net/net.h" #include "hw/loader.h" #include "elf.h" -#include "hw/intc/loongson_ipi.h" +#include "hw/intc/loongarch_ipi.h" #include "hw/intc/loongarch_extioi.h" #include "hw/intc/loongarch_pch_pic.h" #include "hw/intc/loongarch_pch_msi.h" @@ -788,7 +788,7 @@ static void virt_irq_init(LoongArchVirtMachineState *lvms) */ /* Create IPI device */ - ipi = qdev_new(TYPE_LOONGSON_IPI); + ipi = qdev_new(TYPE_LOONGARCH_IPI); qdev_prop_set_uint32(ipi, "num-cpu", ms->smp.cpus); sysbus_realize_and_unref(SYS_BUS_DEVICE(ipi), &error_fatal); diff --git a/hw/loongarch/Kconfig b/hw/loongarch/Kconfig index 89be737726..0de713a439 100644 --- a/hw/loongarch/Kconfig +++ b/hw/loongarch/Kconfig @@ -12,7 +12,7 @@ config LOONGARCH_VIRT select SERIAL select VIRTIO_PCI select PLATFORM_BUS - select LOONGSON_IPI + select LOONGARCH_IPI select LOONGARCH_PCH_PIC select LOONGARCH_PCH_MSI select LOONGARCH_EXTIOI From patchwork Mon Aug 5 18:06:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 816751 Delivered-To: patch@linaro.org Received: by 2002:adf:e00d:0:b0:367:895a:4699 with SMTP id s13csp1470060wrh; Mon, 5 Aug 2024 11:08:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVUW067UTWjQd/7PcAQEBoLkfpBJYOZ0qUaHFveeTabY7+UM3zAdNUDOjKgziPZTTvGVcYjkg==@linaro.org X-Google-Smtp-Source: AGHT+IEYCnRYqqbTHVVoyXBT83/oYfjhDWbu0Ak5LAE9HPRNvBdGoKO4KBxI8ulWWfyqc3C7nODn X-Received: by 2002:ac8:7d96:0:b0:446:4c0f:ef03 with SMTP id d75a77b69052e-45189204d74mr139183871cf.10.1722881316186; Mon, 05 Aug 2024 11:08:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722881316; cv=none; d=google.com; s=arc-20160816; b=q2+tCMlHXXJ4IHBYXsmKgwvgoT1NNxjPHjXvwxXV09A5I1D1lCU2M+JgoHrOCvI9KW iHwU8UDTGB9l3d4RSo+GzCUCpqzBcoGc/9Q4UsB0LwzsxU6ob8FY1+PKp+49OMPtASLk lha9oCzludlf47tkg51vqrEXnoUs4ebxXtmkVpXZwUbyMnABC7xzZG83k3qz16kHROaw N4eT6+aGRJsqdtwK2q01ckKMl4l2isMdu1G1U0och9hSuloYbLEa733napZ9mH/gq86V msrsiX9HAC/13hZp5CytdSLCTKOnYHvokkBbM5L8gZDM9ArBrInvhy8Wp8MTPcyIhGXD scbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=I1vkVvGYva6AXVxaYurK5JW7ap7wfr9UqBuNEWmzqSg=; fh=9FIv2ryHyUdV0M0E/xImFOb7ha8RVmpB9WW8IcVSbKs=; b=ngz4Gegfk7xNUuVrsLgEtCGCmfUh9MZWiCiRVfLHf3ovZ2FgE8rJRusypJWKnisQCZ 5phatRMWi0GvvyBvzQaPzFIzxYWY7ot5GZ1v1D9jifSQzXsPYmtQO//2GtyiI5hJJHzY pEdduiSHHcF7hk1r+bsORPjtFW3mA+M0LBvc8NeWjxbdq8NXHS696Xo55t6Xmn6zExss 0SpWpJLKJFTY8ZqlVoCSuBrIKemwNsXZWsP/9fOB3d7zPOR/TCV0w37PocFqESUCZ+T1 UjAAx64Wy1lzBREti89rjuRJBJIk0PMt0hs6uscHRncaq6jS0sLEYgWGeVsrDDc2N5xt L97w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EsjxB9JR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4518a7c3286si108393661cf.806.2024.08.05.11.08.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Aug 2024 11:08:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EsjxB9JR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sb27p-0004c7-3K; Mon, 05 Aug 2024 14:08:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sb27k-00047V-3L for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:08:01 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sb27h-0006T0-KW for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:07:59 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-428178fc07eso68960575e9.3 for ; Mon, 05 Aug 2024 11:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722881275; x=1723486075; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=I1vkVvGYva6AXVxaYurK5JW7ap7wfr9UqBuNEWmzqSg=; b=EsjxB9JR9/rTu8urC/rQYdAKQbeI+LO8HpUMV9/5KYWbam8DqPLEWvfkfLmMf5BnVH An3jQ5v2YuWQ/hHIMXakN4XH0kjvfihu8+GJM+4AakBYTRmbpzXqJVNaa84ygADTVBk5 WjMsgqcpkdY9JRjKTPXKSfPCA4A0TsASx6UIHr0RZrWhZjQMOg19CCGCqFNS9cgfOYC3 C8hBqZZwI/kDuS1vpBJoY5nfF9uHMwnjPyuXgM3AF5yiVClHdA3vrhJo1XsZNM2F0QWD /H239Qnng0Y2w3zEZ5mvFkkAFIVTVv9Ypy8UUbtD0e80AuiuG77aKZ6egrj03E/L/0zf FjvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722881275; x=1723486075; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I1vkVvGYva6AXVxaYurK5JW7ap7wfr9UqBuNEWmzqSg=; b=EyITy70nqyaNfsOSaqlwlQ7Z5/H7RYmLacl/Ka0yYkRKtDYSW/gfTj7DolSr7FTVSh BQ/8QzhYQK/Wii5xJtTTL1KgV7ZpcjwrxWwFbyOP4ZQrUfnZSSpx+gnGvNm7evT1oJGO 56RxHHSV8/T9bcsEhhRmsDNsdYsV3ITl1k8atO6+f5BtL+ocXEt8qQEsPiB7apXZ5s4e iAYBtiy5ibq3XSOuuYSgYbHkn4qe9rZi66OuXqIlnpsMlyARqKXKzpxUBjREZXCTSr8W 8TwxsV8vQ8k4S6qolBGXUJzH7FYmLPrA/ef/UU5dAMtS5eoU7Tf8NFe9IPUeevsOpbqW YMvQ== X-Gm-Message-State: AOJu0YzeZC5qfW0MHNyPE2x+QlL17voKPVnDssJTTobBRT0YH+mfk/rS xjCqXKGt3JmUsrtocT5TWL3qZBN8cuQEClmfA3uyfIgT9eAEN29o3SA6p7raWzqJNs8xZikgKHw t X-Received: by 2002:a05:600c:3111:b0:426:5c9b:dee6 with SMTP id 5b1f17b1804b1-428e6b7f2c7mr86127005e9.26.1722881275198; Mon, 05 Aug 2024 11:07:55 -0700 (PDT) Received: from m1x-phil.lan (cor91-h02-176-184-30-206.dsl.sta.abo.bbox.fr. [176.184.30.206]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4282bb64952sm212345545e9.37.2024.08.05.11.07.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 05 Aug 2024 11:07:54 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Bibo Mao Cc: Song Gao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Jiaxun Yang Subject: [PATCH-for-9.1 v6 14/15] hw/intc/loongson_ipi: Restrict to MIPS Date: Mon, 5 Aug 2024 20:06:21 +0200 Message-ID: <20240805180622.21001-15-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240805180622.21001-1-philmd@linaro.org> References: <20240805180622.21001-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Bibo Mao Now than LoongArch target can use the TYPE_LOONGARCH_IPI model, restrict TYPE_LOONGSON_IPI to MIPS. Signed-off-by: Bibo Mao [PMD: Extracted from bigger commit, added commit description] Co-Developed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bibo Mao Tested-by: Bibo Mao Acked-by: Song Gao Reviewed-by: Richard Henderson Reviewed-by: Jiaxun Yang Tested-by: Jiaxun Yang Message-Id: <20240718133312.10324-18-philmd@linaro.org> --- MAINTAINERS | 2 -- hw/intc/loongson_ipi.c | 14 -------------- 2 files changed, 16 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 5ca701cf0c..74a85360fd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1251,10 +1251,8 @@ F: hw/loongarch/ F: include/hw/loongarch/virt.h F: include/hw/intc/loongarch_*.h F: include/hw/intc/loongson_ipi_common.h -F: include/hw/intc/loongson_ipi.h F: hw/intc/loongarch_*.c F: hw/intc/loongson_ipi_common.c -F: hw/intc/loongson_ipi.c F: include/hw/pci-host/ls7a.h F: hw/rtc/ls7a_rtc.c F: gdb-xml/loongarch*.xml diff --git a/hw/intc/loongson_ipi.c b/hw/intc/loongson_ipi.c index 0b88ae3230..8382ceca67 100644 --- a/hw/intc/loongson_ipi.c +++ b/hw/intc/loongson_ipi.c @@ -16,22 +16,9 @@ #include "exec/address-spaces.h" #include "exec/memory.h" #include "migration/vmstate.h" -#ifdef TARGET_LOONGARCH64 -#include "target/loongarch/cpu.h" -#endif -#ifdef TARGET_MIPS #include "target/mips/cpu.h" -#endif #include "trace.h" -#ifdef TARGET_LOONGARCH64 -static AddressSpace *get_iocsr_as(CPUState *cpu) -{ - return LOONGARCH_CPU(cpu)->env.address_space_iocsr; -} -#endif - -#ifdef TARGET_MIPS static AddressSpace *get_iocsr_as(CPUState *cpu) { if (ase_lcsr_available(&MIPS_CPU(cpu)->env)) { @@ -40,7 +27,6 @@ static AddressSpace *get_iocsr_as(CPUState *cpu) return NULL; } -#endif static const MemoryRegionOps loongson_ipi_core_ops = { .read_with_attrs = loongson_ipi_core_readl, From patchwork Mon Aug 5 18:06:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 816747 Delivered-To: patch@linaro.org Received: by 2002:adf:e00d:0:b0:367:895a:4699 with SMTP id s13csp1469969wrh; Mon, 5 Aug 2024 11:08:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVvOFONM+xR9UdoRU5Fl6iHZwBZasFGa8xnN5Nx7MSmVizsqiNntOi/NaT+ugstCeapgQgd4zc9SgHTsY8CEIGU X-Google-Smtp-Source: AGHT+IFyb7K+9zOoFhpzh54gMp3bRUAr9B+ZA7LgHqWo9ESupiGJ2R9OHb0hwMdmqm9zmvn4Qvvt X-Received: by 2002:a05:6808:1492:b0:3d9:41fa:3f42 with SMTP id 5614622812f47-3db55811f99mr15730350b6e.22.1722881304401; Mon, 05 Aug 2024 11:08:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722881304; cv=none; d=google.com; s=arc-20160816; b=GGbXLO3UmApphmbWs61uha17IXFIgxwLsnePq7YTSVE8Z2iswLQ6Z1GpKcl7djbsQU vM1hSZ+tWkMvFdCJLh8gEA9kM95s2r9FiIj7f1hELHhGFbyo4s4koQIEx9zawXblpqc9 Gah+Z4idZEMJV95uN6AYbAE0ctNiO8/5dS5NG6wRMtQlzGhWhn+qMM/OdOg194RvkmYX JUKnTvQbWJVqwc9ywpRVp7aLGkMglnnqkmlZwGPJIpB4691x7KIN9EhpKI7R/rlTpO9l BUlssVmIO24UlYm4eV8+KXb9MsLH5l9PiBlGvOOzcBw0XgVoiZwqBTII5DTl1b5HEedJ OvCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sfG7K0vO2YZb8Mr7z2795N5nQIZIeeUZz/GR/ld9L/o=; fh=9FIv2ryHyUdV0M0E/xImFOb7ha8RVmpB9WW8IcVSbKs=; b=jv24b2zv6XUVhmziJZWIKZi9GnHQ8PbHhCXl01iOt5thfDPjtq7lX73M/Knlj9avWL /IkcwkXYvCdWTBMlUvbimKMHIz6mTNfSdQSbcLD8OvhYPrvAWqd4zX/RyVAIuPBsAPQi AgHd4ucD0W+1CMJTpyOGPAi3pZXC643DBndzHRTCgJJrt6nRkGbQo+Sjx1yI4K2KoX4/ E/qE6tqRwGH5AKlLHtwGgB/zhhZuQASXR93o/bQ1OYkiV1g2opdLp7aWbby/hyZTm79n 57iNR5YisEdf+t+sMqDtZ/1YsZW+D0dOtkUsVS5k4S6e/+FsBktceq2pA8FtX/Bw1vQw KxSA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NZzRJHB0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7a34f74b7easi1023114885a.278.2024.08.05.11.08.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Aug 2024 11:08:24 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NZzRJHB0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sb27w-0005aQ-Tv; Mon, 05 Aug 2024 14:08: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 1sb27r-00051n-Sd for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:08:09 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sb27n-0006TF-Nn for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:08:06 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4281c164408so66829595e9.1 for ; Mon, 05 Aug 2024 11:08:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722881281; x=1723486081; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sfG7K0vO2YZb8Mr7z2795N5nQIZIeeUZz/GR/ld9L/o=; b=NZzRJHB02aPFNmkbLJQdDjzVXVxyp6Xrtdl/BBr8iyQ2WgxybdNXivyrhT1dZAJNqg Wad6NhMC3osuWYFDT0EoHNxMxtyqAzZhYaeIZLpKVOPht8g+tyx1P5ZqDQtVD14xhbbh vTgaSMZwyUzZI94d7lL+jQqZCWlrCxTI55ZrnlPvprvHLVepmdrhbagDAPt5nR02Kl7k g0D6Y6ar8ep98GmtW0DTX/8cYqcbQd8zkcnBReRt2J64Is67yZlBGqRnMLgyhjCHUo0A Ua3c6NB+DyqrOX1SnNcMpK3iXs5QHUeFUMPbCRL7SQPB46t3PFxuEBG8K3H3DlpOKETF HCbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722881281; x=1723486081; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sfG7K0vO2YZb8Mr7z2795N5nQIZIeeUZz/GR/ld9L/o=; b=OZmkmyIDma2neFiLfSZNb8NbvcxGH23dTFnoLc3ozVqXBCC+IboeJ8eyx5wUUjPRU+ IEIcSePR/UIK3w2fJabpVOKl5tOEzi/vOoegs1rMYJaeDmn+x2LioGaZ8+SfcDMSjJFs sXMWsoIvbzo0PUCx9KWNNwBqScG5yX9TyGjVr60V8nzFbx9CQgIi3vkkO3CRk20mmMIx b8qWm4BYWPbiRrUcs+dhda97ip2QqZ54E6tOri6RcKt8jU0bZABFeaCyTyRY3iOjIENm V3VVeONHFr8WJuY6B80B8z9IylxqezUfViajkX3Tcb9RkHPGAMWQby5wwzShVwNwvDoL gECg== X-Gm-Message-State: AOJu0YzxSlaQ3K+7fayVOkK9ArB8wmuOSc29V0ysOncpFqj0F9NA3Z1h TG9zYyvXJ5GLok9HNZui7fNZdPBDFEmk78s0ncRXT8BjFsAEgx1u0YhUUkmUkFnn4tItVKIWQcv f X-Received: by 2002:a05:600c:4ed1:b0:427:ff7a:794 with SMTP id 5b1f17b1804b1-428e6af1d48mr81677255e9.4.1722881281359; Mon, 05 Aug 2024 11:08:01 -0700 (PDT) Received: from m1x-phil.lan (cor91-h02-176-184-30-206.dsl.sta.abo.bbox.fr. [176.184.30.206]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4282b8ada30sm203060755e9.19.2024.08.05.11.07.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 05 Aug 2024 11:08:00 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Bibo Mao Cc: Song Gao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Jiaxun Yang Subject: [PATCH-for-9.2 v6 15/15] hw/intc/loongson_ipi: Remove unused headers Date: Mon, 5 Aug 2024 20:06:22 +0200 Message-ID: <20240805180622.21001-16-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240805180622.21001-1-philmd@linaro.org> References: <20240805180622.21001-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bibo Mao Tested-by: Bibo Mao Acked-by: Song Gao Reviewed-by: Richard Henderson Reviewed-by: Jiaxun Yang Tested-by: Jiaxun Yang Message-Id: <20240718133312.10324-19-philmd@linaro.org> --- hw/intc/loongson_ipi.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/hw/intc/loongson_ipi.c b/hw/intc/loongson_ipi.c index 8382ceca67..4e08f03510 100644 --- a/hw/intc/loongson_ipi.c +++ b/hw/intc/loongson_ipi.c @@ -6,18 +6,9 @@ */ #include "qemu/osdep.h" -#include "hw/boards.h" -#include "hw/sysbus.h" #include "hw/intc/loongson_ipi.h" -#include "hw/irq.h" -#include "hw/qdev-properties.h" #include "qapi/error.h" -#include "qemu/log.h" -#include "exec/address-spaces.h" -#include "exec/memory.h" -#include "migration/vmstate.h" #include "target/mips/cpu.h" -#include "trace.h" static AddressSpace *get_iocsr_as(CPUState *cpu) {