Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp615642rdb; Thu, 18 Jan 2024 13:22:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IFO1mKiOSAwG3WbBNi3OtSKTQS6kKM+nH54YB9Lum/9PGKHoXFpfiDALjL3cnuTFZEozust X-Received: by 2002:a05:6a00:178c:b0:6d9:8453:e040 with SMTP id s12-20020a056a00178c00b006d98453e040mr1973443pfg.1.1705612967358; Thu, 18 Jan 2024 13:22:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705612967; cv=pass; d=google.com; s=arc-20160816; b=a6RpSHdfYn+GZLU38Pi+8PyI53F9TLlh5x6oFFvDWfmhVDKU1bwlkBrebwFdH2PPDA 8q/KfaUjTeb0+D/olBivCk97PbUidrMxoX9jhqXda/jz81J9SvrfPRFdTv8GmgNVMNbe T5qiAhuQQ0S/nYdrsTNWh7uGJy27nsmUPblQPIb4PSdTjZ79WGwLTg5DJEQrkyMGOztm N2MgARWUExCO1nbVnclSjk6P4uqbHMyrOB/msaVQ5RQHS3MCqptNYlxOA/gJOd+GWjNb Am+8hp0RZmENOQRJzHXRRA+gPEKhlSPAsZTk3meIhFUWK36N+6ghFuL1miuihvfgtcY4 /8vQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=urN5IOlkkqGseby2zF94lkjsWOAoFsi6eWXRkVQaSnc=; fh=3tiMMrwRDwqb9kzdUNUrzisfVdDSdCt4FSz4M4uENNg=; b=usVrQ+HM4GiiTepAFBeUGGKkussOn8DeQoi4vjkfcs7EZHwgvpZJM734MrvZRAICxF joIfiOzx6oIWBJN602uWZgNH2PzWXdwqvT5tUIk62pjoIsFjUq9CvUrgc26a5wFusr8p XHFSSalakaMGqGI05NNoOqqudzxb2rgyT5Otv/I3ivdbu4J2u+s6fDSc+MZ0vmuwrDIv DbCCmlYqOrWgB+JgtLBCcATp44VCytm8fyrgiD+B3+D+JOHHmii7sH/3OrcN6/BtalGH Q5h6IzmlxWqo9MIIleneT2ceMEy1aBG29XQnUXcLjNh74vr68rTx9xwse+B0A57MgQrJ Esww== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="Fn/pJhct"; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-30573-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30573-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id h8-20020a056a00000800b006dae568dd5bsi4225053pfk.273.2024.01.18.13.22.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 13:22:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30573-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="Fn/pJhct"; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-30573-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30573-linux.lists.archive=gmail.com@vger.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 5D63A285551 for ; Thu, 18 Jan 2024 21:21:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3418331734; Thu, 18 Jan 2024 21:21:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="Fn/pJhct" Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B39092EAF9 for ; Thu, 18 Jan 2024 21:21:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705612889; cv=none; b=XMFrh6DEkq5Er/Al/ZRUYxhN4PEMLOMIg4EKAPNweV8vLQ0AMMvUK4HicCwahrHPJecS3dzkOPfoqrgE9zAJ1j1fau659AYeyqSUtmzAHeHT2+CJjJGoUpYZkcmrlYaazo9QShaWxL/lgSDmtz2mfQmFNyC2ok7JPud10jHNSr4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705612889; c=relaxed/simple; bh=+NyDWna56jKRxjX4nRCOG0ayBgfwHK46u0ayzUjMQuo=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=kC8HOIVunWdlZoX+5zJlSqoojtaFUQRUP4ufcOHWRVbqj8pTxOAxE4J76uZP6cE5n6wdw62PVONUmf7pw2VMgomwRb/m9TAHZAm6VCmmbEIJidswrVudY/l+PMNYA4hQZSBidDWVqnD4vTAGZjQ7nCnHg4KY8nEePkOYv8t+DJU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=Fn/pJhct; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-40e8ddebc71so794765e9.2 for ; Thu, 18 Jan 2024 13:21:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1705612885; x=1706217685; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=urN5IOlkkqGseby2zF94lkjsWOAoFsi6eWXRkVQaSnc=; b=Fn/pJhctyfPAKKLVGIPE8Q37KC/7/TFNA6MFljCJmjNPdR0zxrXA0ACuEITw1V//eP hsG4qp6J9IMs+MRuxyS/Y9V3ZYnl3anJurzjpbBHCegLdxjtxqLxwjstMcT/XjNO7/1y 8wAknVUkBQqO8T366XNQHVGzR+QZJiZxbk40Ot+vUtVP7kH3JTx9aOXQeyyIrJ970bAk ggN7IE5d6SPcVg4H0/hAEcHfUNRIVOaJKUigo539RtIDEZH1pGqBTIg/nhGHA5CmDv9S tey0/dtPL2DlRJyKvNRj6EpEMbSZTK+mkxZ4Xb/3qRXQ1/Ha5NR0OynSrzH96ezjlYcQ EuPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705612885; x=1706217685; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=urN5IOlkkqGseby2zF94lkjsWOAoFsi6eWXRkVQaSnc=; b=Je6papXPMMT3CLhsrPnXAQvXsRnplVIZRK2O2RbqupxnZ2Q3C2+Lv3OaUMjDmU2RHY WufuBUizvkB7bifYv7G3USyXQdCnxqc4Kz6e3AU8ySB04Vmh/Qn9WymX3S2N0NRkHpjH 0hmqYMoK0otDQbp/vi/yUeEUhwcfogPcq6MScLse2AmKYeLvRVdlVEejOGn1gRlkz7X0 Y4ARfNqJdI6a0CIq5v0YeeuYj64KHyP8FxjQTLpUkdmu5fzimJAvUiDkgNOXK1GMlyLU K3eL7Z9g5GwixgtrhoCCkB0yBqDp7gaclk27OReG24dQx8q1PE7+G+99IDPjYn/UWPpw romQ== X-Gm-Message-State: AOJu0YzHjCRDU99LufQ5R8eRi4IZPl/YUOx3WbgX8pH5WTDh/X4ww1F1 pPaauB07pq6T+mUmm+1mjeiVd312xeH7Mbr37SiptZ264sDJjsmX6haO3mgm0Ec= X-Received: by 2002:a05:600c:6557:b0:40e:52fa:9e5f with SMTP id dn23-20020a05600c655700b0040e52fa9e5fmr909250wmb.63.1705612884943; Thu, 18 Jan 2024 13:21:24 -0800 (PST) Received: from localhost.localdomain (amontpellier-656-1-456-62.w92-145.abo.wanadoo.fr. [92.145.124.62]) by smtp.gmail.com with ESMTPSA id q20-20020a05600c46d400b0040e395cd20bsm30740992wmo.7.2024.01.18.13.21.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 13:21:24 -0800 (PST) From: Alexandre Ghiti To: Randy Dunlap , Stephen Rothwell , Linux Next Mailing List , Paul Walmsley , Palmer Dabbelt , Albert Ou , Frederik Haxel , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Alexandre Ghiti Subject: [PATCH] riscv: Fix build error on rv32 + XIP Date: Thu, 18 Jan 2024 22:21:20 +0100 Message-Id: <20240118212120.2087803-1-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit commit 66f1e6809397 ("riscv: Make XIP bootable again") restricted page offset to the sv39 page offset instead of the default sv57, which makes sense since probably the platforms that target XIP kernels do not support anything else than sv39 and we do not try to find out the largest address space supported on XIP kernels (ie set_satp_mode()). But PAGE_OFFSET_L3 is not defined for rv32, so fix the build error by restoring the previous behaviour which picks CONFIG_PAGE_OFFSET for rv32. Fixes: 66f1e6809397 ("riscv: Make XIP bootable again") Reported-by: Randy Dunlap Closes: https://lore.kernel.org/linux-riscv/344dca85-5c48-44e1-bc64-4fa7973edd12@infradead.org/T/#u Signed-off-by: Alexandre Ghiti --- arch/riscv/mm/init.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index f533dd667a83..32cad6a65ccd 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -1060,7 +1060,11 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa) kernel_map.virt_addr = KERNEL_LINK_ADDR + kernel_map.virt_offset; #ifdef CONFIG_XIP_KERNEL +#ifdef CONFIG_64BIT kernel_map.page_offset = PAGE_OFFSET_L3; +#else + kernel_map.page_offset = _AC(CONFIG_PAGE_OFFSET, UL); +#endif kernel_map.xiprom = (uintptr_t)CONFIG_XIP_PHYS_ADDR; kernel_map.xiprom_sz = (uintptr_t)(&_exiprom) - (uintptr_t)(&_xiprom); -- 2.39.2