Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp6232295imm; Mon, 27 Aug 2018 12:00:44 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda1xNiWhuUSC2La1i25JMJ7ZtEfyoBmQkcXeJXjWONKcsHGXipncQs5Tjs9d+BJyv0SEmGe X-Received: by 2002:a17:902:ac8f:: with SMTP id h15-v6mr14188013plr.161.1535396444557; Mon, 27 Aug 2018 12:00:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535396444; cv=none; d=google.com; s=arc-20160816; b=oh2F+XDExa0DVmxM60D3pO4YwyHc3h3GNTKiujV8H/XeSxKuqd+O4yg2ynEqCGcZVn zQZZf0+4p1CVRqdrUAlu13ETkpYyUTaWzI8UH/5LGtZQtEOSY4aoqm9yxab+5g3XbAQQ Mj7FWU+pheOj/Wr1zfe/F6ejY73uzJac+ZRAOrYlfo1AK48oEInkclE081TseYuE+eV6 8RFJWPl7xwMZcEJDRnEFsSZ5nlteWA4vIzfUWxq+0nhZ2UX7OkSQ+TUVxrdFFXQlKzPK IGjL3whpmi+tXiBWWcW3QPBJAyKdejx0FLKTKBSVG9OoaLdYKc4a4kva4u2nxkEnhzp0 IJuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:from:cc:references:in-reply-to :message-id:date:subject:dkim-signature:arc-authentication-results; bh=Mf1CUNt9aY5s1Fk8Qz6A3zvNqfxMlvET8CozUWm+yGc=; b=ZzF8DfPlpz+iDmBDMn6SY0I07q+p+zsS/UGNeFps2FrSYxBJ78V3E1fsZ0OhBp79re 8EA3pFq8coK0P7owLbp5HrR49B98ahKHowlO0/SQQChPNppuVob5m4KMXPBCl2Kba59v lHrJchzgiddHSVq1ko0AGBj7BdR3751W1bNTsJWGJ/nYm1kLvmDUoHlxj3U8iVz+9iZx gaHRxU5/RdgW4OkC27OmNXXZxZ9NZezzjud0JdxyVzJ4N6ddZeWsxbyEB6vYlWV5kJFg /WEplxGzDdRrf/0mVsqiAdqSyn+oSVUxnuWnu7Pb9T6Wk+3ryucYpcT4YaRhZzlQkSeK vjmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=Lk1A2TOl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 94-v6si25676plb.59.2018.08.27.12.00.28; Mon, 27 Aug 2018 12:00:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=Lk1A2TOl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727871AbeH0Wqa (ORCPT + 99 others); Mon, 27 Aug 2018 18:46:30 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:36546 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726826AbeH0Wqa (ORCPT ); Mon, 27 Aug 2018 18:46:30 -0400 Received: by mail-pf1-f196.google.com with SMTP id b11-v6so11899pfo.3 for ; Mon, 27 Aug 2018 11:58:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=subject:date:message-id:in-reply-to:references:cc:from:to; bh=Mf1CUNt9aY5s1Fk8Qz6A3zvNqfxMlvET8CozUWm+yGc=; b=Lk1A2TOlLTVLMWvZSNDtCLbHkBm8rITG0vKxP46FTqx6Yf0CLNY0wycGQriezg4Y/3 M7k2u+ru/ZxeDfjGAjs72ezTIEhIf8BZ5KiO5wQMuL/3zD5Mkf1Rc75BLrneDrN1PIkl XROi63SMScQPp0wMlVPug6X9UCuXNcyrDw51kCxUut+cCA/MbmKAtinQ4l6fmQ/Ukm1a mPkqxfNR6FL/4meZ1IJVAcN5Z8Pxga5P8B0hyUocmMXCZm8gy2vdZLwOmvDCI4UpeqbJ O9XSi+qbWzWOKJY8H1xOORqAmcIrfgux6VSQefDGU2bOrU7DOeMDfpJ2u/dBwcUnD/9k v+Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :cc:from:to; bh=Mf1CUNt9aY5s1Fk8Qz6A3zvNqfxMlvET8CozUWm+yGc=; b=BO3WldcWqQo0p8zsw5ER6RlPjXTSHp/mW9YlGbAl3MHaEXlZJ1GW0VAMx+0L/xjaBW 654sE3l6fzA5zzcz5QyuRjFBzgteEmKsBTHaCmS/0VvtetqeztOV1YuHzHqYpePQm0Y7 IrTbzYV3nUCYpfdf9lbuJJE3d9UumaoL8+oYBqZpSqYhK/X06YfNBlYyN1WXf0NrWi/+ ZVnU6TpU4f5GxhnK8razYroydDxj6SBmh8vSMIR0d0r36LbLjF/9Vwu/KB6M+hTFlj/M mLzPMstue7/Z3cIVTH+pYvr9NPn35ghAUOlr8SpTuYfEb1lbHxXZhWbT5y5/wQFQ+E7p ZNMw== X-Gm-Message-State: APzg51ABygZHUbf5e+HLuo0gBZEgbJ7y/Mn86WpUNfAaCQi/Jnd2KIq/ Wl0jR5zGaC48dDVriXOiiTHRHQ== X-Received: by 2002:a65:668f:: with SMTP id b15-v6mr13517996pgw.426.1535396319788; Mon, 27 Aug 2018 11:58:39 -0700 (PDT) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id w72-v6sm14999pfa.26.2018.08.27.11.58.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Aug 2018 11:58:38 -0700 (PDT) Subject: [PATCH 1/8] RISC-V: Provide a cleaner raw_smp_processor_id() Date: Mon, 27 Aug 2018 11:42:36 -0700 Message-Id: <20180827184243.25344-2-palmer@sifive.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180827184243.25344-1-palmer@sifive.com> References: <20180827184243.25344-1-palmer@sifive.com> Cc: Palmer Dabbelt , aou@eecs.berkeley.edu, daniel.lezcano@linaro.org, tglx@linutronix.de, jason@lakedaemon.net, marc.zyngier@arm.com, atish.patra@wdc.com, dmitriy@oss-tech.org, catalin.marinas@arm.com, ard.biesheuvel@linaro.org, Greg KH , jeremy.linton@arm.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org From: Palmer Dabbelt To: linux-riscv@lists.infradead.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I'm not sure how I managed to miss this the first time, but this is much better. Signed-off-by: Palmer Dabbelt --- arch/riscv/include/asm/smp.h | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/arch/riscv/include/asm/smp.h b/arch/riscv/include/asm/smp.h index 36016845461d..27fd085188df 100644 --- a/arch/riscv/include/asm/smp.h +++ b/arch/riscv/include/asm/smp.h @@ -14,11 +14,6 @@ #ifndef _ASM_RISCV_SMP_H #define _ASM_RISCV_SMP_H -/* This both needs asm-offsets.h and is used when generating it. */ -#ifndef GENERATING_ASM_OFFSETS -#include -#endif - #include #include @@ -33,13 +28,12 @@ void arch_send_call_function_ipi_mask(struct cpumask *mask); /* Hook for the generic smp_call_function_single() routine. */ void arch_send_call_function_single_ipi(int cpu); -/* - * This is particularly ugly: it appears we can't actually get the definition - * of task_struct here, but we need access to the CPU this task is running on. - * Instead of using C we're using asm-offsets.h to get the current processor - * ID. - */ -#define raw_smp_processor_id() (*((int*)((char*)get_current() + TASK_TI_CPU))) +/* Obtains the hart ID of the currently executing task. This relies on + * THREAD_INFO_IN_TASK, but we define that unconditionally. */ +#ifdef CONFIG_THREAD_INFO_IN_TASK +#define get_ti() ((struct thread_info *)get_current()) +#define raw_smp_processor_id() (get_ti()->cpu) +#endif #endif /* CONFIG_SMP */ -- 2.16.4