Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp504891rbb; Sat, 24 Feb 2024 09:42:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWAbPLMw4jVhgTvY2oW4EDFBw9PFKmiyX3EDw2y3nz9qe+bVV4tTJks7/d69TWJhwoAJRls+cXR/codfKBbZrW94+xrlFUV7v3hecjDbA== X-Google-Smtp-Source: AGHT+IFlyz2HPlAiRKf7fAJvBMaSSZN0suv8N/tsFnDGm07494sIhI4G9pgO+5ffcQVfXY/0QT2m X-Received: by 2002:a05:6358:2495:b0:17b:88c2:5c13 with SMTP id m21-20020a056358249500b0017b88c25c13mr3838969rwc.7.1708796572904; Sat, 24 Feb 2024 09:42:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708796572; cv=pass; d=google.com; s=arc-20160816; b=J6444t5OHCphcJL6oHWD352De+q/qIspomhMeWny1yDM+6Gl4PCLKzSZM96Ku10X0t /NlEfp5D3hHQ+E30xA8rFjyScMRbpAnABBVbf7N9ttThvC0/c1kssuREPkuzDmfCZaQ6 IJ9vryHxcoqqB+fxYZbilOYj8c/HDIFoXZbBX7DgGPR8a9TZ+UzklyyV14PP/myMm7z5 BPUa577RQ2Ot/MJnSnqcFhOeNJdG3Cxk98qNFI3bRqBeTi1cUbujXhlgXxnkl7R7ujUk 5gTPB5XU7Igt9YTcrlz0B09lJG4A9NOqf+hM4FdTPmSiIwLL+553kIipyq1TSYvu4KwN fwwg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=reply-to:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:date:from:dkim-signature; bh=dpwYUz+pjbegrNW0qAQPtS6j2wHaKyvmy+DOUTu854s=; fh=axaiTczyEibQIAZR7tL5HdXpt5eDXppl7AUtI52L8OM=; b=KUITqsbLKeOICp7u3DJi2q4oCaWuN2kiQ+pwXyrVUOHw2uVTWpKGegAYDRav6+C4Ds 9dv+JdYHHhX1j8zmjCIech34UvMPL0A/141eE7TboBbB8K4NewREOk8y+PMEQDwYh6nq xot3QMVIj+Bv6djS3p1+eZECFIgp8ETCQFDa8Bf/Ewe9H9WcujNdEA3abuKIvCxTrVJ4 ObRdba0nlK9K5fZuXNbpXHuxolxlLKh8GUA3vVu9m1oHHSJZry1wt7zdev5PoohNX3ld KNAzel4i7laV0NBuZ7Rx2TMVJrvYkuBsPRha6zS5tftkJ1xb3kWtpTEk94G3+hbIkVBc SxTA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tHtWOHbP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-79763-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79763-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q12-20020a63f94c000000b005e438e96c48si1160187pgk.164.2024.02.24.09.42.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 09:42:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79763-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tHtWOHbP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-79763-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79763-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8EB16282829 for ; Sat, 24 Feb 2024 17:42:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F70E4C624; Sat, 24 Feb 2024 17:42:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tHtWOHbP" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4134C47A6B; Sat, 24 Feb 2024 17:42:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708796547; cv=none; b=AHG6tMwUU3gm6AjQe8j5rgFKgjr7LvfshD2v30ZB+EB7UAYbNZpNJ5HOvlv7lxy9WQLAm8o7XVtxK5SDaHFiW8ShHv196IlWmsrJQ+svrII3OalhIgxYHx1emIr6uat+dLk9am70tmMLJNtPFX4y+sIvQI8zYwTjAgxk35SBNok= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708796547; c=relaxed/simple; bh=bGfNa9P0bcSr1b3FZ6CzcNWFHSx5/mcdtp5dllWw6FY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DCPwkug7Rk1gd32M1GjT9QoAyXfelMJRbrZhZ0WrzB1cqpHQWpMyIP5CgxaDvwm1HGfFogb8PqeGIPOkM16aeJsHGskpeZnnpEwjomH8G+R3M8KWdVDhF33aKnXzhZvB1IwTIw/ob0V5ILpyx6F4jVvE45DifzV6nqAwl5zuDGc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tHtWOHbP; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id F3FBCC43390; Sat, 24 Feb 2024 17:42:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708796547; bh=bGfNa9P0bcSr1b3FZ6CzcNWFHSx5/mcdtp5dllWw6FY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=tHtWOHbPkr46dvIZ4Ubq0+uhrNV29D3fsqWKnp0cg3Z62cXU2E7HbP3xQF9F+5He0 WhYC8Jh7CyEbv9Y6qbZwMxuS/8WYVu3rs+pRZwmtNoEXp/s+nHWoc4ixzBpWrCHyJN CsJpOzK8wTKUlGXSAEymJj3cfw443AbvgPVBEzPimCMq+1Le5bPHTqSdbMVlV+q0Ap m1MKCftBrWlA+TqQFg9gxkZqKX33doaBgvWHr++KS9902f/TDPQId7U2mkagf1PhKb KJDE7fa8oiBFyUDUmga1t2pbA4ChOgDKrQBQ6XA0yI8gUBTF/Mz634MdGCDsxSBth6 Ks4Zu63LwbfCQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3049C54E4F; Sat, 24 Feb 2024 17:42:26 +0000 (UTC) From: Sam Ravnborg via B4 Relay Date: Sat, 24 Feb 2024 18:42:23 +0100 Subject: [PATCH v2 2/7] sparc32: Fix build with trapbase Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240224-sam-fix-sparc32-all-builds-v2-2-1f186603c5c4@ravnborg.org> References: <20240224-sam-fix-sparc32-all-builds-v2-0-1f186603c5c4@ravnborg.org> In-Reply-To: <20240224-sam-fix-sparc32-all-builds-v2-0-1f186603c5c4@ravnborg.org> To: "Maciej W. Rozycki" , sparclinux@vger.kernel.org, Andreas Larsson , Randy Dunlap Cc: Miquel Raynal , linux-parport@lists.infradead.org, "David S. Miller" , Arnd Bergmann , linux-kernel@vger.kernel.org, Sam Ravnborg X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708796545; l=4806; i=sam@ravnborg.org; s=20230107; h=from:subject:message-id; bh=yODVsKtXRLRL5P00tESgJdJda/SYlfy6l2Y847zfeCU=; =?utf-8?q?b=3D9FtF0vthGV5K?= =?utf-8?q?V/hPt5Yc5TbLmZTI0ewIdffIWFA7tPr+zMCJ1cWT6xw/uPgyN67nKD8Ds9tpzUpF?= so4wk2r8AiAQBjVYbWLaHrouAw+VOauFmCspxcSiA8y0iTb2VBVv X-Developer-Key: i=sam@ravnborg.org; a=ed25519; pk=R0+pqV7BRYOAeOIGkyOrSNke7arx5y3LkEuNi37YEyU= X-Endpoint-Received: by B4 Relay for sam@ravnborg.org/20230107 with auth_id=22 X-Original-From: Sam Ravnborg Reply-To: From: Sam Ravnborg Fix the following build errors: irq_32.c:258:7: error: array subscript [16, 79] is outside array bounds of 'struct tt_entry[1] irq_32.c:271:14: error: assignment to 'struct tt_entry *' from incompatible pointer type 'struct tt_entry (*)[] trapbase is a pointer to an array of tt_entry, but the code declared it as a pointer so the compiler see a single entry and not an array. Fix this by modifyinf the declaration to be an array, and modify all users to take the address of the first member. Signed-off-by: Sam Ravnborg Acked-by: Randy Dunlap Tested-by: Randy Dunlap # build-tested Cc: Andreas Larsson Cc: "David S. Miller" --- arch/sparc/kernel/irq_32.c | 6 +++--- arch/sparc/kernel/kernel.h | 8 ++++---- arch/sparc/kernel/kgdb_32.c | 4 ++-- arch/sparc/kernel/leon_smp.c | 6 +++--- arch/sparc/kernel/setup_32.c | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/arch/sparc/kernel/irq_32.c b/arch/sparc/kernel/irq_32.c index e8452be5123b..8605dd710f3c 100644 --- a/arch/sparc/kernel/irq_32.c +++ b/arch/sparc/kernel/irq_32.c @@ -268,11 +268,11 @@ int sparc_floppy_request_irq(unsigned int irq, irq_handler_t irq_handler) if (sparc_cpu_model != sparc_leon) { struct tt_entry *trap_table; - trap_table = &trapbase_cpu1; + trap_table = &trapbase_cpu1[0]; INSTANTIATE(trap_table) - trap_table = &trapbase_cpu2; + trap_table = &trapbase_cpu2[0]; INSTANTIATE(trap_table) - trap_table = &trapbase_cpu3; + trap_table = &trapbase_cpu3[0]; INSTANTIATE(trap_table) } #endif diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h index 15da3c0597a5..a8fb7c0bf053 100644 --- a/arch/sparc/kernel/kernel.h +++ b/arch/sparc/kernel/kernel.h @@ -138,10 +138,10 @@ extern unsigned int t_nmi[]; extern unsigned int linux_trap_ipi15_sun4d[]; extern unsigned int linux_trap_ipi15_sun4m[]; -extern struct tt_entry trapbase; -extern struct tt_entry trapbase_cpu1; -extern struct tt_entry trapbase_cpu2; -extern struct tt_entry trapbase_cpu3; +extern struct tt_entry trapbase[]; +extern struct tt_entry trapbase_cpu1[]; +extern struct tt_entry trapbase_cpu2[]; +extern struct tt_entry trapbase_cpu3[]; extern char cputypval[]; diff --git a/arch/sparc/kernel/kgdb_32.c b/arch/sparc/kernel/kgdb_32.c index 58ad3f7de1fb..3b2c673ec627 100644 --- a/arch/sparc/kernel/kgdb_32.c +++ b/arch/sparc/kernel/kgdb_32.c @@ -37,7 +37,7 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) gdb_regs[GDB_Y] = regs->y; gdb_regs[GDB_PSR] = regs->psr; gdb_regs[GDB_WIM] = 0; - gdb_regs[GDB_TBR] = (unsigned long) &trapbase; + gdb_regs[GDB_TBR] = (unsigned long) &trapbase[0]; gdb_regs[GDB_PC] = regs->pc; gdb_regs[GDB_NPC] = regs->npc; gdb_regs[GDB_FSR] = 0; @@ -72,7 +72,7 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p) gdb_regs[GDB_PSR] = t->kpsr; gdb_regs[GDB_WIM] = t->kwim; - gdb_regs[GDB_TBR] = (unsigned long) &trapbase; + gdb_regs[GDB_TBR] = (unsigned long) &trapbase[0]; gdb_regs[GDB_PC] = t->kpc; gdb_regs[GDB_NPC] = t->kpc + 4; gdb_regs[GDB_FSR] = 0; diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c index 991e9ad3d3e8..1ee393abc463 100644 --- a/arch/sparc/kernel/leon_smp.c +++ b/arch/sparc/kernel/leon_smp.c @@ -245,13 +245,13 @@ void __init leon_smp_done(void) /* Free unneeded trap tables */ if (!cpu_present(1)) { - free_reserved_page(virt_to_page(&trapbase_cpu1)); + free_reserved_page(virt_to_page(&trapbase_cpu1[0])); } if (!cpu_present(2)) { - free_reserved_page(virt_to_page(&trapbase_cpu2)); + free_reserved_page(virt_to_page(&trapbase_cpu2[0])); } if (!cpu_present(3)) { - free_reserved_page(virt_to_page(&trapbase_cpu3)); + free_reserved_page(virt_to_page(&trapbase_cpu3[0])); } /* Ok, they are spinning and ready to go. */ smp_processors_ready = 1; diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c index e3b72a7b46d3..704375c061e7 100644 --- a/arch/sparc/kernel/setup_32.c +++ b/arch/sparc/kernel/setup_32.c @@ -67,7 +67,7 @@ static void prom_sync_me(void) __asm__ __volatile__("wr %0, 0x0, %%tbr\n\t" "nop\n\t" "nop\n\t" - "nop\n\t" : : "r" (&trapbase)); + "nop\n\t" : : "r" (&trapbase[0])); prom_printf("PROM SYNC COMMAND...\n"); show_mem(); @@ -285,7 +285,7 @@ void __init setup_arch(char **cmdline_p) int i; unsigned long highest_paddr; - sparc_ttable = &trapbase; + sparc_ttable = &trapbase[0]; /* Initialize PROM console and command line. */ *cmdline_p = prom_getbootargs(); -- 2.34.1