From patchwork Tue Aug 6 12:51:36 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: 817035 Delivered-To: patch@linaro.org Received: by 2002:adf:e00d:0:b0:367:895a:4699 with SMTP id s13csp1782690wrh; Tue, 6 Aug 2024 05:53:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUokXFrikMUiYDCmdVUD15R5cFjVoSfejJSlZaAncFKg00r11Ifugb+XDXhMUvnydB5yu01zfaYsMuQm/ABuMgU X-Google-Smtp-Source: AGHT+IE2pSJIH3AnICEwnF+MjZrRewA0/XYH8ytXhOoknv8gVAULyeBtSyZ8/SM1O3AxTbVmUv4N X-Received: by 2002:a05:622a:11c1:b0:44f:f7c8:b157 with SMTP id d75a77b69052e-451892c0734mr166470691cf.55.1722948814072; Tue, 06 Aug 2024 05:53:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722948814; cv=none; d=google.com; s=arc-20160816; b=mDRkUwHA5jN77AR0uWi5XKHUlJzQVIyLrojUdYnCgn98Qf7PE0rvsiDt1ecc6LdtXO BlEwadfyjm7iP+dUFztvRTyw8/vxgHHYr/PLE2mwBw7H6Rvkcd2/xpbnrNLhG97o2nyJ cqjCjPzIlr0m5PgUnGvTKM/Ii7kj95tLaB9XRX5eKWlID0ITcL8VyMTUtFtjG07eXTBH ihphHcRm7PrkORJWxfsBYKPBX0SvG3ccrRLT3tI/Ve7SjzEfsp8Ll3oerHZkjOGgAlLY fbuLuu3frxkps6S5L57KD6YHxggqL+9LMJygfynhFn79bnFHJ9ee+FSItVmcIqh6YoXX eUbw== 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=5mKdPYX00cysnIaHHc614x0QrHflyLw6OzvKS8k0g7I=; fh=rxGWTSOrq9MmYE4+hMcV/u38d68oc92wX5eFok0A+84=; b=ooBiui0hHGm+c9N95ZaOkpJCOFsWmasLgHOVvz32uoetHG9XB6f1v2hFgRbpiQdymU 8Cw7nexirQVcyuO9fsCY3umtG4HpJr5IryRBjDxAra/TvYQ6J24pTmh5UYeJiiu8CcJO 7Nvy+J+2Cfl80SZSDm2Qf7fL4BClmtPqNrmcbLD3x0xsRA/xt1miLlNzL+l7c74Tr+zi nI9rZ9Wibzo/x7v3trTm7dB75viz1vA6NtmX4yGqFiWHFAnCGHnogJJKvA835QwY9BOO sDsWQiNIKu2AsoyyfLTE65lCAjc8+mhXLlQPSKDJ+srzxk+valiKDTmkXxproO1ckdWJ shPA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="rXhG4b4/"; 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-4518a6bdfe0si114803121cf.54.2024.08.06.05.53.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Aug 2024 05:53:34 -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="rXhG4b4/"; 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 1sbJgQ-000803-6E; Tue, 06 Aug 2024 08:52:58 -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 1sbJgL-0007ZC-QX for qemu-devel@nongnu.org; Tue, 06 Aug 2024 08:52:53 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sbJgJ-0008TG-8y for qemu-devel@nongnu.org; Tue, 06 Aug 2024 08:52:52 -0400 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-5afa207b8bfso557259a12.0 for ; Tue, 06 Aug 2024 05:52:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722948769; x=1723553569; 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=5mKdPYX00cysnIaHHc614x0QrHflyLw6OzvKS8k0g7I=; b=rXhG4b4/uKpFn6/cxsG/DZb34p7J5FqOaBSnmWqczCCZSPhdexW36i0/Syu+g2/zj2 qZfcUQGH9kTdiNV/4l1w4ZNKnY9vulYdGXvM8DVNmWYHyL4jLe+1XcTwwwpRGNpH+7w5 CJVy0LG6Lin5RqqYGqkOCA4WeJVEhOqNOZE+xcwDXqjGLJxDgRvI0yICYwLTK4djXTKr Yf/1B1VP+Uo+Nb+InCuGfeOlP1/XPK1l0TK8RHgt9+Z0RHTE3pADw1AORHScTxx1qzEW Pw9tztTIo47hrLnPIgFBvfVhYQj9bhBXsNWngh+kvNeBh+QjKVXoMyYADVg0ib5vaA95 bNLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722948769; x=1723553569; 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=5mKdPYX00cysnIaHHc614x0QrHflyLw6OzvKS8k0g7I=; b=JXUcoKadFSke+j5JlfDv/3eL37B/RcrtMFOz+pd8ONHM6H+L9MfxuDql5EopDk2FIN mpOLc6IUHOcI4aymf0aSxyp4yWtf/6fTuWoQE5/eD1ZDa6ysRUeeiUjY1CCMiFMBRXb2 ATzh7jq7e/mUotg8u0Q26X1ucP33NCeGvRUVe5YvbpGK+ztSARioQE7u56N2VqC3CrhM qvn/ap4YddLRXa/4cvM043Zyyb7ZYiWlRQjIVSd77+CIu7p0ao0ZTmH6Fqr47xIk0YuE LW8KtfIKHu0pFXV/xfKbA7CYusG6+7NA9vFN6UBGoDPoQygTf4ZrzWu15603Of62hpD6 AfVQ== X-Gm-Message-State: AOJu0YzUmRl9RT4PMb3JccDO/8i8ZSOlFdS9i6eUTZjhNGfjC83KggCJ BvbqsLHtAeqGuvq7qEbsg+/Wcqzp8SS9zJwq2V8FSzowlMf6ELbyJc6Ugo4AasyXR2BlRx2nrfE E X-Received: by 2002:a05:6402:129a:b0:57d:72e:5b3a with SMTP id 4fb4d7f45d1cf-5b7f56fb7cbmr9883959a12.33.1722948769369; Tue, 06 Aug 2024 05:52:49 -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-5b83b82c068sm5896520a12.60.2024.08.06.05.52.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 06 Aug 2024 05:52:48 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Bibo Mao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Song Gao , Richard Henderson , Jiaxun Yang Subject: [PULL 08/28] hw/intc/loongson_ipi: Add LoongsonIPICommonClass::get_iocsr_as handler Date: Tue, 6 Aug 2024 14:51:36 +0200 Message-ID: <20240806125157.91185-9-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240806125157.91185-1-philmd@linaro.org> References: <20240806125157.91185-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=philmd@linaro.org; helo=mail-ed1-x530.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: <20240805180622.21001-9-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[] = {