From patchwork Wed May 8 17:45:07 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: 795500 Delivered-To: patch@linaro.org Received: by 2002:a5d:525c:0:b0:34e:ceec:bfcd with SMTP id k28csp903893wrc; Wed, 8 May 2024 10:48:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXyKaO46/yoeK4b/OW7LPVqjmtVKAdIRPQmZpsAnm++xDwXNIl1yvdeo9kMMWrtYVaUM8Shsup5PPU5gcs6eR6i X-Google-Smtp-Source: AGHT+IGk6NlOHhr348kPbcp5NAxAZdSKLCLufGy2N2v76G4FrSNCSk79PpbU9xWATv2lmm10arcj X-Received: by 2002:a05:6214:20c2:b0:6a0:d72b:682e with SMTP id 6a1803df08f44-6a1514583cbmr49919436d6.23.1715190522478; Wed, 08 May 2024 10:48:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715190521; cv=none; d=google.com; s=arc-20160816; b=Gu4O4FPNqIDo0NBrmiLNy0xSqZTNfvufzEvazdW18CUMWnOnQF6NJQzAQnHoGEjTVA syt+Vw1z/Z9ae2Fb88afiUq8RvOXTYYJgeI6UheKWXncUrTfccM6j5h2Hn3GrggqvqrI 9WFOS9n7eQpogdmTGwhr7h0dOj1gWoNiYp1drZKj0fo/iABNia8tP43CJ9a8nhThjZRp 3cmRDtZ5fIvA/RDyb0mP1E/0QpXc0GwmVA60C6oFDFpJy2ykb1o955+9bqc0udkJLh4v apOWXENxHByJ9287ehgWl1Xx44LcaGcu27WQCUH2L0IFftu4+psi/z3xubsFC2Xe+ql6 6uOQ== 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=tfa4b/yP5j4YbPKarQui7QysCN8PurfTYNdnjK8DmcY=; fh=jiKM5Jsg5IywfmBhne3oNkoWpsaS5OqwqtJOUwmjFpk=; b=HmUlMUEg5+H87khUU1V9xGFlB+RSbIc4Vz+om2n6HSpFBMt7q7H5Gt7VzKWSrl3Y9w Ew538zwPqC5Lqfk/HvF+8eE7rjbtKUASANhOmwkdAOVyE0OCDE+IQnKae/fovrQ0Q3vw RFwCG+h2pVCmzuNDWZfq8Z+Glux3l1tRTJ7h2w8yifY4/wc3wLeRd2bob0DRLs2I99pr n1ymkQEpJTPUt/clvD7+EzRf7V0YRwaxzAnXGJYy9FbBV1Q39MD3UTxtu99RL4nrPTda 3ZdKvlXvkUldHyeptn9iLVFer7Bpye23Y8NAk8KDTfeal6rCzXFcViZKKx2k3RoikEkz V9fg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bgc52l6s; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id iw14-20020a0562140f2e00b0069b51a2ce29si14379683qvb.315.2024.05.08.10.48.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 May 2024 10:48:41 -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=bgc52l6s; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s4lO6-0004Eq-BQ; Wed, 08 May 2024 13:47:32 -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 1s4lNz-0003f8-9M for qemu-devel@nongnu.org; Wed, 08 May 2024 13:47:25 -0400 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s4lNw-0000rb-Ll for qemu-devel@nongnu.org; Wed, 08 May 2024 13:47:22 -0400 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a59b49162aeso1043236966b.3 for ; Wed, 08 May 2024 10:47:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715190437; x=1715795237; 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=tfa4b/yP5j4YbPKarQui7QysCN8PurfTYNdnjK8DmcY=; b=bgc52l6se0MGAHFB/WaKt/fb0L+jYOQn5c7ZD4vJb130N5xAV/Xbhnlsbl/nVMu/wb HfBWlI2G3Mp55kAFFY80l1bDMslgNx9h41vWL8IqAghfJpQfeHuSS8BJ8PnwOlYU+mDR C+Zs8Sa/DFCZNKZGPO1mC346dmV4OvAUbT3KL03k6U/x6AebW3xMWROJT+SHeI6smB4U zIN3Xh0XJyezP1XxwhegbcChSvEgHEs/aXgRJKqcaNWocd2/3LyVAFS1Eyw5hjlf4yph i1eQb6FlPwLdY2xf2OavomCRfg43xLfAml64Hhstd0c60Jz+JnllYzUHR7d+n4hoWFvf QLRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715190437; x=1715795237; 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=tfa4b/yP5j4YbPKarQui7QysCN8PurfTYNdnjK8DmcY=; b=WsxwnxPiLFDVGqp31MAupwtIGpyiOzbqYO9Q430J6ZtZ/x6/DMOlw1JSLj3PARMqlS y65oFfGtpe8p6Xxbmqr/FQ+loUW3G39dl941L5yzJpYVn++FfIM826U2cvglHB7jh7Ug Ts84o0cN4OXe/uuEbXG4N07WQaDvYtgpTormD3m+lTEI3E2aII8qPLZSY+BBW94jCSrb Duw0/9qfwvHaLoIjMl586Cf8Lz9c3cujEDg57pjjqjN5lU0LkCrNr06SuFePfK67Y7W0 3cpoSgepoS7YhlJPNSGWzUTjZpXuHAs82wS3gsvmcnR2coFVqYhfYIhAY1EfIfdMlE6y CsGA== X-Gm-Message-State: AOJu0YwPbVxMEmVzMWZnud1GKjFuOKiZafPVEAcUBbFxaa2Bg1rCqJCo 6lY5EPespNnhZJq+JCF7K3QYmwFxidOD55a7p7HxPpglo8WWEUwJ7JeTruRHtajDwXByRh28k8w 7 X-Received: by 2002:a50:bb05:0:b0:572:7c99:a280 with SMTP id 4fb4d7f45d1cf-5731d9d4572mr2221467a12.15.1715190437587; Wed, 08 May 2024 10:47:17 -0700 (PDT) Received: from m1x-phil.lan (sar95-h02-176-184-10-250.dsl.sta.abo.bbox.fr. [176.184.10.250]) by smtp.gmail.com with ESMTPSA id o5-20020aa7c7c5000000b00572c25023b1sm7792892eds.0.2024.05.08.10.47.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 08 May 2024 10:47:17 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PULL 23/26] hw/intc/loongarch_ipi: Remove pointless MAX_CPU check Date: Wed, 8 May 2024 19:45:07 +0200 Message-ID: <20240508174510.60470-24-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240508174510.60470-1-philmd@linaro.org> References: <20240508174510.60470-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=philmd@linaro.org; helo=mail-ej1-x633.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: Jiaxun Yang Since cpuid will be checked by ipi_getcpu anyway, there is no point to enforce MAX_CPU here. This also saved us from including loongarch board header. Signed-off-by: Jiaxun Yang Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240508-loongson3-ipi-v1-1-1a7b67704664@flygoat.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/intc/loongarch_ipi.c | 19 ++----------------- hw/intc/trace-events | 2 -- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/hw/intc/loongarch_ipi.c b/hw/intc/loongarch_ipi.c index a184112b09..44b3b9c138 100644 --- a/hw/intc/loongarch_ipi.c +++ b/hw/intc/loongarch_ipi.c @@ -6,6 +6,7 @@ */ #include "qemu/osdep.h" +#include "hw/boards.h" #include "hw/sysbus.h" #include "hw/intc/loongarch_ipi.h" #include "hw/irq.h" @@ -13,9 +14,8 @@ #include "qapi/error.h" #include "qemu/log.h" #include "exec/address-spaces.h" -#include "hw/loongarch/virt.h" #include "migration/vmstate.h" -#include "target/loongarch/internals.h" +#include "target/loongarch/cpu.h" #include "trace.h" static MemTxResult loongarch_ipi_readl(void *opaque, hwaddr addr, @@ -122,11 +122,6 @@ static MemTxResult mail_send(uint64_t val, MemTxAttrs attrs) CPUState *cs; cpuid = extract32(val, 16, 10); - if (cpuid >= LOONGARCH_MAX_CPUS) { - trace_loongarch_ipi_unsupported_cpuid("IOCSR_MAIL_SEND", cpuid); - return MEMTX_DECODE_ERROR; - } - cs = ipi_getcpu(cpuid); if (cs == NULL) { return MEMTX_DECODE_ERROR; @@ -146,11 +141,6 @@ static MemTxResult any_send(uint64_t val, MemTxAttrs attrs) CPUState *cs; cpuid = extract32(val, 16, 10); - if (cpuid >= LOONGARCH_MAX_CPUS) { - trace_loongarch_ipi_unsupported_cpuid("IOCSR_ANY_SEND", cpuid); - return MEMTX_DECODE_ERROR; - } - cs = ipi_getcpu(cpuid); if (cs == NULL) { return MEMTX_DECODE_ERROR; @@ -201,11 +191,6 @@ static MemTxResult loongarch_ipi_writel(void *opaque, hwaddr addr, uint64_t val, break; case IOCSR_IPI_SEND: cpuid = extract32(val, 16, 10); - if (cpuid >= LOONGARCH_MAX_CPUS) { - trace_loongarch_ipi_unsupported_cpuid("IOCSR_IPI_SEND", cpuid); - return MEMTX_DECODE_ERROR; - } - /* IPI status vector */ vector = extract8(val, 0, 5); cs = ipi_getcpu(cpuid); diff --git a/hw/intc/trace-events b/hw/intc/trace-events index 47340b5bc1..a979784f9b 100644 --- a/hw/intc/trace-events +++ b/hw/intc/trace-events @@ -294,8 +294,6 @@ sh_intc_set(int id, int enable) "setting interrupt group %d to %d" # loongarch_ipi.c loongarch_ipi_read(unsigned size, uint64_t addr, uint64_t val) "size: %u addr: 0x%"PRIx64 "val: 0x%"PRIx64 loongarch_ipi_write(unsigned size, uint64_t addr, uint64_t val) "size: %u addr: 0x%"PRIx64 "val: 0x%"PRIx64 -loongarch_ipi_unsupported_cpuid(const char *s, uint32_t cpuid) "%s unsupported cpuid 0x%" PRIx32 - # loongarch_pch_pic.c loongarch_pch_pic_irq_handler(int irq, int level) "irq %d level %d" loongarch_pch_pic_low_readw(unsigned size, uint64_t addr, uint64_t val) "size: %u addr: 0x%"PRIx64 "val: 0x%" PRIx64