* [PATCH v4 6/9] epoll: Add implementation for epoll_pwait1
From: Fam Zheng @ 2015-03-10 1:49 UTC (permalink / raw)
To: linux-kernel
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Alexander Viro,
Andrew Morton, Kees Cook, Andy Lutomirski, David Herrmann,
Alexei Starovoitov, Miklos Szeredi, David Drysdale, Oleg Nesterov,
David S. Miller, Vivek Goyal, Mike Frysinger, Theodore Ts'o,
Heiko Carstens, Rasmus Villemoes, Rashika Kheria, Hugh Dickins,
Mathieu Desnoyers, Fam Zheng, Peter Zijlstra <peter>
In-Reply-To: <1425952155-27603-1-git-send-email-famz@redhat.com>
This is the new implementation for poll which has a flags parameter and
packs a number of parameters into a structure.
The main advantage of it over existing epoll_pwait is about timeout:
epoll_pwait expects a relative millisecond value, while epoll_pwait1
accepts 1) a timespec which is in nanosecond granularity; 2) a clockid
to allow using a clock other than CLOCK_MONOTONIC.
The 'flags' field in params is reserved for now and must be zero. The
next step would be allowing absolute timeout value.
Signed-off-by: Fam Zheng <famz@redhat.com>
---
fs/eventpoll.c | 39 ++++++++++++++++++++++++++++++++++++++-
include/linux/syscalls.h | 5 +++++
include/uapi/linux/eventpoll.h | 8 ++++++++
3 files changed, 51 insertions(+), 1 deletion(-)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 54dc63f..06a59fc 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -2085,7 +2085,6 @@ SYSCALL_DEFINE4(epoll_ctl_batch, int, epfd, int, flags,
cmd_size = sizeof(struct epoll_ctl_cmd) * ncmds;
/* TODO: optimize for small arguments like select/poll with a stack
* allocated buffer */
-
kcmds = kmalloc(cmd_size, GFP_KERNEL);
if (!kcmds)
return -ENOMEM;
@@ -2119,6 +2118,44 @@ out:
return ret;
}
+SYSCALL_DEFINE5(epoll_pwait1, int, epfd, int, flags,
+ struct epoll_event __user *, events,
+ int, maxevents,
+ struct epoll_wait_params __user *, params)
+{
+ struct epoll_wait_params p;
+ ktime_t kt = { 0 };
+ sigset_t sigmask;
+ struct timespec timeout;
+
+ if (flags)
+ return -EINVAL;
+ if (!params)
+ return -EINVAL;
+ if (copy_from_user(&p, params, sizeof(p)))
+ return -EFAULT;
+ if (p.size != sizeof(p))
+ return -EINVAL;
+ if (p.sigmask) {
+ if (copy_from_user(&sigmask, p.sigmask, sizeof(sigmask)))
+ return -EFAULT;
+ if (p.sigsetsize != sizeof(p.sigmask))
+ return -EINVAL;
+ }
+ if (p.timeout) {
+ if (copy_from_user(&timeout, p.timeout, sizeof(timeout)))
+ return -EFAULT;
+ if (!timespec_valid(&timeout))
+ return -EINVAL;
+ kt = timespec_to_ktime(timeout);
+ } else {
+ kt = ns_to_ktime(-1);
+ }
+
+ return epoll_pwait_do(epfd, events, maxevents, p.clockid,
+ kt, p.sigmask ? &sigmask : NULL);
+}
+
#ifdef CONFIG_COMPAT
COMPAT_SYSCALL_DEFINE6(epoll_pwait, int, epfd,
struct epoll_event __user *, events,
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 7d784e3..a4823d9 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -13,6 +13,7 @@
struct epoll_event;
struct epoll_ctl_cmd;
+struct epoll_wait_params;
struct iattr;
struct inode;
struct iocb;
@@ -635,6 +636,10 @@ asmlinkage long sys_epoll_pwait(int epfd, struct epoll_event __user *events,
int maxevents, int timeout,
const sigset_t __user *sigmask,
size_t sigsetsize);
+asmlinkage long sys_epoll_pwait1(int epfd, int flags,
+ struct epoll_event __user *events,
+ int maxevents,
+ struct epoll_wait_params __user *params);
asmlinkage long sys_epoll_ctl_batch(int epfd, int flags,
int ncmds,
struct epoll_ctl_cmd __user *cmds);
diff --git a/include/uapi/linux/eventpoll.h b/include/uapi/linux/eventpoll.h
index 4e18b17..05ae035 100644
--- a/include/uapi/linux/eventpoll.h
+++ b/include/uapi/linux/eventpoll.h
@@ -72,6 +72,14 @@ struct epoll_ctl_cmd {
int result;
} EPOLL_PACKED;
+struct epoll_wait_params {
+ int size;
+ int clockid;
+ struct timespec *timeout;
+ sigset_t *sigmask;
+ size_t sigsetsize;
+} EPOLL_PACKED;
+
#ifdef CONFIG_PM_SLEEP
static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev)
{
--
1.9.3
^ permalink raw reply related
* [PATCH v4 7/9] x86: Hook up epoll_pwait1 syscall
From: Fam Zheng @ 2015-03-10 1:49 UTC (permalink / raw)
To: linux-kernel
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Alexander Viro,
Andrew Morton, Kees Cook, Andy Lutomirski, David Herrmann,
Alexei Starovoitov, Miklos Szeredi, David Drysdale, Oleg Nesterov,
David S. Miller, Vivek Goyal, Mike Frysinger, Theodore Ts'o,
Heiko Carstens, Rasmus Villemoes, Rashika Kheria, Hugh Dickins,
Mathieu Desnoyers, Fam Zheng, Peter Zijlstra <peter>
In-Reply-To: <1425952155-27603-1-git-send-email-famz@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
---
arch/x86/syscalls/syscall_32.tbl | 1 +
arch/x86/syscalls/syscall_64.tbl | 1 +
2 files changed, 2 insertions(+)
diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl
index fe809f6..bf912d8 100644
--- a/arch/x86/syscalls/syscall_32.tbl
+++ b/arch/x86/syscalls/syscall_32.tbl
@@ -366,3 +366,4 @@
357 i386 bpf sys_bpf
358 i386 execveat sys_execveat stub32_execveat
359 i386 epoll_ctl_batch sys_epoll_ctl_batch
+360 i386 epoll_pwait1 sys_epoll_pwait1
diff --git a/arch/x86/syscalls/syscall_64.tbl b/arch/x86/syscalls/syscall_64.tbl
index 67b2ea4..9246ad5 100644
--- a/arch/x86/syscalls/syscall_64.tbl
+++ b/arch/x86/syscalls/syscall_64.tbl
@@ -330,6 +330,7 @@
321 common bpf sys_bpf
322 64 execveat stub_execveat
323 64 epoll_ctl_batch sys_epoll_ctl_batch
+324 64 epoll_pwait1 sys_epoll_pwait1
#
# x32-specific system call numbers start at 512 to avoid cache impact
--
1.9.3
^ permalink raw reply related
* [PATCH v4 8/9] epoll: Add compat version implementation of epoll_pwait1
From: Fam Zheng @ 2015-03-10 1:49 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
x86-DgEjT+Ai2ygdnm+yROfE0A, Alexander Viro, Andrew Morton,
Kees Cook, Andy Lutomirski, David Herrmann, Alexei Starovoitov,
Miklos Szeredi, David Drysdale, Oleg Nesterov, David S. Miller,
Vivek Goyal, Mike Frysinger, Theodore Ts'o, Heiko Carstens,
Rasmus Villemoes, Rashika Kheria, Hugh Dickins, Mathieu Desnoyers,
Fam Zheng, Peter Zijlstra <peter>
In-Reply-To: <1425952155-27603-1-git-send-email-famz-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Fam Zheng <famz-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
fs/eventpoll.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
include/linux/compat.h | 6 ++++++
2 files changed, 56 insertions(+)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 06a59fc..b837ea4 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -2178,6 +2178,56 @@ COMPAT_SYSCALL_DEFINE6(epoll_pwait, int, epfd,
return epoll_pwait_do(epfd, events, maxevents, CLOCK_MONOTONIC, kt,
sigmask ? &ksigmask : NULL);
}
+
+struct compat_epoll_wait_params {
+ int size;
+ int clockid;
+ compat_uptr_t timeout;
+ compat_uptr_t sigmask;
+ compat_size_t sigsetsize;
+} EPOLL_PACKED;
+
+COMPAT_SYSCALL_DEFINE5(epoll_pwait1, int, epfd, int, flags,
+ struct epoll_event __user *, events,
+ int, maxevents,
+ struct compat_epoll_wait_params __user *, params)
+{
+ struct compat_epoll_wait_params p;
+
+ ktime_t kt = { 0 };
+ sigset_t sigmask;
+ compat_sigset_t compat_sigmask;
+ struct timespec timeout;
+
+ if (flags)
+ return -EINVAL;
+ if (!params)
+ return -EINVAL;
+ if (copy_from_user(&p, params, sizeof(p)))
+ return -EFAULT;
+ if (p.size != sizeof(p))
+ return -EINVAL;
+ if (p.sigmask) {
+ if (copy_from_user(&compat_sigmask, compat_ptr(p.sigmask),
+ sizeof(sigmask)))
+ return -EFAULT;
+ if (p.sigsetsize != sizeof(p.sigmask))
+ return -EINVAL;
+ sigset_from_compat(&sigmask, &compat_sigmask);
+ }
+ if (p.timeout) {
+ if (compat_get_timespec(&timeout, compat_ptr(p.timeout)))
+ return -EFAULT;
+ if (!timespec_valid(&timeout))
+ return -EINVAL;
+ kt = timespec_to_ktime(timeout);
+ } else {
+ kt = ns_to_ktime(-1);
+ }
+
+ return epoll_pwait_do(epfd, events, maxevents, p.clockid,
+ kt, p.sigmask ? &sigmask : NULL);
+}
#endif
static int __init eventpoll_init(void)
diff --git a/include/linux/compat.h b/include/linux/compat.h
index ab25814..649c5b2 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -452,6 +452,12 @@ asmlinkage long compat_sys_epoll_pwait(int epfd,
const compat_sigset_t __user *sigmask,
compat_size_t sigsetsize);
+struct compat_epoll_wait_params;
+asmlinkage long compat_sys_epoll_pwait1(int epfd, int flags,
+ struct epoll_event __user *events,
+ int maxevents,
+ struct compat_epoll_wait_params __user *params);
+
asmlinkage long compat_sys_utime(const char __user *filename,
struct compat_utimbuf __user *t);
asmlinkage long compat_sys_utimensat(unsigned int dfd,
--
1.9.3
^ permalink raw reply related
* [PATCH v4 9/9] x86: Hook up 32 bit compat epoll_pwait1 syscall
From: Fam Zheng @ 2015-03-10 1:49 UTC (permalink / raw)
To: linux-kernel
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Alexander Viro,
Andrew Morton, Kees Cook, Andy Lutomirski, David Herrmann,
Alexei Starovoitov, Miklos Szeredi, David Drysdale, Oleg Nesterov,
David S. Miller, Vivek Goyal, Mike Frysinger, Theodore Ts'o,
Heiko Carstens, Rasmus Villemoes, Rashika Kheria, Hugh Dickins,
Mathieu Desnoyers, Fam Zheng, Peter Zijlstra <peter>
In-Reply-To: <1425952155-27603-1-git-send-email-famz@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
---
arch/x86/syscalls/syscall_32.tbl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl
index bf912d8..5728c2e 100644
--- a/arch/x86/syscalls/syscall_32.tbl
+++ b/arch/x86/syscalls/syscall_32.tbl
@@ -366,4 +366,4 @@
357 i386 bpf sys_bpf
358 i386 execveat sys_execveat stub32_execveat
359 i386 epoll_ctl_batch sys_epoll_ctl_batch
-360 i386 epoll_pwait1 sys_epoll_pwait1
+360 i386 epoll_pwait1 sys_epoll_pwait1 compat_sys_epoll_pwait1
--
1.9.3
^ permalink raw reply related
* Re: [dmidecode] [Patch v4] firmware: dmi-sysfs: add SMBIOS entry point area attribute
From: Jean Delvare @ 2015-03-10 9:13 UTC (permalink / raw)
To: Ivan.khoronzhuk
Cc: Ivan Khoronzhuk, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A,
grant.likely-QSEj5FYQhm4dnm+yROfE0A,
matt.fleming-ral2JQCrhuEAvxtiuMwx3w,
linux-api-u79uwXL29TY76Z2rM5mHXA,
linux-doc-u79uwXL29TY76Z2rM5mHXA,
dmidecode-devel-qX2TKyscuCcdnm+yROfE0A,
leif.lindholm-QSEj5FYQhm4dnm+yROfE0A,
msalter-H+wXaHxf7aLQT0dZR+AlfA
In-Reply-To: <54F6FAE7.30801-hExfYMNmJl/Cnp4W7fqMDg@public.gmane.org>
Hi Ivan,
Sorry for the late reply. I think I addressed some points in other
replies already, but for completeness let me reply to this post too.
Le Wednesday 04 March 2015 à 14:30 +0200, Ivan.khoronzhuk a écrit :
> On 02/26/2015 11:36 AM, Jean Delvare wrote:
> > On Wed, 4 Feb 2015 19:06:03 +0200, Ivan Khoronzhuk wrote:
> >> diff --git a/Documentation/ABI/testing/sysfs-firmware-dmi b/Documentation/ABI/testing/sysfs-firmware-dmi
> >> index c78f9ab..3a9ffe8 100644
> >> --- a/Documentation/ABI/testing/sysfs-firmware-dmi
> >> +++ b/Documentation/ABI/testing/sysfs-firmware-dmi
> >> @@ -12,6 +12,16 @@ Description:
> >> cannot ensure that the data as exported to userland is
> >> without error either.
> >>
> >> + The firmware provides DMI structures as a packed list of
> >> + data referenced by a SMBIOS table entry point. The SMBIOS
> >> + entry point contains general information, like SMBIOS
> >> + version, DMI table size, etc. The structure, content and
> >> + size of SMBIOS entry point is dependent on SMBIOS version.
> >> + That's why SMBIOS entry point is represented in dmi sysfs
> >> + like a raw attribute and is accessible via
> >> + /sys/firmware/dmi/smbios_raw_header. The format of SMBIOS
> > As mentioned before, I don't like the name "smbios_raw_header". I think
> > it should be "smbios_entry_point" or similar.
>
> If Matt is OK to get another version,
> Let it be smbios_entry_point.
> If it's more convenient, it should be changed while it's possible.
Great, thanks.
> >> @@ -669,6 +699,18 @@ static int __init dmi_sysfs_init(void)
> >> goto err;
> >> }
> >>
> >> + smbios_raw_header = dmi_get_smbios_entry_area(&size);
> >> + if (!smbios_raw_header) {
> >> + pr_debug("dmi-sysfs: SMBIOS raw data is not available.\n");
> >> + error = -EINVAL;
> >> + goto err;
> >> + }
> > I don't think this should have been a fatal error. Just because for
> > some reason dmi_get_smbios_entry_area() returned NULL is no good reason
> > for nor exposing /sys/firmware/dmi/entries as we used to.
>
> It issues an error only in case of when entry table is not available,
> if entry point is absent then dmi table is not available a fortiori.
> So there is no reason to continue from that point.
Well it could also fail because of an error in the code ;-) But OK, I
agree with you here.
> > But anyway this is no longer relevant if the code is moved to dmi_scan
> > as I suggested.
> >
> >> +
> >> + /* Create the raw binary file to access the entry area */
> >> + smbios_raw_area_attr.size = size;
> >> + if (sysfs_create_bin_file(dmi_kobj, &smbios_raw_area_attr))
> >> + goto err;
> > I think this should have had a corresponding call to
> > sysfs_remove_bin_file() in dmi_sysfs_exit(). (Again no longer relevant
> > if the code is moved.)
>
> The removing is done in kobject_del().
> Doesn't it? In another way it should be done for
> dmi/entries/*/raw attributes also.
It _is_ done for other attributes already:
kset_unregister(dmi_kset);
Which is exactly why I believe it should be done for
smbios_raw_area_attr too. All other kernel drivers are calling
sysfs_create_bin_file() or equivalent in their cleanup function and I
see no reason why this driver would be an exception.
> > There's one thing I do not understand. I seem to understand that the
> > goal behind this patch is to be able to run dmidecode without /dev/mem.
> > Dmidecode currently reads 2 areas from /dev/mem: the 0xF0000-0xFFFFF
> > area in search of the entry point, and the DMI data table itself. With
> > this patch you make the entry point available through sysfs. But
> > dmidecode will still need to access /dev/mem to access the DMI data
> > table. So that does not really solve anything, does it?
>
> It's supposed to read DMI table via entries presented by dmi-sysfs.
> It contains raw attributes that can be used for these purposes.
> No need to use /dev/mem.
Yes, I understood this meanwhile, sorry.
> Another case if you want to add binary of whole dmi table to be able to
> read it directly in order to parse in dmidecode w/o any additional headache
> with open/close. Well, it partly dupes currently present dmi-sysfs.
In fact dmi-sysfs already duplicates a lot of code which was already
present in dmidecode and libsmbios. And exporting the raw table will
require way less code than the implementation you proposed originally.
So the code duplication argument doesn't hold, sorry.
> But it simplifies dmi table parsing for dmidecode, and who wants to use
> dmi-sysfs, let them use it, but dmidecode will be reading raw entry.
> Well let it be. Why not.
Yes, this is exactly my point.
> If others are OK, for dmidecode, and probably others tools also,
> kernel can constantly expose two tables under /sys/firmware/dmi/tables/
> smbios_entry_point and dmi_table. Independently on dmi-sysfs.
That's what I would like to see implemented, yes, thank you very much.
--
Jean Delvare
SUSE L3 Support
^ permalink raw reply
* [PATCH v5 1/3] scsi: ufs: add ioctl interface for query request
From: Gilad Broner @ 2015-03-10 11:47 UTC (permalink / raw)
To: James.Bottomley
Cc: linux-kernel, linux-scsi, linux-arm-msm, santoshsy,
linux-scsi-owner, subhashj, ygardi, draviv, Noa Rubens,
Raviv Shvili, Vinayak Holikatti, James E.J. Bottomley,
open list:ABI/API
In-Reply-To: <1425988035-966-1-git-send-email-gbroner@codeaurora.org>
From: Dolev Raviv <draviv@codeaurora.org>
This patch exposes the ioctl interface for UFS driver via SCSI device
ioctl interface. As of now UFS driver would provide the ioctl for query
interface to connected UFS device.
Signed-off-by: Dolev Raviv <draviv@codeaurora.org>
Signed-off-by: Noa Rubens <noag@codeaurora.org>
Signed-off-by: Raviv Shvili <rshvili@codeaurora.org>
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
---
drivers/scsi/ufs/ufs.h | 53 +++-------
drivers/scsi/ufs/ufshcd.c | 225 +++++++++++++++++++++++++++++++++++++++++-
include/uapi/scsi/Kbuild | 1 +
include/uapi/scsi/ufs/Kbuild | 3 +
include/uapi/scsi/ufs/ioctl.h | 57 +++++++++++
include/uapi/scsi/ufs/ufs.h | 66 +++++++++++++
6 files changed, 361 insertions(+), 44 deletions(-)
create mode 100644 include/uapi/scsi/ufs/Kbuild
create mode 100644 include/uapi/scsi/ufs/ioctl.h
create mode 100644 include/uapi/scsi/ufs/ufs.h
diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h
index 42c459a..1f023c4 100644
--- a/drivers/scsi/ufs/ufs.h
+++ b/drivers/scsi/ufs/ufs.h
@@ -38,6 +38,7 @@
#include <linux/mutex.h>
#include <linux/types.h>
+#include <scsi/ufs/ufs.h>
#define MAX_CDB_SIZE 16
#define GENERAL_UPIU_REQUEST_SIZE 32
@@ -71,6 +72,16 @@ enum {
UFS_UPIU_RPMB_WLUN = 0xC4,
};
+/**
+ * ufs_is_valid_unit_desc_lun - checks if the given LUN has a unit descriptor
+ * @lun: LU number to check
+ * @return: true if the lun has a matching unit descriptor, false otherwise
+ */
+static inline bool ufs_is_valid_unit_desc_lun(u8 lun)
+{
+ return (lun == UFS_UPIU_RPMB_WLUN || (lun < UFS_UPIU_MAX_GENERAL_LUN));
+}
+
/*
* UFS Protocol Information Unit related definitions
*/
@@ -126,35 +137,6 @@ enum {
UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST = 0x81,
};
-/* Flag idn for Query Requests*/
-enum flag_idn {
- QUERY_FLAG_IDN_FDEVICEINIT = 0x01,
- QUERY_FLAG_IDN_PWR_ON_WPE = 0x03,
- QUERY_FLAG_IDN_BKOPS_EN = 0x04,
-};
-
-/* Attribute idn for Query requests */
-enum attr_idn {
- QUERY_ATTR_IDN_ACTIVE_ICC_LVL = 0x03,
- QUERY_ATTR_IDN_BKOPS_STATUS = 0x05,
- QUERY_ATTR_IDN_EE_CONTROL = 0x0D,
- QUERY_ATTR_IDN_EE_STATUS = 0x0E,
-};
-
-/* Descriptor idn for Query requests */
-enum desc_idn {
- QUERY_DESC_IDN_DEVICE = 0x0,
- QUERY_DESC_IDN_CONFIGURAION = 0x1,
- QUERY_DESC_IDN_UNIT = 0x2,
- QUERY_DESC_IDN_RFU_0 = 0x3,
- QUERY_DESC_IDN_INTERCONNECT = 0x4,
- QUERY_DESC_IDN_STRING = 0x5,
- QUERY_DESC_IDN_RFU_1 = 0x6,
- QUERY_DESC_IDN_GEOMETRY = 0x7,
- QUERY_DESC_IDN_POWER = 0x8,
- QUERY_DESC_IDN_MAX,
-};
-
enum desc_header_offset {
QUERY_DESC_LENGTH_OFFSET = 0x00,
QUERY_DESC_DESC_TYPE_OFFSET = 0x01,
@@ -247,19 +229,6 @@ enum bkops_status {
BKOPS_STATUS_MAX = BKOPS_STATUS_CRITICAL,
};
-/* UTP QUERY Transaction Specific Fields OpCode */
-enum query_opcode {
- UPIU_QUERY_OPCODE_NOP = 0x0,
- UPIU_QUERY_OPCODE_READ_DESC = 0x1,
- UPIU_QUERY_OPCODE_WRITE_DESC = 0x2,
- UPIU_QUERY_OPCODE_READ_ATTR = 0x3,
- UPIU_QUERY_OPCODE_WRITE_ATTR = 0x4,
- UPIU_QUERY_OPCODE_READ_FLAG = 0x5,
- UPIU_QUERY_OPCODE_SET_FLAG = 0x6,
- UPIU_QUERY_OPCODE_CLEAR_FLAG = 0x7,
- UPIU_QUERY_OPCODE_TOGGLE_FLAG = 0x8,
-};
-
/* Query response result code */
enum {
QUERY_RESULT_SUCCESS = 0x00,
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 5d60a86..cb357f8 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -3,7 +3,7 @@
*
* This code is based on drivers/scsi/ufs/ufshcd.c
* Copyright (C) 2011-2013 Samsung India Software Operations
- * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
*
* Authors:
* Santosh Yaraganavi <santosh.sy@samsung.com>
@@ -39,6 +39,7 @@
#include <linux/async.h>
#include <linux/devfreq.h>
+#include <scsi/ufs/ioctl.h>
#include "ufshcd.h"
#include "unipro.h"
@@ -74,6 +75,9 @@
/* Interrupt aggregation default timeout, unit: 40us */
#define INT_AGGR_DEF_TO 0x02
+/* IOCTL opcode for command - ufs set device read only */
+#define UFS_IOCTL_BLKROSET BLKROSET
+
#define ufshcd_toggle_vreg(_dev, _vreg, _on) \
({ \
int _ret; \
@@ -1882,7 +1886,7 @@ static inline int ufshcd_read_unit_desc_param(struct ufs_hba *hba,
* Unit descriptors are only available for general purpose LUs (LUN id
* from 0 to 7) and RPMB Well known LU.
*/
- if (lun != UFS_UPIU_RPMB_WLUN && (lun >= UFS_UPIU_MAX_GENERAL_LUN))
+ if (!ufs_is_valid_unit_desc_lun(lun))
return -EOPNOTSUPP;
return ufshcd_read_desc_param(hba, QUERY_DESC_IDN_UNIT, lun,
@@ -4201,6 +4205,222 @@ static void ufshcd_async_scan(void *data, async_cookie_t cookie)
ufshcd_probe_hba(hba);
}
+/**
+ * ufshcd_query_ioctl - perform user read queries
+ * @hba: per-adapter instance
+ * @lun: used for lun specific queries
+ * @buffer: user space buffer for reading and submitting query data and params
+ * @return: 0 for success negative error code otherwise
+ *
+ * Expected/Submitted buffer structure is struct ufs_ioctl_query_data.
+ * It will read the opcode, idn and buf_length parameters, and, put the
+ * response in the buffer field while updating the used size in buf_length.
+ */
+static int ufshcd_query_ioctl(struct ufs_hba *hba, u8 lun, void __user *buffer)
+{
+ struct ufs_ioctl_query_data *ioctl_data;
+ int err = 0;
+ int length = 0;
+ void *data_ptr;
+ bool flag;
+ u32 att;
+ u8 index;
+ u8 *desc = NULL;
+
+ ioctl_data = kzalloc(sizeof(struct ufs_ioctl_query_data), GFP_KERNEL);
+ if (!ioctl_data) {
+ err = -ENOMEM;
+ goto out;
+ }
+
+ /* extract params from user buffer */
+ err = copy_from_user(ioctl_data, buffer,
+ sizeof(struct ufs_ioctl_query_data));
+ if (err) {
+ dev_err(hba->dev,
+ "%s: Failed copying buffer from user, err %d\n",
+ __func__, err);
+ goto out_release_mem;
+ }
+
+ /* verify legal parameters & send query */
+ switch (ioctl_data->opcode) {
+ case UPIU_QUERY_OPCODE_READ_DESC:
+ switch (ioctl_data->idn) {
+ case QUERY_DESC_IDN_DEVICE:
+ case QUERY_DESC_IDN_CONFIGURAION:
+ case QUERY_DESC_IDN_INTERCONNECT:
+ case QUERY_DESC_IDN_GEOMETRY:
+ case QUERY_DESC_IDN_POWER:
+ index = 0;
+ break;
+ case QUERY_DESC_IDN_UNIT:
+ if (!ufs_is_valid_unit_desc_lun(lun)) {
+ dev_err(hba->dev,
+ "%s: No unit descriptor for lun 0x%x\n",
+ __func__, lun);
+ err = -EINVAL;
+ goto out_release_mem;
+ }
+ index = lun;
+ break;
+ default:
+ goto out_einval;
+ }
+ length = min_t(int, QUERY_DESC_MAX_SIZE,
+ ioctl_data->buf_size);
+ desc = kzalloc(length, GFP_KERNEL);
+ if (!desc) {
+ dev_err(hba->dev, "%s: Failed allocating %d bytes\n",
+ __func__, length);
+ err = -ENOMEM;
+ goto out_release_mem;
+ }
+ err = ufshcd_query_descriptor(hba, ioctl_data->opcode,
+ ioctl_data->idn, index, 0, desc, &length);
+ break;
+ case UPIU_QUERY_OPCODE_READ_ATTR:
+ switch (ioctl_data->idn) {
+ case QUERY_ATTR_IDN_BOOT_LU_EN:
+ case QUERY_ATTR_IDN_POWER_MODE:
+ case QUERY_ATTR_IDN_ACTIVE_ICC_LVL:
+ case QUERY_ATTR_IDN_OOO_DATA_EN:
+ case QUERY_ATTR_IDN_BKOPS_STATUS:
+ case QUERY_ATTR_IDN_PURGE_STATUS:
+ case QUERY_ATTR_IDN_MAX_DATA_IN:
+ case QUERY_ATTR_IDN_MAX_DATA_OUT:
+ case QUERY_ATTR_IDN_REF_CLK_FREQ:
+ case QUERY_ATTR_IDN_CONF_DESC_LOCK:
+ case QUERY_ATTR_IDN_MAX_NUM_OF_RTT:
+ case QUERY_ATTR_IDN_EE_CONTROL:
+ case QUERY_ATTR_IDN_EE_STATUS:
+ case QUERY_ATTR_IDN_SECONDS_PASSED:
+ index = 0;
+ break;
+ case QUERY_ATTR_IDN_DYN_CAP_NEEDED:
+ case QUERY_ATTR_IDN_CORR_PRG_BLK_NUM:
+ index = lun;
+ break;
+ default:
+ goto out_einval;
+ }
+ err = ufshcd_query_attr(hba, ioctl_data->opcode,
+ ioctl_data->idn, index, 0, &att);
+ break;
+ case UPIU_QUERY_OPCODE_READ_FLAG:
+ switch (ioctl_data->idn) {
+ case QUERY_FLAG_IDN_FDEVICEINIT:
+ case QUERY_FLAG_IDN_PERMANENT_WPE:
+ case QUERY_FLAG_IDN_PWR_ON_WPE:
+ case QUERY_FLAG_IDN_BKOPS_EN:
+ case QUERY_FLAG_IDN_PURGE_ENABLE:
+ case QUERY_FLAG_IDN_FPHYRESOURCEREMOVAL:
+ case QUERY_FLAG_IDN_BUSY_RTC:
+ break;
+ default:
+ goto out_einval;
+ }
+ err = ufshcd_query_flag(hba, ioctl_data->opcode,
+ ioctl_data->idn, &flag);
+ break;
+ default:
+ goto out_einval;
+ }
+
+ if (err) {
+ dev_err(hba->dev, "%s: Query for idn %d failed\n", __func__,
+ ioctl_data->idn);
+ goto out_release_mem;
+ }
+
+ /*
+ * copy response data
+ * As we might end up reading less data then what is specified in
+ * "ioct_data->buf_size". So we are updating "ioct_data->
+ * buf_size" to what exactly we have read.
+ */
+ switch (ioctl_data->opcode) {
+ case UPIU_QUERY_OPCODE_READ_DESC:
+ ioctl_data->buf_size = min_t(int, ioctl_data->buf_size, length);
+ data_ptr = desc;
+ break;
+ case UPIU_QUERY_OPCODE_READ_ATTR:
+ ioctl_data->buf_size = sizeof(u32);
+ data_ptr = &att;
+ break;
+ case UPIU_QUERY_OPCODE_READ_FLAG:
+ ioctl_data->buf_size = 1;
+ data_ptr = &flag;
+ break;
+ default:
+ BUG_ON(true);
+ }
+
+ /* copy to user */
+ err = copy_to_user(buffer, ioctl_data,
+ sizeof(struct ufs_ioctl_query_data));
+ if (err)
+ dev_err(hba->dev, "%s: Failed copying back to user.\n",
+ __func__);
+ err = copy_to_user(buffer + sizeof(struct ufs_ioctl_query_data),
+ data_ptr, ioctl_data->buf_size);
+ if (err)
+ dev_err(hba->dev, "%s: err %d copying back to user.\n",
+ __func__, err);
+ goto out_release_mem;
+
+out_einval:
+ dev_err(hba->dev,
+ "%s: illegal ufs query ioctl data, opcode 0x%x, idn 0x%x\n",
+ __func__, ioctl_data->opcode, (unsigned int)ioctl_data->idn);
+ err = -EINVAL;
+out_release_mem:
+ kfree(ioctl_data);
+ kfree(desc);
+out:
+ return err;
+}
+
+/**
+ * ufshcd_ioctl - ufs ioctl callback registered in scsi_host
+ * @dev: scsi device required for per LUN queries
+ * @cmd: command opcode
+ * @buffer: user space buffer for transferring data
+ *
+ * Supported commands:
+ * UFS_IOCTL_QUERY
+ */
+static int ufshcd_ioctl(struct scsi_device *dev, int cmd, void __user *buffer)
+{
+ struct ufs_hba *hba = shost_priv(dev->host);
+ int err = 0;
+
+ BUG_ON(!hba);
+ if (!buffer) {
+ dev_err(hba->dev, "%s: User buffer is NULL!\n", __func__);
+ return -EINVAL;
+ }
+
+ switch (cmd) {
+ case UFS_IOCTL_QUERY:
+ pm_runtime_get_sync(hba->dev);
+ err = ufshcd_query_ioctl(hba, ufshcd_scsi_to_upiu_lun(dev->lun),
+ buffer);
+ pm_runtime_put_sync(hba->dev);
+ break;
+ case UFS_IOCTL_BLKROSET:
+ err = -ENOIOCTLCMD;
+ break;
+ default:
+ err = -EINVAL;
+ dev_err(hba->dev, "%s: Illegal ufs-IOCTL cmd %d\n", __func__,
+ cmd);
+ break;
+ }
+
+ return err;
+}
+
static struct scsi_host_template ufshcd_driver_template = {
.module = THIS_MODULE,
.name = UFSHCD,
@@ -4213,6 +4433,7 @@ static struct scsi_host_template ufshcd_driver_template = {
.eh_abort_handler = ufshcd_abort,
.eh_device_reset_handler = ufshcd_eh_device_reset_handler,
.eh_host_reset_handler = ufshcd_eh_host_reset_handler,
+ .ioctl = ufshcd_ioctl,
.this_id = -1,
.sg_tablesize = SG_ALL,
.cmd_per_lun = UFSHCD_CMD_PER_LUN,
diff --git a/include/uapi/scsi/Kbuild b/include/uapi/scsi/Kbuild
index 75746d5..d404525 100644
--- a/include/uapi/scsi/Kbuild
+++ b/include/uapi/scsi/Kbuild
@@ -1,5 +1,6 @@
# UAPI Header export list
header-y += fc/
+header-y += ufs/
header-y += scsi_bsg_fc.h
header-y += scsi_netlink.h
header-y += scsi_netlink_fc.h
diff --git a/include/uapi/scsi/ufs/Kbuild b/include/uapi/scsi/ufs/Kbuild
new file mode 100644
index 0000000..cc3ef20
--- /dev/null
+++ b/include/uapi/scsi/ufs/Kbuild
@@ -0,0 +1,3 @@
+# UAPI Header export list
+header-y += ioctl.h
+header-y += ufs.h
diff --git a/include/uapi/scsi/ufs/ioctl.h b/include/uapi/scsi/ufs/ioctl.h
new file mode 100644
index 0000000..bc4eed7
--- /dev/null
+++ b/include/uapi/scsi/ufs/ioctl.h
@@ -0,0 +1,57 @@
+#ifndef UAPI_UFS_IOCTL_H_
+#define UAPI_UFS_IOCTL_H_
+
+#include <linux/types.h>
+
+/*
+ * IOCTL opcode for ufs queries has the following opcode after
+ * SCSI_IOCTL_GET_PCI
+ */
+#define UFS_IOCTL_QUERY 0x5388
+
+/**
+ * struct ufs_ioctl_query_data - used to transfer data to and from user via ioctl
+ * @opcode: type of data to query (descriptor/attribute/flag)
+ * @idn: id of the data structure
+ * @buf_size: number of allocated bytes/data size on return
+ * @buffer: data location
+ *
+ * Received: buffer and buf_size (available space for transferred data)
+ * Submitted: opcode, idn, length, buf_size
+ */
+struct ufs_ioctl_query_data {
+ /*
+ * User should select one of the opcode defined in "enum query_opcode".
+ * Please check include/uapi/scsi/ufs/ufs.h for the definition of it.
+ * Note that only UPIU_QUERY_OPCODE_READ_DESC,
+ * UPIU_QUERY_OPCODE_READ_ATTR & UPIU_QUERY_OPCODE_READ_FLAG are
+ * supported as of now. All other query_opcode would be considered
+ * invalid.
+ * As of now only read query operations are supported.
+ */
+ __u32 opcode;
+ /*
+ * User should select one of the idn from "enum flag_idn" or "enum
+ * attr_idn" or "enum desc_idn" based on whether opcode above is
+ * attribute, flag or descriptor.
+ * Please check include/uapi/scsi/ufs/ufs.h for the definition of it.
+ */
+ __u8 idn;
+ /*
+ * User should specify the size of the buffer (buffer[0] below) where
+ * it wants to read the query data (attribute/flag/descriptor).
+ * As we might end up reading less data then what is specified in
+ * buf_size. So we are updating buf_size to what exactly we have read.
+ */
+ __u16 buf_size;
+ /*
+ * placeholder for the start of the data buffer where kernel will copy
+ * the query data (attribute/flag/descriptor) read from the UFS device
+ * Note:
+ * For Read Attribute you will have to allocate 4 bytes
+ * For Read Flag you will have to allocate 1 byte
+ */
+ __u8 buffer[0];
+};
+
+#endif /* UAPI_UFS_IOCTL_H_ */
diff --git a/include/uapi/scsi/ufs/ufs.h b/include/uapi/scsi/ufs/ufs.h
new file mode 100644
index 0000000..894ea45
--- /dev/null
+++ b/include/uapi/scsi/ufs/ufs.h
@@ -0,0 +1,66 @@
+#ifndef UAPI_UFS_H_
+#define UAPI_UFS_H_
+
+/* Flag idn for Query Requests*/
+enum flag_idn {
+ QUERY_FLAG_IDN_FDEVICEINIT = 0x01,
+ QUERY_FLAG_IDN_PERMANENT_WPE = 0x02,
+ QUERY_FLAG_IDN_PWR_ON_WPE = 0x03,
+ QUERY_FLAG_IDN_BKOPS_EN = 0x04,
+ QUERY_FLAG_IDN_RESERVED1 = 0x05,
+ QUERY_FLAG_IDN_PURGE_ENABLE = 0x06,
+ QUERY_FLAG_IDN_RESERVED2 = 0x07,
+ QUERY_FLAG_IDN_FPHYRESOURCEREMOVAL = 0x08,
+ QUERY_FLAG_IDN_BUSY_RTC = 0x09,
+};
+
+/* Attribute idn for Query requests */
+enum attr_idn {
+ QUERY_ATTR_IDN_BOOT_LU_EN = 0x00,
+ QUERY_ATTR_IDN_RESERVED = 0x01,
+ QUERY_ATTR_IDN_POWER_MODE = 0x02,
+ QUERY_ATTR_IDN_ACTIVE_ICC_LVL = 0x03,
+ QUERY_ATTR_IDN_OOO_DATA_EN = 0x04,
+ QUERY_ATTR_IDN_BKOPS_STATUS = 0x05,
+ QUERY_ATTR_IDN_PURGE_STATUS = 0x06,
+ QUERY_ATTR_IDN_MAX_DATA_IN = 0x07,
+ QUERY_ATTR_IDN_MAX_DATA_OUT = 0x08,
+ QUERY_ATTR_IDN_DYN_CAP_NEEDED = 0x09,
+ QUERY_ATTR_IDN_REF_CLK_FREQ = 0x0A,
+ QUERY_ATTR_IDN_CONF_DESC_LOCK = 0x0B,
+ QUERY_ATTR_IDN_MAX_NUM_OF_RTT = 0x0C,
+ QUERY_ATTR_IDN_EE_CONTROL = 0x0D,
+ QUERY_ATTR_IDN_EE_STATUS = 0x0E,
+ QUERY_ATTR_IDN_SECONDS_PASSED = 0x0F,
+ QUERY_ATTR_IDN_CNTX_CONF = 0x10,
+ QUERY_ATTR_IDN_CORR_PRG_BLK_NUM = 0x11,
+};
+
+/* Descriptor idn for Query requests */
+enum desc_idn {
+ QUERY_DESC_IDN_DEVICE = 0x0,
+ QUERY_DESC_IDN_CONFIGURAION = 0x1,
+ QUERY_DESC_IDN_UNIT = 0x2,
+ QUERY_DESC_IDN_RFU_0 = 0x3,
+ QUERY_DESC_IDN_INTERCONNECT = 0x4,
+ QUERY_DESC_IDN_STRING = 0x5,
+ QUERY_DESC_IDN_RFU_1 = 0x6,
+ QUERY_DESC_IDN_GEOMETRY = 0x7,
+ QUERY_DESC_IDN_POWER = 0x8,
+ QUERY_DESC_IDN_RFU_2 = 0x9,
+ QUERY_DESC_IDN_MAX,
+};
+
+/* UTP QUERY Transaction Specific Fields OpCode */
+enum query_opcode {
+ UPIU_QUERY_OPCODE_NOP = 0x0,
+ UPIU_QUERY_OPCODE_READ_DESC = 0x1,
+ UPIU_QUERY_OPCODE_WRITE_DESC = 0x2,
+ UPIU_QUERY_OPCODE_READ_ATTR = 0x3,
+ UPIU_QUERY_OPCODE_WRITE_ATTR = 0x4,
+ UPIU_QUERY_OPCODE_READ_FLAG = 0x5,
+ UPIU_QUERY_OPCODE_SET_FLAG = 0x6,
+ UPIU_QUERY_OPCODE_CLEAR_FLAG = 0x7,
+ UPIU_QUERY_OPCODE_TOGGLE_FLAG = 0x8,
+};
+#endif /* UAPI_UFS_H_ */
--
Qualcomm Israel, on behalf of Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply related
* Re: [PATCH v4 4/9] epoll: Add implementation for epoll_ctl_batch
From: Dan Rosenberg @ 2015-03-10 13:59 UTC (permalink / raw)
To: Fam Zheng, linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
x86-DgEjT+Ai2ygdnm+yROfE0A, Alexander Viro, Andrew Morton,
Kees Cook, Andy Lutomirski, David Herrmann, Alexei Starovoitov,
Miklos Szeredi, David Drysdale, Oleg Nesterov, David S. Miller,
Vivek Goyal, Mike Frysinger, Theodore Ts'o, Heiko Carstens,
Rasmus Villemoes, Rashika Kheria, Hugh Dickins, Mathieu Desnoyers,
Peter Zijlstra, linux-fsdevel
In-Reply-To: <1425952155-27603-5-git-send-email-famz-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
On 03/09/2015 09:49 PM, Fam Zheng wrote:
> + if (!cmds || ncmds <= 0 || ncmds > EP_MAX_BATCH)
> + return -EINVAL;
> + cmd_size = sizeof(struct epoll_ctl_cmd) * ncmds;
> + /* TODO: optimize for small arguments like select/poll with a stack
> + * allocated buffer */
> +
> + kcmds = kmalloc(cmd_size, GFP_KERNEL);
> + if (!kcmds)
> + return -ENOMEM;
You probably want to define EP_MAX_BATCH as some sane value much less
than INT_MAX/(sizeof(struct epoll_ctl_cmd)). While this avoids the
integer overflow from before, any user can cause the kernel to kmalloc
up to INT_MAX bytes. Probably not a huge deal because it's freed at the
end of the syscall, but generally not a great idea.
^ permalink raw reply
* Re: [PATCH v2 05/18] reset: Add reset_controller_of_init() function
From: Arnd Bergmann @ 2015-03-10 15:00 UTC (permalink / raw)
To: Maxime Coquelin
Cc: u.kleine-koenig, afaerber, geert, Rob Herring, Philipp Zabel,
Jonathan Corbet, Pawel Moll, Mark Rutland, Ian Campbell,
Kumar Gala, Russell King, Daniel Lezcano, Thomas Gleixner,
Linus Walleij, Greg Kroah-Hartman, Jiri Slaby, Andrew Morton,
David S. Miller, Mauro Carvalho Chehab, Joe Perches,
Antti Palosaari, Tejun Heo, Will Deacon, Nikolay Borisov
In-Reply-To: <1424455277-29983-6-git-send-email-mcoquelin.stm32@gmail.com>
On Friday 20 February 2015 19:01:04 Maxime Coquelin wrote:
> Some platforms need to initialize the reset controller before the timers.
>
> This patch introduces a reset_controller_of_init() function that can be
> called before the timers intialization.
>
> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
>
Not sure about this. It seems like the cleanest approach if we get
a lot of these, but then again it is probably very rare, and I'd
like to avoid adding such infrastructure if it's just for one
SoC. Could we add a hack in the machine initialization instead?
I think ideally this would be done in the boot loader before we
even start Linux, but I don't know if that's possible for you.
Arnd
^ permalink raw reply
* Re: [PATCH v2 07/18] drivers: reset: Add STM32 reset driver
From: Arnd Bergmann @ 2015-03-10 15:02 UTC (permalink / raw)
To: Maxime Coquelin
Cc: u.kleine-koenig, afaerber, geert, Rob Herring, Philipp Zabel,
Jonathan Corbet, Pawel Moll, Mark Rutland, Ian Campbell,
Kumar Gala, Russell King, Daniel Lezcano, Thomas Gleixner,
Linus Walleij, Greg Kroah-Hartman, Jiri Slaby, Andrew Morton,
David S. Miller, Mauro Carvalho Chehab, Joe Perches,
Antti Palosaari, Tejun Heo, Will Deacon, Nikolay Borisov
In-Reply-To: <1424455277-29983-8-git-send-email-mcoquelin.stm32@gmail.com>
On Friday 20 February 2015 19:01:06 Maxime Coquelin wrote:
> +/* AHB1 */
> +#define GPIOA_RESET 0
> +#define GPIOB_RESET 1
> +#define GPIOC_RESET 2
> +#define GPIOD_RESET 3
> +#define GPIOE_RESET 4
> +#define GPIOF_RESET 5
> +#define GPIOG_RESET 6
> +#define GPIOH_RESET 7
> +#define GPIOI_RESET 8
> +#define GPIOJ_RESET 9
> +#define GPIOK_RESET 10
>
As these are just the hardware numbers, it's better to not make them
part of the binding at all. Instead, just document in the binding that
one is supposed to pass the hardware number as the argument.
Arnd
^ permalink raw reply
* Re: [PATCH v2 11/18] pinctrl: Add pinctrl driver for STM32 MCUs
From: Arnd Bergmann @ 2015-03-10 15:08 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Mark Rutland, linux-doc, Linus Walleij, Will Deacon,
Nikolay Borisov, linux-api, Jiri Slaby, Mauro Carvalho Chehab,
Kees Cook, linux-arch, Russell King, Jonathan Corbet,
Daniel Lezcano, Antti Palosaari, geert, linux-serial,
u.kleine-koenig, devicetree, Philipp Zabel, Pawel Moll,
Ian Campbell, Rusty Russell, Tejun Heo, Rob Herring,
Thomas Gleixner, Michal
In-Reply-To: <1424455277-29983-12-git-send-email-mcoquelin.stm32@gmail.com>
On Friday 20 February 2015 19:01:10 Maxime Coquelin wrote:
> --- /dev/null
> +++ b/include/dt-bindings/pinctrl/pinctrl-stm32.h
> @@ -0,0 +1,43 @@
> +#ifndef _DT_BINDINGS_PINCTRL_STM32_H
> +#define _DT_BINDINGS_PINCTRL_STM32_H
> +
> +/* Modes */
> +#define IN 0
> +#define OUT 1
> +#define ALT 2
> +#define ANALOG 3
I think it's better to prefix all the names with a
string to identify what they are for, otherwise these
are way too generic.
> +/* Alternate functions */
> +#define ALT0 ((0 << 2) | ALT)
> +#define ALT1 ((1 << 2) | ALT)
> +#define ALT2 ((2 << 2) | ALT)
> +#define ALT3 ((3 << 2) | ALT)
> +#define ALT4 ((4 << 2) | ALT)
> +#define ALT5 ((5 << 2) | ALT)
> +#define ALT6 ((6 << 2) | ALT)
> +#define ALT7 ((7 << 2) | ALT)
> +#define ALT8 ((8 << 2) | ALT)
> +#define ALT9 ((9 << 2) | ALT)
> +#define ALT10 ((10 << 2) | ALT)
> +#define ALT11 ((11 << 2) | ALT)
> +#define ALT12 ((12 << 2) | ALT)
> +#define ALT13 ((13 << 2) | ALT)
> +#define ALT14 ((14 << 2) | ALT)
> +#define ALT15 ((15 << 2) | ALT)
You can have a single macro for these like
#define STM32_PIN_ALT(x) ((x << 2) | ALT)
> +/* Pull-Up/Down */
> +#define NO_PULL 0
> +#define PULL_UP 1
> +#define PULL_DOWN 2
> +
> +/* Type */
> +#define PUSH_PULL (0 << 2)
> +#define OPEN_DRAIN (1 << 2)
> +
These should probably not be stm32 specific at all, they sound
rather generic, so maybe put the definitions into a common file.
Arnd
^ permalink raw reply
* Re: [PATCH v2 12/18] dt-bindings: Document the STM32 USART bindings
From: Arnd Bergmann @ 2015-03-10 15:08 UTC (permalink / raw)
To: Maxime Coquelin
Cc: u.kleine-koenig, afaerber, geert, Rob Herring, Philipp Zabel,
Jonathan Corbet, Pawel Moll, Mark Rutland, Ian Campbell,
Kumar Gala, Russell King, Daniel Lezcano, Thomas Gleixner,
Linus Walleij, Greg Kroah-Hartman, Jiri Slaby, Andrew Morton,
David S. Miller, Mauro Carvalho Chehab, Joe Perches,
Antti Palosaari, Tejun Heo, Will Deacon, Nikolay Borisov
In-Reply-To: <1424455277-29983-13-git-send-email-mcoquelin.stm32@gmail.com>
On Friday 20 February 2015 19:01:11 Maxime Coquelin wrote:
> +
> +Example:
> +usart1: usart@40011000 {
> + compatible = "st,stm32-usart";
>
Please use generic node names everywhere. The standard name for a serial
port is "serial".
Arnd
^ permalink raw reply
* Re: [PATCH v2 14/18] ARM: Add STM32 family machine
From: Arnd Bergmann @ 2015-03-10 15:10 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Maxime Coquelin, u.kleine-koenig, afaerber, geert, Rob Herring,
Philipp Zabel, Jonathan Corbet, Pawel Moll, Mark Rutland,
Ian Campbell, Kumar Gala, Russell King, Daniel Lezcano,
Thomas Gleixner, Linus Walleij, Greg Kroah-Hartman, Jiri Slaby,
Andrew Morton, David S. Miller, Mauro Carvalho Chehab,
Joe Perches, Antti Palosaari, Tejun Heo, Will Deacon, N
In-Reply-To: <1424455277-29983-15-git-send-email-mcoquelin.stm32@gmail.com>
On Friday 20 February 2015 19:01:13 Maxime Coquelin wrote:
> +static void __init stm32_timer_init(void)
> +{
> + of_clk_init(NULL);
> + reset_controller_of_init();
> + clocksource_of_init();
> +
> +}
Don't do that. As I said, I'd rather not introduce reset_controller_of_init()
at all, but if we end up doing it, it should be run by default for
any machine that has an empty timer_init callback.
Arnd
^ permalink raw reply
* Re: [PATCH 2/9] selftests: Add install target
From: Shuah Khan @ 2015-03-10 15:11 UTC (permalink / raw)
To: Michael Ellerman, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-api-u79uwXL29TY76Z2rM5mHXA
Cc: Dave Jones, mmarek-AlSwsSmVLrQ
In-Reply-To: <54FE1EC0.6000201-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
On 03/09/2015 04:29 PM, Shuah Khan wrote:
> On 03/09/2015 08:20 AM, Shuah Khan wrote:
>> On 03/05/2015 11:53 AM, Dave Jones wrote:
>>> On Tue, Mar 03, 2015 at 03:51:35PM +1100, Michael Ellerman wrote:
>>> > This adds make install support to selftests. The basic usage is:
>>> >
>>> > $ cd tools/testing/selftests
>>> > $ make install
>>> >
>>> > That installs into tools/testing/selftests/install, which can then be
>>> > copied where ever necessary.
>>> >
>>> > The install destination is also configurable using eg:
>>> >
>>> > $ INSTALL_PATH=/mnt/selftests make install
>>>
>>> ...
>>>
>>> > + @# Ask all targets to emit their test scripts
>>> > + echo "#!/bin/bash\n\n" > $(ALL_SCRIPT)
>>>
>>> $ ./all.sh
>>> -bash: ./all.sh: /bin/bash\n\n: bad interpreter: No such file or directory
>>>
>>> Removing the \n\n fixes it.
>>>
>>> > + echo "cd \$$ROOT\n" >> $(ALL_SCRIPT); \
>>>
>>> ditto
>>>
>>> Dave
>>
>> Michael,
>>
>> Could you please fix these problems and send the patch.
>>
>
> Michael,
>
> Did you happen to run run_kselftest.sh from the install
> directory to make sure all the dependent executables
> are installed? You are missing a few required dependencies.
> efivars test for example.
>
> Please run kselftest_install.sh I sent out for review and
> compare the following:
>
> - contents of install directory created with your patch vs.
> my kselftest_install.sh tool
> - Compare your run_kselftest.sh run with the one that gets
> generated with my kselftest_install.sh tool
>
> General rule is all tests that get run when run_tests target
> is run should run from the install directory using the
> run_kselftest.sh generated during install.
>
Couple more things. Please change the install directory name
to kselftest
tools/testing/selftests/kselftest
instead of
tools/testing/selftests/install
Also please flatten the directory structure under the install
directory. I don't see any value in creating directory for each
test for install. Also it is makes it cumbersome for users
to navigate and work with after the install. This would mean cpu
and memory hot-plug scripts need unique names.
thanks,
-- Shuah
--
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org | (970) 217-8978
^ permalink raw reply
* Re: [PATCH v2 05/18] reset: Add reset_controller_of_init() function
From: Maxime Coquelin @ 2015-03-10 15:28 UTC (permalink / raw)
To: Arnd Bergmann, maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
Cc: Uwe Kleine-König, Andreas Färber, Geert Uytterhoeven,
Rob Herring, Philipp Zabel, Jonathan Corbet, Pawel Moll,
Mark Rutland, Ian Campbell, Kumar Gala, Russell King,
Daniel Lezcano, Thomas Gleixner, Linus Walleij,
Greg Kroah-Hartman, Jiri Slaby, Andrew Morton, David S. Miller,
Mauro Carvalho Chehab, Joe Perches, Antti Palosaari
In-Reply-To: <8729383.kvUZDm4dQz@wuerfel>
2015-03-10 16:00 GMT+01:00 Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>:
> On Friday 20 February 2015 19:01:04 Maxime Coquelin wrote:
>> Some platforms need to initialize the reset controller before the timers.
>>
>> This patch introduces a reset_controller_of_init() function that can be
>> called before the timers intialization.
>>
>> Signed-off-by: Maxime Coquelin <mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>>
>
> Not sure about this. It seems like the cleanest approach if we get
> a lot of these, but then again it is probably very rare, and I'd
> like to avoid adding such infrastructure if it's just for one
> SoC. Could we add a hack in the machine initialization instead?
Sun6i also need to initialize the reset controller early. Today, they
hack the machine initialization.
With two SoCs having the same need, what should we do?
That said, I'm fine with either way. If reset_controller_of_init gets
accepted, I will send the patch for sun6i.
>
> I think ideally this would be done in the boot loader before we
> even start Linux, but I don't know if that's possible for you.
>From what I understand, the only constraint is to perform it after the
clock is enabled.
So this should be possible to do it in the bootloader, but it means
also adding timers clocks ungating in the bootloader.
Br,
Maxime
>
> Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v2 07/18] drivers: reset: Add STM32 reset driver
From: Maxime Coquelin @ 2015-03-10 15:41 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Uwe Kleine-König, Andreas Färber, Geert Uytterhoeven,
Rob Herring, Philipp Zabel, Jonathan Corbet, Pawel Moll,
Mark Rutland, Ian Campbell, Kumar Gala, Russell King,
Daniel Lezcano, Thomas Gleixner, Linus Walleij,
Greg Kroah-Hartman, Jiri Slaby, Andrew Morton, David S. Miller,
Mauro Carvalho Chehab, Joe Perches, Antti Palosaari
In-Reply-To: <2383270.cAJPOxrkvo@wuerfel>
2015-03-10 16:02 GMT+01:00 Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>:
> On Friday 20 February 2015 19:01:06 Maxime Coquelin wrote:
>> +/* AHB1 */
>> +#define GPIOA_RESET 0
>> +#define GPIOB_RESET 1
>> +#define GPIOC_RESET 2
>> +#define GPIOD_RESET 3
>> +#define GPIOE_RESET 4
>> +#define GPIOF_RESET 5
>> +#define GPIOG_RESET 6
>> +#define GPIOH_RESET 7
>> +#define GPIOI_RESET 8
>> +#define GPIOJ_RESET 9
>> +#define GPIOK_RESET 10
>>
>
> As these are just the hardware numbers, it's better to not make them
> part of the binding at all. Instead, just document in the binding that
> one is supposed to pass the hardware number as the argument.
The reset controller is part of the RCC (Reset & Clock Controller) IP.
In this version, I only provided the reset registers to the reset
controller driver, but as per Andrea
>
> Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v2 07/18] drivers: reset: Add STM32 reset driver
From: Maxime Coquelin @ 2015-03-10 15:44 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Uwe Kleine-König, Andreas Färber, Geert Uytterhoeven,
Rob Herring, Philipp Zabel, Jonathan Corbet, Pawel Moll,
Mark Rutland, Ian Campbell, Kumar Gala, Russell King,
Daniel Lezcano, Thomas Gleixner, Linus Walleij,
Greg Kroah-Hartman, Jiri Slaby, Andrew Morton, David S. Miller,
Mauro Carvalho Chehab, Joe Perches, Antti Palosaari
In-Reply-To: <2383270.cAJPOxrkvo@wuerfel>
2015-03-10 16:02 GMT+01:00 Arnd Bergmann <arnd@arndb.de>:
> On Friday 20 February 2015 19:01:06 Maxime Coquelin wrote:
>> +/* AHB1 */
>> +#define GPIOA_RESET 0
>> +#define GPIOB_RESET 1
>> +#define GPIOC_RESET 2
>> +#define GPIOD_RESET 3
>> +#define GPIOE_RESET 4
>> +#define GPIOF_RESET 5
>> +#define GPIOG_RESET 6
>> +#define GPIOH_RESET 7
>> +#define GPIOI_RESET 8
>> +#define GPIOJ_RESET 9
>> +#define GPIOK_RESET 10
>>
>
> As these are just the hardware numbers, it's better to not make them
> part of the binding at all. Instead, just document in the binding that
> one is supposed to pass the hardware number as the argument.
The reset controller is part of the RCC (Reset & Clock Controller) IP.
In this version, I only provided the reset registers to the reset
controller driver, but as per Andreas Färber remark, I should avec a
single DT node for both the resets and clocks.
In the next version I am preparing, the defines doesn't look as
trivial as in this version, GPIOA_RESET being 128 for instance.
Is it fine for you if I keep the defines part of the binding?
Br,
Maxime
>
> Arnd
^ permalink raw reply
* Re: [PATCH v2 12/18] dt-bindings: Document the STM32 USART bindings
From: Maxime Coquelin @ 2015-03-10 15:45 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Uwe Kleine-König, Andreas Färber, Geert Uytterhoeven,
Rob Herring, Philipp Zabel, Jonathan Corbet, Pawel Moll,
Mark Rutland, Ian Campbell, Kumar Gala, Russell King,
Daniel Lezcano, Thomas Gleixner, Linus Walleij,
Greg Kroah-Hartman, Jiri Slaby, Andrew Morton, David S. Miller,
Mauro Carvalho Chehab, Joe Perches, Antti Palosaari
In-Reply-To: <38153432.AWA0ogMaoK@wuerfel>
2015-03-10 16:08 GMT+01:00 Arnd Bergmann <arnd@arndb.de>:
> On Friday 20 February 2015 19:01:11 Maxime Coquelin wrote:
>> +
>> +Example:
>> +usart1: usart@40011000 {
>> + compatible = "st,stm32-usart";
>>
>
> Please use generic node names everywhere. The standard name for a serial
> port is "serial".
I already had the remark, and it is already fixed in the next version.
Thanks,
Maxime
>
> Arnd
^ permalink raw reply
* Re: [PATCH] capabilities: Ambient capability set V2
From: Christoph Lameter @ 2015-03-10 15:47 UTC (permalink / raw)
To: Andrew G. Morgan
Cc: Serge E. Hallyn, LSM List, Serge Hallyn, Michael Kerrisk,
Jonathan Corbet, Linux API, Mimi Zohar, Aaron Jones,
Andy Lutomirski, Austin S Hemmelgarn, Jarkko Sakkinen,
Andrew Morton, Markku Savela,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
In-Reply-To: <CALQRfL4uG2v7SJWZhN2o=ARnSNLR9JAX6MMsCCsGaAz6JcZTsA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Mon, 9 Mar 2015, Andrew G. Morgan wrote:
> If this is new info, perhaps you might reconsider the rationale for your
> patch? I suspect you are focused on addressing a problem that you felt was
> unaddressed before, but given how much appears to have been unclear to you
> about the current implementation it might be worth a pause for thought.
The problems with unclear documentation and a weird counterintuitive
implementation that lots of people have trouble to use do not impact the
approach as far as I can tell. The discovery about how to set inheritable
bits does not help with the use cases here.
Even with this patch there is still the need to write a wrapper to get
the functionality that one would expect to just be possible by setting
inheritable bits on a file. The necessity to set the bits via prctl
in the wrapper complicates matters further and makes it even more
difficult than we thought before to make use of this feature.
> http://ols.fedoraproject.org/OLS/Reprints-2008/hallyn-reprint.pdf
Well maybe one should make sure that this info is properly comunicated
in the man pages and related documentation? This seems to be a big decade
old desaster. I need a Ph.D. in capabilities in order to attempt to use
them (but then oww no they still are not able to handle my use cases).
We get security through obscurity and also have then the inabilty to make
effective use of capabilities? Security measures need to follow
basic conventions, be obvious and easily understandable as well as well
documented. There is a huge risk of a sysadmin misconfiguring one of the
multiple measures that one needs to go through in order to gain some
sort of inheritance of capabilities and thereby adding more functionality
than necessary just in order to get it to work.
The best measure would be to make the inheritance bits work as one
would naturally expect. They just allow full inheritance of the caps.
No wrappers needed and its easily understood what it does.
^ permalink raw reply
* Re: [PATCH] ipv6: expose RFC4191 route preference via rtnetlink
From: Lubomir Rintel @ 2015-03-10 15:56 UTC (permalink / raw)
To: Jiri Pirko
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-api-u79uwXL29TY76Z2rM5mHXA, David S. Miller,
Alexey Kuznetsov
In-Reply-To: <20150303151715.GA2020-6KJVSR23iU5sFDB2n11ItA@public.gmane.org>
On Tue, 2015-03-03 at 16:17 +0100, Jiri Pirko wrote:
> Tue, Mar 03, 2015 at 11:01:52AM CET, lkundrak-NGH9Lh4a5iE@public.gmane.org wrote:
> >This makes it possible to retain the route preference when RAs are handled in
> >userspace.
> >
> >Signed-off-by: Lubomir Rintel <lkundrak-NGH9Lh4a5iE@public.gmane.org>
> >---
> > include/uapi/linux/rtnetlink.h | 1 +
> > net/ipv6/route.c | 16 +++++++++++++++-
> > 2 files changed, 16 insertions(+), 1 deletion(-)
> >
> >diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
> >index 5cc5d66..0671524 100644
> >--- a/include/uapi/linux/rtnetlink.h
> >+++ b/include/uapi/linux/rtnetlink.h
> >@@ -303,6 +303,7 @@ enum rtattr_type_t {
> > RTA_TABLE,
> > RTA_MARK,
> > RTA_MFC_STATS,
> >+ RTA_PREF,
> > __RTA_MAX
> > };
> >
> >diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> >index 47b5109..08f689e 100644
> >--- a/net/ipv6/route.c
> >+++ b/net/ipv6/route.c
> >@@ -2401,6 +2401,7 @@ static const struct nla_policy rtm_ipv6_policy[RTA_MAX+1] = {
> > [RTA_PRIORITY] = { .type = NLA_U32 },
> > [RTA_METRICS] = { .type = NLA_NESTED },
> > [RTA_MULTIPATH] = { .len = sizeof(struct rtnexthop) },
> >+ [RTA_PREF] = { .type = NLA_U8 },
> > };
> >
> > static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
> >@@ -2408,6 +2409,7 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
> > {
> > struct rtmsg *rtm;
> > struct nlattr *tb[RTA_MAX+1];
> >+ unsigned int pref;
> > int err;
> >
> > err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv6_policy);
> >@@ -2483,6 +2485,14 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
> > cfg->fc_mp_len = nla_len(tb[RTA_MULTIPATH]);
> > }
> >
> >+ if (tb[RTA_PREF]) {
> >+ pref = nla_get_u8(tb[RTA_PREF]);
> >+ if (pref == ICMPV6_ROUTER_PREF_LOW ||
> >+ pref == ICMPV6_ROUTER_PREF_MEDIUM ||
> >+ pref == ICMPV6_ROUTER_PREF_HIGH)
> >+ cfg->fc_flags |= RTF_PREF(pref);
>
> Don't we want to do "goto errout;" in case pref is invalid ?
I'm not sure. If RFC 4191 suggests that the invalid value ought to be
ignored (treated as medium). It could be done in the userspace or the
userspace could just relay whatever it got in the NDP message to the
kernel.
What is your opinion on this?
Thank you,
Lubo
^ permalink raw reply
* Re: [PATCH] ipv6: expose RFC4191 route preference via rtnetlink
From: Jiri Pirko @ 2015-03-10 16:04 UTC (permalink / raw)
To: Lubomir Rintel
Cc: netdev, linux-kernel, linux-api, David S. Miller,
Alexey Kuznetsov
In-Reply-To: <1426003013.3963.33.camel@v3.sk>
Tue, Mar 10, 2015 at 04:56:53PM CET, lkundrak@v3.sk wrote:
>On Tue, 2015-03-03 at 16:17 +0100, Jiri Pirko wrote:
>> Tue, Mar 03, 2015 at 11:01:52AM CET, lkundrak@v3.sk wrote:
>> >This makes it possible to retain the route preference when RAs are handled in
>> >userspace.
>> >
>> >Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
>> >---
>> > include/uapi/linux/rtnetlink.h | 1 +
>> > net/ipv6/route.c | 16 +++++++++++++++-
>> > 2 files changed, 16 insertions(+), 1 deletion(-)
>> >
>> >diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
>> >index 5cc5d66..0671524 100644
>> >--- a/include/uapi/linux/rtnetlink.h
>> >+++ b/include/uapi/linux/rtnetlink.h
>> >@@ -303,6 +303,7 @@ enum rtattr_type_t {
>> > RTA_TABLE,
>> > RTA_MARK,
>> > RTA_MFC_STATS,
>> >+ RTA_PREF,
>> > __RTA_MAX
>> > };
>> >
>> >diff --git a/net/ipv6/route.c b/net/ipv6/route.c
>> >index 47b5109..08f689e 100644
>> >--- a/net/ipv6/route.c
>> >+++ b/net/ipv6/route.c
>> >@@ -2401,6 +2401,7 @@ static const struct nla_policy rtm_ipv6_policy[RTA_MAX+1] = {
>> > [RTA_PRIORITY] = { .type = NLA_U32 },
>> > [RTA_METRICS] = { .type = NLA_NESTED },
>> > [RTA_MULTIPATH] = { .len = sizeof(struct rtnexthop) },
>> >+ [RTA_PREF] = { .type = NLA_U8 },
>> > };
>> >
>> > static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
>> >@@ -2408,6 +2409,7 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
>> > {
>> > struct rtmsg *rtm;
>> > struct nlattr *tb[RTA_MAX+1];
>> >+ unsigned int pref;
>> > int err;
>> >
>> > err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv6_policy);
>> >@@ -2483,6 +2485,14 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
>> > cfg->fc_mp_len = nla_len(tb[RTA_MULTIPATH]);
>> > }
>> >
>> >+ if (tb[RTA_PREF]) {
>> >+ pref = nla_get_u8(tb[RTA_PREF]);
>> >+ if (pref == ICMPV6_ROUTER_PREF_LOW ||
>> >+ pref == ICMPV6_ROUTER_PREF_MEDIUM ||
>> >+ pref == ICMPV6_ROUTER_PREF_HIGH)
>> >+ cfg->fc_flags |= RTF_PREF(pref);
>>
>> Don't we want to do "goto errout;" in case pref is invalid ?
>
>I'm not sure. If RFC 4191 suggests that the invalid value ought to be
>ignored (treated as medium). It could be done in the userspace or the
>userspace could just relay whatever it got in the NDP message to the
>kernel.
In that case I would suggest in case of invalid value to set pref to
ICMPV6_ROUTER_PREF_MEDIUM.
>
>What is your opinion on this?
>
>Thank you,
>Lubo
>
^ permalink raw reply
* Re: [PATCH v2 05/18] reset: Add reset_controller_of_init() function
From: Arnd Bergmann @ 2015-03-10 20:19 UTC (permalink / raw)
To: Maxime Coquelin
Cc: Mark Rutland, linux-doc@vger.kernel.org, Linus Walleij,
Will Deacon, Nikolay Borisov, linux-api@vger.kernel.org,
Jiri Slaby, Mauro Carvalho Chehab, Linux-Arch, Russell King,
Jonathan Corbet, Daniel Lezcano, Antti Palosaari,
Geert Uytterhoeven, linux-serial@vger.kernel.org,
Uwe Kleine-König, devicetree@vger.kernel.org, Kees Cook,
Pawel Moll, Ian Campbell
In-Reply-To: <CALszF6BkTOLR+VNkRKfvEBG5ZyaYL+9fZ4EAPVu5b_imCvEQoQ@mail.gmail.com>
On Tuesday 10 March 2015 16:28:44 Maxime Coquelin wrote:
> 2015-03-10 16:00 GMT+01:00 Arnd Bergmann <arnd@arndb.de>:
> > On Friday 20 February 2015 19:01:04 Maxime Coquelin wrote:
> >> Some platforms need to initialize the reset controller before the timers.
> >>
> >> This patch introduces a reset_controller_of_init() function that can be
> >> called before the timers intialization.
> >>
> >> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> >>
> >
> > Not sure about this. It seems like the cleanest approach if we get
> > a lot of these, but then again it is probably very rare, and I'd
> > like to avoid adding such infrastructure if it's just for one
> > SoC. Could we add a hack in the machine initialization instead?
>
> Sun6i also need to initialize the reset controller early. Today, they
> hack the machine initialization.
> With two SoCs having the same need, what should we do?
Good question, I'd like to hear some other opinions on this first.
> > I think ideally this would be done in the boot loader before we
> > even start Linux, but I don't know if that's possible for you.
>
> From what I understand, the only constraint is to perform it after the
> clock is enabled.
> So this should be possible to do it in the bootloader, but it means
> also adding timers clocks ungating in the bootloader.
Ungating the timer clock input seems like a reasonable thing to
do for the bootloader, I think a lot of platforms rely on this
elsewhere (but enough of them don't, which is why we have the
early clk init).
Arnd
^ permalink raw reply
* Re: [PATCH v2 07/18] drivers: reset: Add STM32 reset driver
From: Arnd Bergmann @ 2015-03-10 20:21 UTC (permalink / raw)
To: Maxime Coquelin
Cc: Uwe Kleine-König, Andreas Färber, Geert Uytterhoeven,
Rob Herring, Philipp Zabel, Jonathan Corbet, Pawel Moll,
Mark Rutland, Ian Campbell, Kumar Gala, Russell King,
Daniel Lezcano, Thomas Gleixner, Linus Walleij,
Greg Kroah-Hartman, Jiri Slaby, Andrew Morton, David S. Miller,
Mauro Carvalho Chehab, Joe Perches, Antti Palosaari
In-Reply-To: <CALszF6D3XMkjkMTdS-1xnVMFzgAW53NNOKOsfztsCboTdsBaaw@mail.gmail.com>
On Tuesday 10 March 2015 16:44:24 Maxime Coquelin wrote:
> 2015-03-10 16:02 GMT+01:00 Arnd Bergmann <arnd@arndb.de>:
> > On Friday 20 February 2015 19:01:06 Maxime Coquelin wrote:
> >> +/* AHB1 */
> >> +#define GPIOA_RESET 0
> >> +#define GPIOB_RESET 1
> >> +#define GPIOC_RESET 2
> >> +#define GPIOD_RESET 3
> >> +#define GPIOE_RESET 4
> >> +#define GPIOF_RESET 5
> >> +#define GPIOG_RESET 6
> >> +#define GPIOH_RESET 7
> >> +#define GPIOI_RESET 8
> >> +#define GPIOJ_RESET 9
> >> +#define GPIOK_RESET 10
> >>
> >
> > As these are just the hardware numbers, it's better to not make them
> > part of the binding at all. Instead, just document in the binding that
> > one is supposed to pass the hardware number as the argument.
>
> The reset controller is part of the RCC (Reset & Clock Controller) IP.
> In this version, I only provided the reset registers to the reset
> controller driver, but as per Andreas Färber remark, I should avec a
> single DT node for both the resets and clocks.
>
> In the next version I am preparing, the defines doesn't look as
> trivial as in this version, GPIOA_RESET being 128 for instance.
>
> Is it fine for you if I keep the defines part of the binding?
>
>
It's always better to avoid these files entirely, as they are
a frequent source of merge dependencies, and they make it less
obvious what's going on than having binary values in the dtb
that make sense.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v2 07/18] drivers: reset: Add STM32 reset driver
From: Maxime Coquelin @ 2015-03-10 21:20 UTC (permalink / raw)
To: Arnd Bergmann, Philipp Zabel
Cc: Uwe Kleine-König, Andreas Färber, Geert Uytterhoeven,
Rob Herring, Jonathan Corbet, Pawel Moll, Mark Rutland,
Ian Campbell, Kumar Gala, Russell King, Daniel Lezcano,
Thomas Gleixner, Linus Walleij, Greg Kroah-Hartman, Jiri Slaby,
Andrew Morton, David S. Miller, Mauro Carvalho Chehab,
Joe Perches, Antti Palosaari, Tejun Heo, Will Deacon
In-Reply-To: <2455342.zT71E5iyaL@wuerfel>
2015-03-10 21:21 GMT+01:00 Arnd Bergmann <arnd@arndb.de>:
> On Tuesday 10 March 2015 16:44:24 Maxime Coquelin wrote:
>> 2015-03-10 16:02 GMT+01:00 Arnd Bergmann <arnd@arndb.de>:
>> > On Friday 20 February 2015 19:01:06 Maxime Coquelin wrote:
>> >> +/* AHB1 */
>> >> +#define GPIOA_RESET 0
>> >> +#define GPIOB_RESET 1
>> >> +#define GPIOC_RESET 2
>> >> +#define GPIOD_RESET 3
>> >> +#define GPIOE_RESET 4
>> >> +#define GPIOF_RESET 5
>> >> +#define GPIOG_RESET 6
>> >> +#define GPIOH_RESET 7
>> >> +#define GPIOI_RESET 8
>> >> +#define GPIOJ_RESET 9
>> >> +#define GPIOK_RESET 10
>> >>
>> >
>> > As these are just the hardware numbers, it's better to not make them
>> > part of the binding at all. Instead, just document in the binding that
>> > one is supposed to pass the hardware number as the argument.
>>
>> The reset controller is part of the RCC (Reset & Clock Controller) IP.
>> In this version, I only provided the reset registers to the reset
>> controller driver, but as per Andreas Färber remark, I should avec a
>> single DT node for both the resets and clocks.
>>
>> In the next version I am preparing, the defines doesn't look as
>> trivial as in this version, GPIOA_RESET being 128 for instance.
>>
>> Is it fine for you if I keep the defines part of the binding?
>>
>>
>
> It's always better to avoid these files entirely, as they are
> a frequent source of merge dependencies, and they make it less
> obvious what's going on than having binary values in the dtb
> that make sense.
I agree it is always painful to have to have to manage these merge dependencies.
What I will do, if Philipp agrees, is to list all the values in the
binding documentation.
Doing that, the user of a reset won't have to do the calculation, and
no more merge dependencies.
Maxime
>
> Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v2 05/18] reset: Add reset_controller_of_init() function
From: Rob Herring @ 2015-03-10 21:30 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Maxime Coquelin, Maxime Ripard, Uwe Kleine-König,
Andreas Färber, Geert Uytterhoeven, Rob Herring,
Philipp Zabel, Jonathan Corbet, Pawel Moll, Mark Rutland,
Ian Campbell, Kumar Gala, Russell King, Daniel Lezcano,
Thomas Gleixner, Linus Walleij, Greg Kroah-Hartman, Jiri Slaby,
Andrew Morton, David S. Miller
In-Reply-To: <6773745.i9mx5zmPP4@wuerfel>
On Tue, Mar 10, 2015 at 3:19 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday 10 March 2015 16:28:44 Maxime Coquelin wrote:
>> 2015-03-10 16:00 GMT+01:00 Arnd Bergmann <arnd@arndb.de>:
>> > On Friday 20 February 2015 19:01:04 Maxime Coquelin wrote:
>> >> Some platforms need to initialize the reset controller before the timers.
>> >>
>> >> This patch introduces a reset_controller_of_init() function that can be
>> >> called before the timers intialization.
>> >>
>> >> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
>> >>
>> >
>> > Not sure about this. It seems like the cleanest approach if we get
>> > a lot of these, but then again it is probably very rare, and I'd
>> > like to avoid adding such infrastructure if it's just for one
>> > SoC. Could we add a hack in the machine initialization instead?
>>
>> Sun6i also need to initialize the reset controller early. Today, they
>> hack the machine initialization.
>> With two SoCs having the same need, what should we do?
>
> Good question, I'd like to hear some other opinions on this first.
2 is still far from the common case.
>> > I think ideally this would be done in the boot loader before we
>> > even start Linux, but I don't know if that's possible for you.
>>
>> From what I understand, the only constraint is to perform it after the
>> clock is enabled.
>> So this should be possible to do it in the bootloader, but it means
>> also adding timers clocks ungating in the bootloader.
>
> Ungating the timer clock input seems like a reasonable thing to
> do for the bootloader, I think a lot of platforms rely on this
> elsewhere (but enough of them don't, which is why we have the
> early clk init).
+1
If the bootloader is u-boot, then you need a timer anyway.
Rob
^ permalink raw reply
* [PATCH 0/3] selftests: ptrace, kcmp, efivars build failure fixes
From: Shuah Khan @ 2015-03-10 22:00 UTC (permalink / raw)
To: gorcunov-GEFAQzZX7r8dnm+yROfE0A,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
tranmanphong-Re5JQEeQqe8AvxtiuMwx3w, mpe-Gsx/Oe8HsFggBc27wqDAHg
Cc: Shuah Khan, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-api-u79uwXL29TY76Z2rM5mHXA
ptrace, efivars, and kcmp Makefiles don't have explicit build rule.
As a result, build fails when make is run from top level Makefile
target kselftest. Without the explicit rule, make works only when
it is run in the current directory or from selftests directory.
Fxing the problems by adding an explicit build rule to fix the
problem.
Shuah Khan (3):
selftests: ptrace build fails when invoked from kselftest target
selftests: efivars build fails when invoked from kselftest target
selftests: kcmp build fails when invoked from kselftest target
tools/testing/selftests/efivarfs/Makefile | 2 ++
tools/testing/selftests/kcmp/Makefile | 5 +++--
tools/testing/selftests/ptrace/Makefile | 5 +++--
3 files changed, 8 insertions(+), 4 deletions(-)
--
2.1.0
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox