Received: by 10.223.164.202 with SMTP id h10csp4168983wrb; Mon, 20 Nov 2017 11:00:08 -0800 (PST) X-Google-Smtp-Source: AGs4zMZKo89hFFyZJjAEyS0Mx5wz8MGyEpD8auuRFFy+UXG7zcWHezwMEh2q5wvedsweB8QRC9cr X-Received: by 10.101.97.167 with SMTP id i7mr14395911pgv.449.1511204408162; Mon, 20 Nov 2017 11:00:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511204408; cv=none; d=google.com; s=arc-20160816; b=IN8KgwQKANDb2rYc3SDZyVPI+WG70MXYm1T7M/4QdENecUHlMBkeIDkjqQvBAPd2fq Hzdj9HgeUqwg8aODP4MgcsyNxxSfetC6x1rJHsVAYIWJh8fx3+bqzCz0VQV/z6MXkROJ YcJr1eCp+hHQ74YdFTPkWkZewZ1xL//EaTTMSt51iL4aUSHasS/wqiu8ArO1nOaSlQzR XUqd9DYRvvTpa+H4SApDD3On7XU8r2WkBnccuDHcotwsc/f+dTelAxj7Yeuvpc39Rpek 6EukRDdgvm/+q4WqjZ02joCEMraVrmwZP8hfQ7FpRIy7BlOFOp2fmYeCDhiJM57rMSKO u/bQ== 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:arc-authentication-results; bh=EU9LGsU09h4pjWLxovkT6Zw7O0qVA+EDZLZzB1yyf4k=; b=fencHGV+1he3idZHlSyr+aVqpGTSwvCvsYxUabM7slAZQs7evP1Y40huOjWr3VRtnR lKURz9rGk8zUoEld38Oia67mhj/L+e+j/f6uP2seBnsbQ0feqijzGSc5wOQ13qEi040Z 0Wx0fKaQmlcR8WLQTOMbgi4iGmwwjw7qIqOhaVpN8cHu/xXesKbn+wGdQKFkYS4q/4no qiNvcRrDxA15oo6H4KZFuKoCRhi6EqloyBazJeiwbUj9VIupJJVrJapdcnTHRdcTbZfQ M2LXu1J+TWkJgi9xh4YX/HPIius228qJ991svyAK5DFwD5irEF7H2ufKdi2CvpntCkcb QUtA== ARC-Authentication-Results: i=1; mx.google.com; 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 r59si3782316plb.314.2017.11.20.10.59.58; Mon, 20 Nov 2017 11:00:08 -0800 (PST) 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; 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 S1752488AbdKTS6b (ORCPT + 67 others); Mon, 20 Nov 2017 13:58:31 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:34619 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752228AbdKTS6A (ORCPT ); Mon, 20 Nov 2017 13:58:00 -0500 Received: by mail-pf0-f193.google.com with SMTP id x7so7951644pfa.1 for ; Mon, 20 Nov 2017 10:58:00 -0800 (PST) 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=EU9LGsU09h4pjWLxovkT6Zw7O0qVA+EDZLZzB1yyf4k=; b=JuCsWJerSZTmXvO0L7CFREyK6Pkst6bN/YpHIKUtCuy/Ete23wGgZxknKIvYpcul4O Y0NdM7Ak35IL+WhQJwe/lbMc+12Ixb3KXC2sVj9zNJBv1fIAtxp2/eWkEYvUdIomptQP qgXMWoY3vTkdxZsB8S5cziI0r+CNcGquOXtQkph+9AOGrfdxPaPn5oQxLMZ9MdtTmLRz 5i2sZjKBRhqfs0FtRB1EJrnl9lN65x1bqZhcyiZYt6aHNbU9nZ8Hqrs96CVul5+UHcL5 Yk/7E4+/rkYRMII+d2hYJid7LSq3C/3aKpijEBinKRDUWVyt0gfeJjkWnNEKR3V/QyO8 5ubg== X-Gm-Message-State: AJaThX7XHUCLn6SB1vsS5ou0az/Op3rGA6QaS/G875TVvoWqGJGeIfBF cZnXPNOslVg02RoE+8JdyTvdmAsvsrU= X-Received: by 10.99.98.67 with SMTP id w64mr14685679pgb.213.1511204279862; Mon, 20 Nov 2017 10:57:59 -0800 (PST) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id k89sm22072337pfb.104.2017.11.20.10.57.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Nov 2017 10:57:59 -0800 (PST) Subject: [PATCH 2/4] RISC-V: Add VDSO entries for clock_get/gettimeofday/getcpu Date: Mon, 20 Nov 2017 10:57:43 -0800 Message-Id: <20171120185745.30795-3-palmer@sifive.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171120185745.30795-1-palmer@sifive.com> References: <20171120185745.30795-1-palmer@sifive.com> Cc: patches@groups.riscv.org, Andrew Waterman , Palmer Dabbelt From: Palmer Dabbelt To: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrew Waterman For now these are just placeholders that execute the syscall. We will later optimize them to avoid kernel crossings, but we'd like to have the VDSO entries from the first released kernel version to make the ABI simpler. Signed-off-by: Andrew Waterman Signed-off-by: Palmer Dabbelt --- arch/riscv/kernel/vdso/Makefile | 6 +++++- arch/riscv/kernel/vdso/clock_getres.S | 26 ++++++++++++++++++++++++++ arch/riscv/kernel/vdso/clock_gettime.S | 26 ++++++++++++++++++++++++++ arch/riscv/kernel/vdso/getcpu.S | 26 ++++++++++++++++++++++++++ arch/riscv/kernel/vdso/gettimeofday.S | 26 ++++++++++++++++++++++++++ arch/riscv/kernel/vdso/vdso.lds.S | 4 ++++ 6 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 arch/riscv/kernel/vdso/clock_getres.S create mode 100644 arch/riscv/kernel/vdso/clock_gettime.S create mode 100644 arch/riscv/kernel/vdso/getcpu.S create mode 100644 arch/riscv/kernel/vdso/gettimeofday.S diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile index 523d0a8ac8db..2dcc4f3070bc 100644 --- a/arch/riscv/kernel/vdso/Makefile +++ b/arch/riscv/kernel/vdso/Makefile @@ -1,7 +1,11 @@ # Copied from arch/tile/kernel/vdso/Makefile # Symbols present in the vdso -vdso-syms = rt_sigreturn +vdso-syms = rt_sigreturn +vdso-syms += gettimeofday +vdso-syms += clock_gettime +vdso-syms += clock_getres +vdso-syms += getcpu # Files to link into the vdso obj-vdso = $(patsubst %, %.o, $(vdso-syms)) diff --git a/arch/riscv/kernel/vdso/clock_getres.S b/arch/riscv/kernel/vdso/clock_getres.S new file mode 100644 index 000000000000..edf7e2339648 --- /dev/null +++ b/arch/riscv/kernel/vdso/clock_getres.S @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2017 SiFive + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include + + .text +/* int __vdso_clock_getres(clockid_t clock_id, struct timespec *res); */ +ENTRY(__vdso_clock_getres) + .cfi_startproc + /* For now, just do the syscall. */ + li a7, __NR_clock_getres + ecall + ret + .cfi_endproc +ENDPROC(__vdso_clock_getres) diff --git a/arch/riscv/kernel/vdso/clock_gettime.S b/arch/riscv/kernel/vdso/clock_gettime.S new file mode 100644 index 000000000000..aac65676c6d5 --- /dev/null +++ b/arch/riscv/kernel/vdso/clock_gettime.S @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2017 SiFive + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include + + .text +/* int __vdso_clock_gettime(clockid_t clock_id, struct timespec *tp); */ +ENTRY(__vdso_clock_gettime) + .cfi_startproc + /* For now, just do the syscall. */ + li a7, __NR_clock_gettime + ecall + ret + .cfi_endproc +ENDPROC(__vdso_clock_gettime) diff --git a/arch/riscv/kernel/vdso/getcpu.S b/arch/riscv/kernel/vdso/getcpu.S new file mode 100644 index 000000000000..cc7e98924484 --- /dev/null +++ b/arch/riscv/kernel/vdso/getcpu.S @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2017 SiFive + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include + + .text +/* int __vdso_getcpu(unsigned *cpu, unsigned *node, void *unused); */ +ENTRY(__vdso_getcpu) + .cfi_startproc + /* For now, just do the syscall. */ + li a7, __NR_getcpu + ecall + ret + .cfi_endproc +ENDPROC(__vdso_getcpu) diff --git a/arch/riscv/kernel/vdso/gettimeofday.S b/arch/riscv/kernel/vdso/gettimeofday.S new file mode 100644 index 000000000000..da85d33e8990 --- /dev/null +++ b/arch/riscv/kernel/vdso/gettimeofday.S @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2017 SiFive + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include + + .text +/* int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz); */ +ENTRY(__vdso_gettimeofday) + .cfi_startproc + /* For now, just do the syscall. */ + li a7, __NR_gettimeofday + ecall + ret + .cfi_endproc +ENDPROC(__vdso_gettimeofday) diff --git a/arch/riscv/kernel/vdso/vdso.lds.S b/arch/riscv/kernel/vdso/vdso.lds.S index 3ac08eebd11d..c7543c6a00f9 100644 --- a/arch/riscv/kernel/vdso/vdso.lds.S +++ b/arch/riscv/kernel/vdso/vdso.lds.S @@ -70,6 +70,10 @@ VERSION LINUX_4.15 { global: __vdso_rt_sigreturn; + __vdso_gettimeofday; + __vdso_clock_gettime; + __vdso_clock_getres; + __vdso_getcpu; local: *; }; } -- 2.13.6 From 1584340977328906809@xxx Fri Nov 17 19:01:38 +0000 2017 X-GM-THRID: 1584340977328906809 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread