* [Buildroot] [PATCH] package/binutils: fix xtensa linker relaxation regression in 2.31.1
From: Max Filippov @ 2018-07-23 19:37 UTC (permalink / raw)
To: buildroot
Fix the following xtensa ld error observed when building uClibc-ng
libthread_db with binutils-2.31:
BFD (GNU Binutils) 2.31 internal error, aborting at
elf32-xtensa.c:3269 in elf_xtensa_finish_dynamic_sections
Fixes: https://gitlab.com/free-electrons/toolchains-builder/-/jobs/82264912
Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
...relaxation-of-undefined-weak-references-i.patch | 48 ++++++++++++
...-dynamic-relocations-sections-consistency.patch | 90 ++++++++++++++++++++++
2 files changed, 138 insertions(+)
create mode 100644 package/binutils/2.31.1/0010-xtensa-fix-relaxation-of-undefined-weak-references-i.patch
create mode 100644 package/binutils/2.31.1/0011-xtensa-move-dynamic-relocations-sections-consistency.patch
diff --git a/package/binutils/2.31.1/0010-xtensa-fix-relaxation-of-undefined-weak-references-i.patch b/package/binutils/2.31.1/0010-xtensa-fix-relaxation-of-undefined-weak-references-i.patch
new file mode 100644
index 000000000000..660d30c38925
--- /dev/null
+++ b/package/binutils/2.31.1/0010-xtensa-fix-relaxation-of-undefined-weak-references-i.patch
@@ -0,0 +1,48 @@
+From 5d3a462f05cba5b0c0c96de899b84fb84155c760 Mon Sep 17 00:00:00 2001
+From: Max Filippov <jcmvbkbc@gmail.com>
+Date: Sun, 22 Jul 2018 13:52:28 -0700
+Subject: [PATCH] xtensa: fix relaxation of undefined weak references in
+ shared objects
+
+The change c451bb34ae8b ("xtensa: don't emit dynamic relocation for weak
+undefined symbol") didn't properly handle shrinking of relocation
+sections due to coalescing of references to a dynamic undefined weak
+symbol in a shared object, which resulted in the following assertion
+failure in ld when linking uClibc-ng libthread_db for xtensa:
+
+ BFD (GNU Binutils) 2.31 internal error, aborting at elf32-xtensa.c:3269
+ in elf_xtensa_finish_dynamic_sections
+
+Shrink dynamic relocations section for dynamic undefined weak symbols
+when linking a shared object.
+
+bfd/
+2018-07-23 Max Filippov <jcmvbkbc@gmail.com>
+
+ * elf32-xtensa.c (shrink_dynamic_reloc_sections): Shrink dynamic
+ relocations section for dynamic undefined weak symbols when
+ linking a shared object.
+
+Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
+Backported from: 5d3a462f05cba5b0c0c96de899b84fb84155c760
+---
+ bfd/elf32-xtensa.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
+index f7f569d0c086..a4b046e445f1 100644
+--- a/bfd/elf32-xtensa.c
++++ b/bfd/elf32-xtensa.c
+@@ -10022,7 +10022,8 @@ shrink_dynamic_reloc_sections (struct bfd_link_info *info,
+ if ((r_type == R_XTENSA_32 || r_type == R_XTENSA_PLT)
+ && (input_section->flags & SEC_ALLOC) != 0
+ && (dynamic_symbol || bfd_link_pic (info))
+- && (!h || h->root.type != bfd_link_hash_undefweak))
++ && (!h || h->root.type != bfd_link_hash_undefweak
++ || (dynamic_symbol && bfd_link_dll (info))))
+ {
+ asection *srel;
+ bfd_boolean is_plt = FALSE;
+--
+2.11.0
+
diff --git a/package/binutils/2.31.1/0011-xtensa-move-dynamic-relocations-sections-consistency.patch b/package/binutils/2.31.1/0011-xtensa-move-dynamic-relocations-sections-consistency.patch
new file mode 100644
index 000000000000..2c12ce3db1d9
--- /dev/null
+++ b/package/binutils/2.31.1/0011-xtensa-move-dynamic-relocations-sections-consistency.patch
@@ -0,0 +1,90 @@
+From f82863d797e461b936dff2b659a3aa65088ee87e Mon Sep 17 00:00:00 2001
+From: Max Filippov <jcmvbkbc@gmail.com>
+Date: Sun, 22 Jul 2018 18:59:11 -0700
+Subject: [PATCH] xtensa: move dynamic relocations sections consistency
+ check
+
+The function elf_xtensa_finish_dynamic_sections checks that sizes of
+sections .rela.dyn and .rela.plt match number of corresponding relocation
+records, but the check is only done when .rela.plt is non-empty, so, e.g.
+it is never run for the static PIE.
+Rearrange the test so that .rela.dyn and .rela.plt are checked always.
+
+bfd/
+2018-07-23 Max Filippov <jcmvbkbc@gmail.com>
+
+ * elf32-xtensa.c (elf_xtensa_finish_dynamic_sections): Move
+ relocation sections consistency check to always check both
+ .rela.dyn and .rela.plt when they exist. Rearrange variable
+ definition and assignment places.
+
+Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
+Backported from: f82863d797e461b936dff2b659a3aa65088ee87e
+---
+ bfd/elf32-xtensa.c | 22 +++++++++++-----------
+ 1 file changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
+index a4b046e445f1..cf085b7b0751 100644
+--- a/bfd/elf32-xtensa.c
++++ b/bfd/elf32-xtensa.c
+@@ -3156,7 +3156,7 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
+ {
+ struct elf_xtensa_link_hash_table *htab;
+ bfd *dynobj;
+- asection *sdyn, *srelplt, *sgot, *sxtlit, *sgotloc;
++ asection *sdyn, *srelplt, *srelgot, *sgot, *sxtlit, *sgotloc;
+ Elf32_External_Dyn *dyncon, *dynconend;
+ int num_xtlit_entries = 0;
+
+@@ -3186,15 +3186,15 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
+ }
+
+ srelplt = htab->elf.srelplt;
++ srelgot = htab->elf.srelgot;
+ if (srelplt && srelplt->size != 0)
+ {
+- asection *sgotplt, *srelgot, *spltlittbl;
++ asection *sgotplt, *spltlittbl;
+ int chunk, plt_chunks, plt_entries;
+ Elf_Internal_Rela irela;
+ bfd_byte *loc;
+ unsigned rtld_reloc;
+
+- srelgot = htab->elf.srelgot;
+ spltlittbl = htab->spltlittbl;
+ BFD_ASSERT (srelgot != NULL && spltlittbl != NULL);
+
+@@ -3260,14 +3260,6 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
+ spltlittbl->contents + (chunk * 8) + 4);
+ }
+
+- /* All the dynamic relocations have been emitted at this point.
+- Make sure the relocation sections are the correct size. */
+- if (srelgot->size != (sizeof (Elf32_External_Rela)
+- * srelgot->reloc_count)
+- || srelplt->size != (sizeof (Elf32_External_Rela)
+- * srelplt->reloc_count))
+- abort ();
+-
+ /* The .xt.lit.plt section has just been modified. This must
+ happen before the code below which combines adjacent literal
+ table entries, and the .xt.lit.plt contents have to be forced to
+@@ -3282,6 +3274,14 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
+ spltlittbl->flags &= ~SEC_HAS_CONTENTS;
+ }
+
++ /* All the dynamic relocations have been emitted at this point.
++ Make sure the relocation sections are the correct size. */
++ if ((srelgot && srelgot->size != (sizeof (Elf32_External_Rela)
++ * srelgot->reloc_count))
++ || (srelplt && srelplt->size != (sizeof (Elf32_External_Rela)
++ * srelplt->reloc_count)))
++ abort ();
++
+ /* Combine adjacent literal table entries. */
+ BFD_ASSERT (! bfd_link_relocatable (info));
+ sxtlit = bfd_get_section_by_name (output_bfd, ".xt.lit");
+--
+2.11.0
+
--
2.11.0
^ permalink raw reply related
* Re: [PATCH 2/5] coccinelle: use $(addsuffix) in 'coccicheck' make target
From: Junio C Hamano @ 2018-07-23 19:37 UTC (permalink / raw)
To: SZEDER Gábor
Cc: git, René Scharfe, Derrick Stolee,
Nguyễn Thái Ngọc Duy
In-Reply-To: <20180723135100.24288-3-szeder.dev@gmail.com>
SZEDER Gábor <szeder.dev@gmail.com> writes:
> The dependencies of the 'coccicheck' make target are listed with the
> help of the $(patsubst) make function, which in this case doesn't do
> any pattern substitution, but only adds the '.patch' suffix.
>
> Use the shorter and more idiomatic $(addsuffix) make function instead.
Makes sense.
>
> Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
> ---
> Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 27bfc196dd..8f509576e9 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2683,7 +2683,7 @@ C_SOURCES = $(patsubst %.o,%.c,$(C_OBJ))
> then \
> echo ' ' SPATCH result: $@; \
> fi
> -coccicheck: $(patsubst %.cocci,%.cocci.patch,$(wildcard contrib/coccinelle/*.cocci))
> +coccicheck: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.cocci))
>
> .PHONY: coccicheck
^ permalink raw reply
* Re: [RFC PATCH] audit: use current whenever possible
From: Richard Guy Briggs @ 2018-07-23 19:37 UTC (permalink / raw)
To: Paul Moore; +Cc: linux-audit
In-Reply-To: <153212502997.22712.10176469722588086701.stgit@chester>
On 2018-07-20 18:17, Paul Moore wrote:
> There are many places, notably audit_log_task_info() and
> audit_log_exit(), that take task_struct pointers but in reality they
> are always working on the current task. This patch eliminates the
> task_struct arguments and uses current directly which allows a number
> of cleanups as well.
I came across and removed a several in the audit task struct cleanup,
but it looks like you've rebased over those and caught a few more.
I'm fine with delaying setting task's context to NULL for
__audit_free().
Why was the context originally taken for __audit_syscall_exit() and
given back once the syscall event records have been issued? Is there a
possible race with something else?
> Signed-off-by: Paul Moore <paul@paul-moore.com>
Otherwise, this cleanup looks like a good simplification.
Reviewed-by: Richard Guy Briggs <rgb@redhat.com>
> ---
> drivers/tty/tty_audit.c | 13 ++--
> include/linux/audit.h | 6 +-
> kernel/audit.c | 34 +++++------
> kernel/audit.h | 2 -
> kernel/auditsc.c | 118 +++++++++++++++++---------------------
> security/integrity/ima/ima_api.c | 2 -
> 6 files changed, 81 insertions(+), 94 deletions(-)
>
> diff --git a/drivers/tty/tty_audit.c b/drivers/tty/tty_audit.c
> index 50f567b6a66e..28f87fd6a28e 100644
> --- a/drivers/tty/tty_audit.c
> +++ b/drivers/tty/tty_audit.c
> @@ -61,20 +61,19 @@ static void tty_audit_log(const char *description, dev_t dev,
> unsigned char *data, size_t size)
> {
> struct audit_buffer *ab;
> - struct task_struct *tsk = current;
> - pid_t pid = task_pid_nr(tsk);
> - uid_t uid = from_kuid(&init_user_ns, task_uid(tsk));
> - uid_t loginuid = from_kuid(&init_user_ns, audit_get_loginuid(tsk));
> - unsigned int sessionid = audit_get_sessionid(tsk);
> + pid_t pid = task_pid_nr(current);
> + uid_t uid = from_kuid(&init_user_ns, task_uid(current));
> + uid_t loginuid = from_kuid(&init_user_ns, audit_get_loginuid(current));
> + unsigned int sessionid = audit_get_sessionid(current);
>
> ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_TTY);
> if (ab) {
> - char name[sizeof(tsk->comm)];
> + char name[sizeof(current->comm)];
>
> audit_log_format(ab, "%s pid=%u uid=%u auid=%u ses=%u major=%d"
> " minor=%d comm=", description, pid, uid,
> loginuid, sessionid, MAJOR(dev), MINOR(dev));
> - get_task_comm(name, tsk);
> + get_task_comm(name, current);
> audit_log_untrustedstring(ab, name);
> audit_log_format(ab, " data=");
> audit_log_n_hex(ab, data, size);
> diff --git a/include/linux/audit.h b/include/linux/audit.h
> index 9334fbef7bae..108dd9706a30 100644
> --- a/include/linux/audit.h
> +++ b/include/linux/audit.h
> @@ -153,8 +153,7 @@ extern void audit_log_link_denied(const char *operation);
> extern void audit_log_lost(const char *message);
>
> extern int audit_log_task_context(struct audit_buffer *ab);
> -extern void audit_log_task_info(struct audit_buffer *ab,
> - struct task_struct *tsk);
> +extern void audit_log_task_info(struct audit_buffer *ab);
>
> extern int audit_update_lsm_rules(void);
>
> @@ -202,8 +201,7 @@ static inline int audit_log_task_context(struct audit_buffer *ab)
> {
> return 0;
> }
> -static inline void audit_log_task_info(struct audit_buffer *ab,
> - struct task_struct *tsk)
> +static inline void audit_log_task_info(struct audit_buffer *ab)
> { }
> #define audit_enabled AUDIT_OFF
> #endif /* CONFIG_AUDIT */
> diff --git a/kernel/audit.c b/kernel/audit.c
> index 2a8058764aa6..160144f7e5f9 100644
> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -1096,10 +1096,11 @@ static void audit_log_feature_change(int which, u32 old_feature, u32 new_feature
>
> if (audit_enabled == AUDIT_OFF)
> return;
> +
> ab = audit_log_start(audit_context(), GFP_KERNEL, AUDIT_FEATURE_CHANGE);
> if (!ab)
> return;
> - audit_log_task_info(ab, current);
> + audit_log_task_info(ab);
> audit_log_format(ab, " feature=%s old=%u new=%u old_lock=%u new_lock=%u res=%d",
> audit_feature_names[which], !!old_feature, !!new_feature,
> !!old_lock, !!new_lock, res);
> @@ -2247,15 +2248,15 @@ void audit_log_d_path_exe(struct audit_buffer *ab,
> audit_log_format(ab, " exe=(null)");
> }
>
> -struct tty_struct *audit_get_tty(struct task_struct *tsk)
> +struct tty_struct *audit_get_tty(void)
> {
> struct tty_struct *tty = NULL;
> unsigned long flags;
>
> - spin_lock_irqsave(&tsk->sighand->siglock, flags);
> - if (tsk->signal)
> - tty = tty_kref_get(tsk->signal->tty);
> - spin_unlock_irqrestore(&tsk->sighand->siglock, flags);
> + spin_lock_irqsave(¤t->sighand->siglock, flags);
> + if (current->signal)
> + tty = tty_kref_get(current->signal->tty);
> + spin_unlock_irqrestore(¤t->sighand->siglock, flags);
> return tty;
> }
>
> @@ -2264,25 +2265,24 @@ void audit_put_tty(struct tty_struct *tty)
> tty_kref_put(tty);
> }
>
> -void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk)
> +void audit_log_task_info(struct audit_buffer *ab)
> {
> const struct cred *cred;
> - char comm[sizeof(tsk->comm)];
> + char comm[sizeof(current->comm)];
> struct tty_struct *tty;
>
> if (!ab)
> return;
>
> - /* tsk == current */
> cred = current_cred();
> - tty = audit_get_tty(tsk);
> + tty = audit_get_tty();
> audit_log_format(ab,
> " ppid=%d pid=%d auid=%u uid=%u gid=%u"
> " euid=%u suid=%u fsuid=%u"
> " egid=%u sgid=%u fsgid=%u tty=%s ses=%u",
> - task_ppid_nr(tsk),
> - task_tgid_nr(tsk),
> - from_kuid(&init_user_ns, audit_get_loginuid(tsk)),
> + task_ppid_nr(current),
> + task_tgid_nr(current),
> + from_kuid(&init_user_ns, audit_get_loginuid(current)),
> from_kuid(&init_user_ns, cred->uid),
> from_kgid(&init_user_ns, cred->gid),
> from_kuid(&init_user_ns, cred->euid),
> @@ -2292,11 +2292,11 @@ void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk)
> from_kgid(&init_user_ns, cred->sgid),
> from_kgid(&init_user_ns, cred->fsgid),
> tty ? tty_name(tty) : "(none)",
> - audit_get_sessionid(tsk));
> + audit_get_sessionid(current));
> audit_put_tty(tty);
> audit_log_format(ab, " comm=");
> - audit_log_untrustedstring(ab, get_task_comm(comm, tsk));
> - audit_log_d_path_exe(ab, tsk->mm);
> + audit_log_untrustedstring(ab, get_task_comm(comm, current));
> + audit_log_d_path_exe(ab, current->mm);
> audit_log_task_context(ab);
> }
> EXPORT_SYMBOL(audit_log_task_info);
> @@ -2317,7 +2317,7 @@ void audit_log_link_denied(const char *operation)
> if (!ab)
> return;
> audit_log_format(ab, "op=%s", operation);
> - audit_log_task_info(ab, current);
> + audit_log_task_info(ab);
> audit_log_format(ab, " res=0");
> audit_log_end(ab);
> }
> diff --git a/kernel/audit.h b/kernel/audit.h
> index 214e14948370..9c76b7a6e956 100644
> --- a/kernel/audit.h
> +++ b/kernel/audit.h
> @@ -262,7 +262,7 @@ extern struct audit_entry *audit_dupe_rule(struct audit_krule *old);
> extern void audit_log_d_path_exe(struct audit_buffer *ab,
> struct mm_struct *mm);
>
> -extern struct tty_struct *audit_get_tty(struct task_struct *tsk);
> +extern struct tty_struct *audit_get_tty(void);
> extern void audit_put_tty(struct tty_struct *tty);
>
> /* audit watch functions */
> diff --git a/kernel/auditsc.c b/kernel/auditsc.c
> index fb207466e99b..8b12e525306e 100644
> --- a/kernel/auditsc.c
> +++ b/kernel/auditsc.c
> @@ -836,44 +836,6 @@ void audit_filter_inodes(struct task_struct *tsk, struct audit_context *ctx)
> rcu_read_unlock();
> }
>
> -/* Transfer the audit context pointer to the caller, clearing it in the tsk's struct */
> -static inline struct audit_context *audit_take_context(struct task_struct *tsk,
> - int return_valid,
> - long return_code)
> -{
> - struct audit_context *context = tsk->audit_context;
> -
> - if (!context)
> - return NULL;
> - context->return_valid = return_valid;
> -
> - /*
> - * we need to fix up the return code in the audit logs if the actual
> - * return codes are later going to be fixed up by the arch specific
> - * signal handlers
> - *
> - * This is actually a test for:
> - * (rc == ERESTARTSYS ) || (rc == ERESTARTNOINTR) ||
> - * (rc == ERESTARTNOHAND) || (rc == ERESTART_RESTARTBLOCK)
> - *
> - * but is faster than a bunch of ||
> - */
> - if (unlikely(return_code <= -ERESTARTSYS) &&
> - (return_code >= -ERESTART_RESTARTBLOCK) &&
> - (return_code != -ENOIOCTLCMD))
> - context->return_code = -EINTR;
> - else
> - context->return_code = return_code;
> -
> - if (context->in_syscall && !context->dummy) {
> - audit_filter_syscall(tsk, context, &audit_filter_list[AUDIT_FILTER_EXIT]);
> - audit_filter_inodes(tsk, context);
> - }
> -
> - audit_set_context(tsk, NULL);
> - return context;
> -}
> -
> static inline void audit_proctitle_free(struct audit_context *context)
> {
> kfree(context->proctitle.value);
> @@ -1298,15 +1260,18 @@ static inline int audit_proctitle_rtrim(char *proctitle, int len)
> return len;
> }
>
> -static void audit_log_proctitle(struct task_struct *tsk,
> - struct audit_context *context)
> +static void audit_log_proctitle(void)
> {
> int res;
> char *buf;
> char *msg = "(null)";
> int len = strlen(msg);
> + struct audit_context *context = audit_context();
> struct audit_buffer *ab;
>
> + if (!context)
> + return;
> +
> ab = audit_log_start(context, GFP_KERNEL, AUDIT_PROCTITLE);
> if (!ab)
> return; /* audit_panic or being filtered */
> @@ -1319,7 +1284,7 @@ static void audit_log_proctitle(struct task_struct *tsk,
> if (!buf)
> goto out;
> /* Historically called this from procfs naming */
> - res = get_cmdline(tsk, buf, MAX_PROCTITLE_AUDIT_LEN);
> + res = get_cmdline(current, buf, MAX_PROCTITLE_AUDIT_LEN);
> if (res == 0) {
> kfree(buf);
> goto out;
> @@ -1339,15 +1304,39 @@ static void audit_log_proctitle(struct task_struct *tsk,
> audit_log_end(ab);
> }
>
> -static void audit_log_exit(struct audit_context *context, struct task_struct *tsk)
> +static void audit_log_exit(int ret_valid, long ret_code)
> {
> int i, call_panic = 0;
> + struct audit_context *context = audit_context();
> struct audit_buffer *ab;
> struct audit_aux_data *aux;
> struct audit_names *n;
>
> - /* tsk == current */
> - context->personality = tsk->personality;
> + context->personality = current->personality;
> + context->return_valid = ret_valid;
> +
> + /*
> + * we need to fix up the return code in the audit logs if the actual
> + * return codes are later going to be fixed up by the arch specific
> + * signal handlers
> + *
> + * This is actually a test for:
> + * (rc == ERESTARTSYS ) || (rc == ERESTARTNOINTR) ||
> + * (rc == ERESTARTNOHAND) || (rc == ERESTART_RESTARTBLOCK)
> + *
> + * but is faster than a bunch of ||
> + */
> + if (unlikely(ret_code <= -ERESTARTSYS) &&
> + (ret_code >= -ERESTART_RESTARTBLOCK) &&
> + (ret_code != -ENOIOCTLCMD))
> + ret_code = -EINTR;
> + context->return_code = ret_code;
> +
> + if (context->in_syscall && !context->dummy) {
> + audit_filter_syscall(current, context,
> + &audit_filter_list[AUDIT_FILTER_EXIT]);
> + audit_filter_inodes(current, context);
> + }
>
> ab = audit_log_start(context, GFP_KERNEL, AUDIT_SYSCALL);
> if (!ab)
> @@ -1356,10 +1345,10 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
> context->arch, context->major);
> if (context->personality != PER_LINUX)
> audit_log_format(ab, " per=%lx", context->personality);
> - if (context->return_valid)
> + if (ret_valid)
> audit_log_format(ab, " success=%s exit=%ld",
> - (context->return_valid==AUDITSC_SUCCESS)?"yes":"no",
> - context->return_code);
> + (ret_valid == AUDITSC_SUCCESS) ? "yes" : "no",
> + ret_code);
>
> audit_log_format(ab,
> " a0=%lx a1=%lx a2=%lx a3=%lx items=%d",
> @@ -1369,7 +1358,7 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
> context->argv[3],
> context->name_count);
>
> - audit_log_task_info(ab, tsk);
> + audit_log_task_info(ab);
> audit_log_key(ab, context->filterkey);
> audit_log_end(ab);
>
> @@ -1458,7 +1447,7 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
> audit_log_name(context, n, NULL, i++, &call_panic);
> }
>
> - audit_log_proctitle(tsk, context);
> + audit_log_proctitle();
>
> /* Send end of event record to help user space know we are finished */
> ab = audit_log_start(context, GFP_KERNEL, AUDIT_EOE);
> @@ -1478,20 +1467,23 @@ void __audit_free(struct task_struct *tsk)
> {
> struct audit_context *context;
>
> - context = audit_take_context(tsk, 0, 0);
> + context = tsk->audit_context;
> if (!context)
> return;
>
> - /* Check for system calls that do not go through the exit
> - * function (e.g., exit_group), then free context block.
> - * We use GFP_ATOMIC here because we might be doing this
> - * in the context of the idle thread */
> - /* that can happen only if we are called from do_exit() */
> - if (context->in_syscall && context->current_state == AUDIT_RECORD_CONTEXT)
> - audit_log_exit(context, tsk);
> + /* We are called either by do_exit() or the fork() error handling code;
> + * in the former case tsk == current and in the latter tsk is a
> + * random task_struct that doesn't doesn't have any meaningful data we
> + * need to log via audit_log_exit(). */
> + if (tsk == current &&
> + context->in_syscall &&
> + context->current_state == AUDIT_RECORD_CONTEXT)
> + audit_log_exit(0, 0);
> +
> if (!list_empty(&context->killed_trees))
> audit_kill_trees(&context->killed_trees);
>
> + audit_set_context(tsk, NULL);
> audit_free_context(context);
> }
>
> @@ -1566,12 +1558,12 @@ void __audit_syscall_exit(int success, long return_code)
> else
> success = AUDITSC_FAILURE;
>
> - context = audit_take_context(current, success, return_code);
> + context = audit_context();
> if (!context)
> return;
>
> if (context->in_syscall && context->current_state == AUDIT_RECORD_CONTEXT)
> - audit_log_exit(context, current);
> + audit_log_exit(success, return_code);
>
> context->in_syscall = 0;
> context->prio = context->state == AUDIT_RECORD_CONTEXT ? ~0ULL : 0;
> @@ -1593,7 +1585,6 @@ void __audit_syscall_exit(int success, long return_code)
> kfree(context->filterkey);
> context->filterkey = NULL;
> }
> - audit_set_context(current, context);
> }
>
> static inline void handle_one(const struct inode *inode)
> @@ -2031,7 +2022,7 @@ static void audit_log_set_loginuid(kuid_t koldloginuid, kuid_t kloginuid,
> uid = from_kuid(&init_user_ns, task_uid(current));
> oldloginuid = from_kuid(&init_user_ns, koldloginuid);
> loginuid = from_kuid(&init_user_ns, kloginuid),
> - tty = audit_get_tty(current);
> + tty = audit_get_tty();
>
> audit_log_format(ab, "pid=%d uid=%u", task_tgid_nr(current), uid);
> audit_log_task_context(ab);
> @@ -2052,7 +2043,6 @@ static void audit_log_set_loginuid(kuid_t koldloginuid, kuid_t kloginuid,
> */
> int audit_set_loginuid(kuid_t loginuid)
> {
> - struct task_struct *task = current;
> unsigned int oldsessionid, sessionid = AUDIT_SID_UNSET;
> kuid_t oldloginuid;
> int rc;
> @@ -2071,8 +2061,8 @@ int audit_set_loginuid(kuid_t loginuid)
> sessionid = (unsigned int)atomic_inc_return(&session_id);
> }
>
> - task->sessionid = sessionid;
> - task->loginuid = loginuid;
> + current->sessionid = sessionid;
> + current->loginuid = loginuid;
> out:
> audit_log_set_loginuid(oldloginuid, loginuid, oldsessionid, sessionid, rc);
> return rc;
> diff --git a/security/integrity/ima/ima_api.c b/security/integrity/ima/ima_api.c
> index a02c5acfd403..30999169c0a8 100644
> --- a/security/integrity/ima/ima_api.c
> +++ b/security/integrity/ima/ima_api.c
> @@ -335,7 +335,7 @@ void ima_audit_measurement(struct integrity_iint_cache *iint,
> audit_log_untrustedstring(ab, filename);
> audit_log_format(ab, " hash=\"%s:%s\"", algo_name, hash);
>
> - audit_log_task_info(ab, current);
> + audit_log_task_info(ab);
> audit_log_end(ab);
>
> iint->flags |= IMA_AUDITED;
>
> --
> Linux-audit mailing list
> Linux-audit@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-audit
- RGB
--
Richard Guy Briggs <rgb@redhat.com>
Sr. S/W Engineer, Kernel Security, Base Operating Systems
Remote, Ottawa, Red Hat Canada
IRC: rgb, SunRaycer
Voice: +1.647.777.2635, Internal: (81) 32635
^ permalink raw reply
* Re: [PATCH 1/5] coccinelle: mark the 'coccicheck' make target as .PHONY
From: Junio C Hamano @ 2018-07-23 19:37 UTC (permalink / raw)
To: SZEDER Gábor
Cc: git, René Scharfe, Derrick Stolee,
Nguyễn Thái Ngọc Duy
In-Reply-To: <20180723135100.24288-2-szeder.dev@gmail.com>
SZEDER Gábor <szeder.dev@gmail.com> writes:
> The 'coccicheck' target doesn't create a file with the same name, so
> mark it as .PHONY.
>
> Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
> ---
Good. It is customary to do so immediately before the target, not
after a blank line, though.
> Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index e4b503d259..27bfc196dd 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2685,6 +2685,8 @@ C_SOURCES = $(patsubst %.o,%.c,$(C_OBJ))
> fi
> coccicheck: $(patsubst %.cocci,%.cocci.patch,$(wildcard contrib/coccinelle/*.cocci))
>
> +.PHONY: coccicheck
> +
> ### Installation rules
>
> ifneq ($(filter /%,$(firstword $(template_dir))),)
^ permalink raw reply
* [Qemu-devel] [PATCH v2 for-3.0] tests/libqtest: Improve kill_qemu()
From: Eric Blake @ 2018-07-23 19:35 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, mst, rth, alex.bennee, f4bug
In kill_qemu() we have an assert that checks that the QEMU process
didn't dump core:
assert(!WCOREDUMP(wstatus));
Unfortunately the WCOREDUMP macro here means the resulting message
is not very easy to comprehend on at least some systems:
ahci-test: tests/libqtest.c:113: kill_qemu: Assertion `!(((__extension__ (((union { __typeof(wstatus) __in; int __i; }) { .__in = (wstatus) }).__i))) & 0x80)' failed.
and it doesn't identify what signal the process took.
Furthermore, we are NOT detecting EINTR (while EINTR shouldn't be
happening if we didn't install signal handlers, it's still better
to always be robust), and also want to log unexpected non-zero status
that was not accompanied by a core dump.
Instead of using a raw assert, print the information in an
easier to understand way:
/i386/ahci/sanity: tests/libqtest.c:119: kill_qemu() detected QEMU death with core dump from signal 11 (Segmentation fault)
Aborted (core dumped)
(Of course, the really useful information would be why the QEMU
process dumped core in the first place, but we don't have that
by the time the test program has picked up the exit status.)
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Eric Blake <eblake@redhat.com>
---
I've taken the ideas from Peter's patch:
https://lists.gnu.org/archive/html/qemu-devel/2018-07/msg04430.html
as well as fixing a related issue brought up last time this was touched:
https://lists.gnu.org/archive/html/qemu-devel/2018-05/msg05710.html
tests/libqtest.c | 39 +++++++++++++++++++++++++++++++++++++--
1 file changed, 37 insertions(+), 2 deletions(-)
diff --git a/tests/libqtest.c b/tests/libqtest.c
index 098af6aec44..f3dabfadd78 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -105,12 +105,47 @@ static void kill_qemu(QTestState *s)
if (s->qemu_pid != -1) {
int wstatus = 0;
pid_t pid;
+ bool die = false;
kill(s->qemu_pid, SIGTERM);
+ retry:
pid = waitpid(s->qemu_pid, &wstatus, 0);
+ if (pid == -1 && errno == EINTR) {
+ goto retry;
+ }
- if (pid == s->qemu_pid && WIFSIGNALED(wstatus)) {
- assert(!WCOREDUMP(wstatus));
+ assert(pid == s->qemu_pid);
+ /*
+ * We expect qemu to exit with status 0; anything else is
+ * fishy and should be logged. Abort except when death by
+ * signal is not accompanied by a coredump (as that's the only
+ * time it was likely that the user is trying to kill the
+ * testsuite early).
+ */
+ if (wstatus) {
+ die = true;
+ if (WIFEXITED(wstatus)) {
+ fprintf(stderr, "%s:%d: kill_qemu() tried to terminate QEMU "
+ "process but encountered exit status %d\n",
+ __FILE__, __LINE__, WEXITSTATUS(wstatus));
+ } else if (WIFSIGNALED(wstatus)) {
+ int sig = WTERMSIG(wstatus);
+ const char *signame = strsignal(sig) ?: "unknown ???";
+
+ if (!WCOREDUMP(wstatus)) {
+ die = false;
+ fprintf(stderr, "%s:%d: kill_qemu() ignoring QEMU death "
+ "by signal %d (%s)\n",
+ __FILE__, __LINE__, sig, signame);
+ } else {
+ fprintf(stderr, "%s:%d: kill_qemu() detected QEMU death "
+ "with core dump from signal %d (%s)\n",
+ __FILE__, __LINE__, sig, signame);
+ }
+ }
+ }
+ if (die) {
+ abort();
}
}
}
--
2.14.4
^ permalink raw reply related
* Re: [PATCH v2 bpf 3/3] bpf: Introduce BPF_ANNOTATE_KV_PAIR
From: Yonghong Song @ 2018-07-23 18:31 UTC (permalink / raw)
To: Martin KaFai Lau, netdev; +Cc: Alexei Starovoitov, Daniel Borkmann, kernel-team
In-Reply-To: <20180721182043.1401089-4-kafai@fb.com>
On 7/21/18 11:20 AM, Martin KaFai Lau wrote:
> This patch introduces BPF_ANNOTATE_KV_PAIR to signal the
> bpf loader about the btf key_type and value_type of a bpf map.
> Please refer to the changes in test_btf_haskv.c for its usage.
> Both iproute2 and libbpf loader will then have the same
> convention to find out the map's btf_key_type_id and
> btf_value_type_id from a map's name.
>
> Fixes: 8a138aed4a80 ("bpf: btf: Add BTF support to libbpf")
> Suggested-by: Daniel Borkmann <daniel@iogearbox.net>
> Signed-off-by: Martin KaFai Lau <kafai@fb.com>
> ---
> tools/lib/bpf/btf.c | 7 +-
> tools/lib/bpf/btf.h | 2 +
> tools/lib/bpf/libbpf.c | 75 +++++++++++---------
> tools/testing/selftests/bpf/bpf_helpers.h | 9 +++
> tools/testing/selftests/bpf/test_btf_haskv.c | 7 +-
> 5 files changed, 56 insertions(+), 44 deletions(-)
>
> diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
> index ce77b5b57912..321a99e648ed 100644
> --- a/tools/lib/bpf/btf.c
> +++ b/tools/lib/bpf/btf.c
> @@ -189,8 +189,7 @@ static int btf_parse_type_sec(struct btf *btf, btf_print_fn_t err_log)
> return 0;
> }
>
> -static const struct btf_type *btf_type_by_id(const struct btf *btf,
> - __u32 type_id)
> +const struct btf_type *btf__type_by_id(const struct btf *btf, __u32 type_id)
> {
> if (type_id > btf->nr_types)
> return NULL;
> @@ -233,7 +232,7 @@ __s64 btf__resolve_size(const struct btf *btf, __u32 type_id)
> __s64 size = -1;
> int i;
>
> - t = btf_type_by_id(btf, type_id);
> + t = btf__type_by_id(btf, type_id);
> for (i = 0; i < MAX_RESOLVE_DEPTH && !btf_type_is_void_or_null(t);
> i++) {
> size = btf_type_size(t);
> @@ -258,7 +257,7 @@ __s64 btf__resolve_size(const struct btf *btf, __u32 type_id)
> return -EINVAL;
> }
>
> - t = btf_type_by_id(btf, type_id);
> + t = btf__type_by_id(btf, type_id);
> }
>
> if (size < 0)
> diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
> index ed3a84370ccc..e2a09a155f84 100644
> --- a/tools/lib/bpf/btf.h
> +++ b/tools/lib/bpf/btf.h
> @@ -9,6 +9,7 @@
> #define BTF_ELF_SEC ".BTF"
>
> struct btf;
> +struct btf_type;
>
> typedef int (*btf_print_fn_t)(const char *, ...)
> __attribute__((format(printf, 1, 2)));
> @@ -16,6 +17,7 @@ typedef int (*btf_print_fn_t)(const char *, ...)
> void btf__free(struct btf *btf);
> struct btf *btf__new(__u8 *data, __u32 size, btf_print_fn_t err_log);
> __s32 btf__find_by_name(const struct btf *btf, const char *type_name);
> +const struct btf_type *btf__type_by_id(const struct btf *btf, __u32 id);
> __s64 btf__resolve_size(const struct btf *btf, __u32 type_id);
> int btf__fd(const struct btf *btf);
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 6deb4fe4fffe..d881d370616c 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -36,6 +36,7 @@
> #include <linux/err.h>
> #include <linux/kernel.h>
> #include <linux/bpf.h>
> +#include <linux/btf.h>
> #include <linux/list.h>
> #include <linux/limits.h>
> #include <sys/stat.h>
> @@ -1014,68 +1015,72 @@ bpf_program__collect_reloc(struct bpf_program *prog, GElf_Shdr *shdr,
>
> static int bpf_map_find_btf_info(struct bpf_map *map, const struct btf *btf)
> {
> + const struct btf_type *container_type;
> + const struct btf_member *key, *value;
> struct bpf_map_def *def = &map->def;
> const size_t max_name = 256;
> + char container_name[max_name];
> __s64 key_size, value_size;
> - __s32 key_id, value_id;
> - char name[max_name];
> + __s32 container_id;
>
> - /* Find key type by name from BTF */
> - if (snprintf(name, max_name, "%s_key", map->name) == max_name) {
> - pr_warning("map:%s length of BTF key_type:%s_key is too long\n",
> + if (snprintf(container_name, max_name, "____btf_map_%s", map->name) ==
> + max_name) {
> + pr_warning("map:%s length of '____btf_map_%s' is too long\n",
> map->name, map->name);
> return -EINVAL;
> }
>
> - key_id = btf__find_by_name(btf, name);
> - if (key_id < 0) {
> - pr_debug("map:%s key_type:%s cannot be found in BTF\n",
> - map->name, name);
> - return key_id;
> + container_id = btf__find_by_name(btf, container_name);
> + if (container_id < 0) {
> + pr_debug("map:%s container_name:%s cannot be found in BTF. Missing BPF_ANNOTATE_KV_PAIR?\n",
> + map->name, container_name);
> + return container_id;
> }
>
> - key_size = btf__resolve_size(btf, key_id);
> - if (key_size < 0) {
> - pr_warning("map:%s key_type:%s cannot get the BTF type_size\n",
> - map->name, name);
> - return key_size;
> + container_type = btf__type_by_id(btf, container_id);
> + if (!container_type) {
> + pr_warning("map:%s cannot find BTF type for container_id:%u\n",
> + map->name, container_id);
> + return -EINVAL;
> }
>
> - if (def->key_size != key_size) {
> - pr_warning("map:%s key_type:%s has BTF type_size:%u != key_size:%u\n",
> - map->name, name, (unsigned int)key_size, def->key_size);
> + if (BTF_INFO_KIND(container_type->info) != BTF_KIND_STRUCT ||
> + BTF_INFO_VLEN(container_type->info) < 2) {
Should "BTF_INFO_VLEN(container_type->info) < 2" be
"BTF_INFO_VLEN(container_type->info) != 2"?
> + pr_warning("map:%s container_name:%s is an invalid container struct\n",
> + map->name, container_name);
> return -EINVAL;
> }
>
> - /* Find value type from BTF */
> - if (snprintf(name, max_name, "%s_value", map->name) == max_name) {
> - pr_warning("map:%s length of BTF value_type:%s_value is too long\n",
> - map->name, map->name);
> - return -EINVAL;
> + key = (struct btf_member *)(container_type + 1);
> + value = key + 1;
> +
> + key_size = btf__resolve_size(btf, key->type);
> + if (key_size < 0) {
> + pr_warning("map:%s invalid BTF key_type_size\n",
> + map->name);
> + return key_size;
> }
>
> - value_id = btf__find_by_name(btf, name);
> - if (value_id < 0) {
> - pr_debug("map:%s value_type:%s cannot be found in BTF\n",
> - map->name, name);
> - return value_id;
> + if (def->key_size != key_size) {
> + pr_warning("map:%s btf_key_type_size:%u != map_def_key_size:%u\n",
> + map->name, (__u32)key_size, def->key_size);
> + return -EINVAL;
> }
>
> - value_size = btf__resolve_size(btf, value_id);
> + value_size = btf__resolve_size(btf, value->type);
> if (value_size < 0) {
> - pr_warning("map:%s value_type:%s cannot get the BTF type_size\n",
> - map->name, name);
> + pr_warning("map:%s invalid BTF value_type_size\n", map->name);
> return value_size;
> }
>
> if (def->value_size != value_size) {
> - pr_warning("map:%s value_type:%s has BTF type_size:%u != value_size:%u\n",
> - map->name, name, (unsigned int)value_size, def->value_size);
> + pr_warning("map:%s btf_value_type_size:%u != map_def_value_size:%u\n",
> + map->name, (__u32)value_size, def->value_size);
> return -EINVAL;
> }
>
> - map->btf_key_type_id = key_id;
> - map->btf_value_type_id = value_id;
> + map->btf_key_type_id = key->type;
> + map->btf_value_type_id = value->type;
>
> return 0;
> }
> diff --git a/tools/testing/selftests/bpf/bpf_helpers.h b/tools/testing/selftests/bpf/bpf_helpers.h
> index f2f28b6c8915..810de20e8e26 100644
> --- a/tools/testing/selftests/bpf/bpf_helpers.h
> +++ b/tools/testing/selftests/bpf/bpf_helpers.h
> @@ -158,6 +158,15 @@ struct bpf_map_def {
> unsigned int numa_node;
> };
>
> +#define BPF_ANNOTATE_KV_PAIR(name, type_key, type_val) \
> + struct ____btf_map_##name { \
> + type_key key; \
> + type_val value; \
> + }; \
> + struct ____btf_map_##name \
> + __attribute__ ((section(".maps." #name), used)) \
> + ____btf_map_##name = { }
> +
> static int (*bpf_skb_load_bytes)(void *ctx, int off, void *to, int len) =
> (void *) BPF_FUNC_skb_load_bytes;
> static int (*bpf_skb_store_bytes)(void *ctx, int off, void *from, int len, int flags) =
> diff --git a/tools/testing/selftests/bpf/test_btf_haskv.c b/tools/testing/selftests/bpf/test_btf_haskv.c
> index 8c7ca096ecf2..b21b876f475d 100644
> --- a/tools/testing/selftests/bpf/test_btf_haskv.c
> +++ b/tools/testing/selftests/bpf/test_btf_haskv.c
> @@ -10,11 +10,6 @@ struct ipv_counts {
> unsigned int v6;
> };
>
> -typedef int btf_map_key;
> -typedef struct ipv_counts btf_map_value;
> -btf_map_key dumm_key;
> -btf_map_value dummy_value;
> -
> struct bpf_map_def SEC("maps") btf_map = {
> .type = BPF_MAP_TYPE_ARRAY,
> .key_size = sizeof(int),
> @@ -22,6 +17,8 @@ struct bpf_map_def SEC("maps") btf_map = {
> .max_entries = 4,
> };
>
> +BPF_ANNOTATE_KV_PAIR(btf_map, int, struct ipv_counts);
> +
> struct dummy_tracepoint_args {
> unsigned long long pad;
> struct sock *sock;
>
^ permalink raw reply
* Re: [PATCH] drm/rockchip: Replace drm_dev_unref with drm_dev_put
From: Heiko Stuebner @ 2018-07-23 19:32 UTC (permalink / raw)
To: Thomas Zimmermann; +Cc: dri-devel
In-Reply-To: <20180717110927.30776-1-tzimmermann@suse.de>
Hi Thomas,
Am Dienstag, 17. Juli 2018, 13:09:27 CEST schrieb Thomas Zimmermann:
> This patch unifies the naming of DRM functions for reference counting
> of struct drm_device. The resulting code is more aligned with the rest
> of the Linux kernel interfaces.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
applied to drm-misc-next
Thanks
Heiko
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply
* Re: [PATCH 03/14] format-patch: teach --interdiff to respect -v/--reroll-count
From: Eric Sunshine @ 2018-07-23 19:32 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy
Cc: Git List, Johannes Schindelin,
Ævar Arnfjörð Bjarmason, Stefan Beller
In-Reply-To: <CACsJy8AGwbrEFU2bTynXyQi1DmEYtwHrtmefMz+jD13GQs=9HQ@mail.gmail.com>
On Mon, Jul 23, 2018 at 12:12 PM Duy Nguyen <pclouds@gmail.com> wrote:
> On Sun, Jul 22, 2018 at 11:57 AM Eric Sunshine <sunshine@sunshineco.com> wrote:
> > @@ -215,6 +215,7 @@ struct rev_info {
> > /* interdiff */
> > const struct object_id *idiff_oid1;
> > const struct object_id *idiff_oid2;
> > + const char *idiff_title;
>
> I feel we're abusing struct rev_info a bit for this since this
> interdiff thing is very builtin/log.c's business and not at all
> related to rev walk. Is it possible (and easy) to just pass
> idfff_title from cmd_format_patch to make_cover_letter()? If it's a
> lot of code, then I guess we can just leave it here.
As originally implemented, this information was passed directly to
make_cover_letter(), however, as you discovered in your review of
patch 6/14[1], which makes it possible to embed an interdiff in the
commentary section of a lone patch, 'struct rev_info' is the only way
to pass this information down that deeply in the patch-generation
process. So, yes, this pretty much needs to use 'struct rev_info',
even if that need doesn't exist at this early step in the series.
[1]: https://public-inbox.org/git/CACsJy8Aw6R8-3kDfhCqunXziajCg9O_1WrEYc4rfKa+-=m1D5g@mail.gmail.com/
^ permalink raw reply
* [Qemu-devel] [PATCH for-3.1 2/2] acpi: Decouple ACPI hotplug callbacks from HotplugHandler
From: Eduardo Habkost @ 2018-07-23 19:31 UTC (permalink / raw)
To: qemu-devel
Cc: Marcel Apfelbaum, Igor Mammedov, Xiao Guangrong, Ben Warren,
Michael S. Tsirkin
In-Reply-To: <20180723193145.24705-1-ehabkost@redhat.com>
The ACPI hotplug callbacks get a HotplugHandler object as
argument. This has two problems:
1) The functions require a TYPE_ACPI_DEVICE_IF object, but the
function prototype doesn't indicate that. It's possible to
pass an object that would make the function crash.
2) The function does not require the object to implement
TYPE_HOTPLUG_HANDLER at all, but the function prototype
imposes that for no reason.
Change the argument type to AcpiDeviceIf instead of
HotplugHandler.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
include/hw/acpi/cpu.h | 5 ++---
include/hw/acpi/cpu_hotplug.h | 2 +-
include/hw/acpi/memory_hotplug.h | 4 ++--
include/hw/acpi/pcihp.h | 4 ++--
include/hw/mem/nvdimm.h | 3 ++-
hw/acpi/cpu.c | 8 ++++----
hw/acpi/cpu_hotplug.c | 4 ++--
hw/acpi/ich9.c | 14 ++++++++------
hw/acpi/memory_hotplug.c | 8 ++++----
hw/acpi/nvdimm.c | 4 ++--
hw/acpi/pcihp.c | 8 ++++----
hw/acpi/piix4.c | 18 ++++++++++--------
12 files changed, 43 insertions(+), 39 deletions(-)
diff --git a/include/hw/acpi/cpu.h b/include/hw/acpi/cpu.h
index 89ce172941..3ae6504c24 100644
--- a/include/hw/acpi/cpu.h
+++ b/include/hw/acpi/cpu.h
@@ -15,7 +15,6 @@
#include "hw/qdev-core.h"
#include "hw/acpi/acpi.h"
#include "hw/acpi/aml-build.h"
-#include "hw/hotplug.h"
typedef struct AcpiCpuStatus {
struct CPUState *cpu;
@@ -34,10 +33,10 @@ typedef struct CPUHotplugState {
AcpiCpuStatus *devs;
} CPUHotplugState;
-void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev,
+void acpi_cpu_plug_cb(AcpiDeviceIf *acpi_dev,
CPUHotplugState *cpu_st, DeviceState *dev, Error **errp);
-void acpi_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
+void acpi_cpu_unplug_request_cb(AcpiDeviceIf *acpi_dev,
CPUHotplugState *cpu_st,
DeviceState *dev, Error **errp);
diff --git a/include/hw/acpi/cpu_hotplug.h b/include/hw/acpi/cpu_hotplug.h
index 3b932abbbb..8e663b0606 100644
--- a/include/hw/acpi/cpu_hotplug.h
+++ b/include/hw/acpi/cpu_hotplug.h
@@ -25,7 +25,7 @@ typedef struct AcpiCpuHotplug {
uint8_t sts[ACPI_GPE_PROC_LEN];
} AcpiCpuHotplug;
-void legacy_acpi_cpu_plug_cb(HotplugHandler *hotplug_dev,
+void legacy_acpi_cpu_plug_cb(AcpiDeviceIf *acpi_dev,
AcpiCpuHotplug *g, DeviceState *dev, Error **errp);
void legacy_acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h
index 77c65765d6..ebd97093dd 100644
--- a/include/hw/acpi/memory_hotplug.h
+++ b/include/hw/acpi/memory_hotplug.h
@@ -31,9 +31,9 @@ typedef struct MemHotplugState {
void acpi_memory_hotplug_init(MemoryRegion *as, Object *owner,
MemHotplugState *state, uint16_t io_base);
-void acpi_memory_plug_cb(HotplugHandler *hotplug_dev, MemHotplugState *mem_st,
+void acpi_memory_plug_cb(AcpiDeviceIf *acpi_dev, MemHotplugState *mem_st,
DeviceState *dev, Error **errp);
-void acpi_memory_unplug_request_cb(HotplugHandler *hotplug_dev,
+void acpi_memory_unplug_request_cb(AcpiDeviceIf *acpi_dev,
MemHotplugState *mem_st,
DeviceState *dev, Error **errp);
void acpi_memory_unplug_cb(MemHotplugState *mem_st,
diff --git a/include/hw/acpi/pcihp.h b/include/hw/acpi/pcihp.h
index 8a65f99fc8..bba37b81dc 100644
--- a/include/hw/acpi/pcihp.h
+++ b/include/hw/acpi/pcihp.h
@@ -56,9 +56,9 @@ typedef struct AcpiPciHpState {
void acpi_pcihp_init(Object *owner, AcpiPciHpState *, PCIBus *root,
MemoryRegion *address_space_io, bool bridges_enabled);
-void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s,
+void acpi_pcihp_device_plug_cb(AcpiDeviceIf *acpi_dev, AcpiPciHpState *s,
DeviceState *dev, Error **errp);
-void acpi_pcihp_device_unplug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s,
+void acpi_pcihp_device_unplug_cb(AcpiDeviceIf *acpi_dev, AcpiPciHpState *s,
DeviceState *dev, Error **errp);
/* Called on reset */
diff --git a/include/hw/mem/nvdimm.h b/include/hw/mem/nvdimm.h
index c5c9b3c7f8..0d80497efe 100644
--- a/include/hw/mem/nvdimm.h
+++ b/include/hw/mem/nvdimm.h
@@ -25,6 +25,7 @@
#include "hw/mem/pc-dimm.h"
#include "hw/acpi/bios-linker-loader.h"
+#include "hw/acpi/acpi_dev_interface.h"
#define NVDIMM_DEBUG 0
#define nvdimm_debug(fmt, ...) \
@@ -149,5 +150,5 @@ void nvdimm_build_acpi(GArray *table_offsets, GArray *table_data,
BIOSLinker *linker, AcpiNVDIMMState *state,
uint32_t ram_slots);
void nvdimm_plug(AcpiNVDIMMState *state);
-void nvdimm_acpi_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev);
+void nvdimm_acpi_plug_cb(AcpiDeviceIf *acpi_dev, DeviceState *dev);
#endif
diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c
index 2eb9b5a032..71aec1d655 100644
--- a/hw/acpi/cpu.c
+++ b/hw/acpi/cpu.c
@@ -220,7 +220,7 @@ static AcpiCpuStatus *get_cpu_status(CPUHotplugState *cpu_st, DeviceState *dev)
return NULL;
}
-void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev,
+void acpi_cpu_plug_cb(AcpiDeviceIf *acpi_dev,
CPUHotplugState *cpu_st, DeviceState *dev, Error **errp)
{
AcpiCpuStatus *cdev;
@@ -233,11 +233,11 @@ void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev,
cdev->cpu = CPU(dev);
if (dev->hotplugged) {
cdev->is_inserting = true;
- acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_CPU_HOTPLUG_STATUS);
+ acpi_send_event(acpi_dev, ACPI_CPU_HOTPLUG_STATUS);
}
}
-void acpi_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
+void acpi_cpu_unplug_request_cb(AcpiDeviceIf *acpi_dev,
CPUHotplugState *cpu_st,
DeviceState *dev, Error **errp)
{
@@ -249,7 +249,7 @@ void acpi_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
}
cdev->is_removing = true;
- acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_CPU_HOTPLUG_STATUS);
+ acpi_send_event(acpi_dev, ACPI_CPU_HOTPLUG_STATUS);
}
void acpi_cpu_unplug_cb(CPUHotplugState *cpu_st,
diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c
index 5a1599796b..d9277e27de 100644
--- a/hw/acpi/cpu_hotplug.c
+++ b/hw/acpi/cpu_hotplug.c
@@ -72,14 +72,14 @@ static void acpi_set_cpu_present_bit(AcpiCpuHotplug *g, CPUState *cpu,
g->sts[cpu_id / 8] |= (1 << (cpu_id % 8));
}
-void legacy_acpi_cpu_plug_cb(HotplugHandler *hotplug_dev,
+void legacy_acpi_cpu_plug_cb(AcpiDeviceIf *acpi_dev,
AcpiCpuHotplug *g, DeviceState *dev, Error **errp)
{
acpi_set_cpu_present_bit(g, CPU(dev), errp);
if (*errp != NULL) {
return;
}
- acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_CPU_HOTPLUG_STATUS);
+ acpi_send_event(acpi_dev, ACPI_CPU_HOTPLUG_STATUS);
}
void legacy_acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index c5d8646abc..c53b8bb508 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -487,20 +487,21 @@ void ich9_pm_device_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
Error **errp)
{
ICH9LPCState *lpc = ICH9_LPC_DEVICE(hotplug_dev);
+ AcpiDeviceIf *acpi_dev = ACPI_DEVICE_IF(hotplug_dev);
if (lpc->pm.acpi_memory_hotplug.is_enabled &&
object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) {
- nvdimm_acpi_plug_cb(hotplug_dev, dev);
+ nvdimm_acpi_plug_cb(acpi_dev, dev);
} else {
- acpi_memory_plug_cb(hotplug_dev, &lpc->pm.acpi_memory_hotplug,
+ acpi_memory_plug_cb(acpi_dev, &lpc->pm.acpi_memory_hotplug,
dev, errp);
}
} else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
if (lpc->pm.cpu_hotplug_legacy) {
- legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.gpe_cpu, dev, errp);
+ legacy_acpi_cpu_plug_cb(acpi_dev, &lpc->pm.gpe_cpu, dev, errp);
} else {
- acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.cpuhp_state, dev, errp);
+ acpi_cpu_plug_cb(acpi_dev, &lpc->pm.cpuhp_state, dev, errp);
}
} else {
error_setg(errp, "acpi: device plug request for not supported device"
@@ -512,15 +513,16 @@ void ich9_pm_device_unplug_request_cb(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
ICH9LPCState *lpc = ICH9_LPC_DEVICE(hotplug_dev);
+ AcpiDeviceIf *acpi_dev = ACPI_DEVICE_IF(hotplug_dev);
if (lpc->pm.acpi_memory_hotplug.is_enabled &&
object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
- acpi_memory_unplug_request_cb(hotplug_dev,
+ acpi_memory_unplug_request_cb(acpi_dev,
&lpc->pm.acpi_memory_hotplug, dev,
errp);
} else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU) &&
!lpc->pm.cpu_hotplug_legacy) {
- acpi_cpu_unplug_request_cb(hotplug_dev, &lpc->pm.cpuhp_state,
+ acpi_cpu_unplug_request_cb(acpi_dev, &lpc->pm.cpuhp_state,
dev, errp);
} else {
error_setg(errp, "acpi: device unplug request for not supported device"
diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
index 24b2aa0301..c0a4c39432 100644
--- a/hw/acpi/memory_hotplug.c
+++ b/hw/acpi/memory_hotplug.c
@@ -261,7 +261,7 @@ acpi_memory_slot_status(MemHotplugState *mem_st,
return &mem_st->devs[slot];
}
-void acpi_memory_plug_cb(HotplugHandler *hotplug_dev, MemHotplugState *mem_st,
+void acpi_memory_plug_cb(AcpiDeviceIf *acpi_dev, MemHotplugState *mem_st,
DeviceState *dev, Error **errp)
{
MemStatus *mdev;
@@ -280,11 +280,11 @@ void acpi_memory_plug_cb(HotplugHandler *hotplug_dev, MemHotplugState *mem_st,
mdev->is_enabled = true;
if (dev->hotplugged) {
mdev->is_inserting = true;
- acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_MEMORY_HOTPLUG_STATUS);
+ acpi_send_event(acpi_dev, ACPI_MEMORY_HOTPLUG_STATUS);
}
}
-void acpi_memory_unplug_request_cb(HotplugHandler *hotplug_dev,
+void acpi_memory_unplug_request_cb(AcpiDeviceIf *acpi_dev,
MemHotplugState *mem_st,
DeviceState *dev, Error **errp)
{
@@ -296,7 +296,7 @@ void acpi_memory_unplug_request_cb(HotplugHandler *hotplug_dev,
}
mdev->is_removing = true;
- acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_MEMORY_HOTPLUG_STATUS);
+ acpi_send_event(acpi_dev, ACPI_MEMORY_HOTPLUG_STATUS);
}
void acpi_memory_unplug_cb(MemHotplugState *mem_st,
diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
index bdc373696d..b4708dc746 100644
--- a/hw/acpi/nvdimm.c
+++ b/hw/acpi/nvdimm.c
@@ -918,10 +918,10 @@ static const MemoryRegionOps nvdimm_dsm_ops = {
},
};
-void nvdimm_acpi_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev)
+void nvdimm_acpi_plug_cb(AcpiDeviceIf *acpi_dev, DeviceState *dev)
{
if (dev->hotplugged) {
- acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_NVDIMM_HOTPLUG_STATUS);
+ acpi_send_event(acpi_dev, ACPI_NVDIMM_HOTPLUG_STATUS);
}
}
diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
index b3bb11dac5..c094d86de3 100644
--- a/hw/acpi/pcihp.c
+++ b/hw/acpi/pcihp.c
@@ -217,7 +217,7 @@ void acpi_pcihp_reset(AcpiPciHpState *s)
acpi_pcihp_update(s);
}
-void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s,
+void acpi_pcihp_device_plug_cb(AcpiDeviceIf *acpi_dev, AcpiPciHpState *s,
DeviceState *dev, Error **errp)
{
PCIDevice *pdev = PCI_DEVICE(dev);
@@ -237,10 +237,10 @@ void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s,
}
s->acpi_pcihp_pci_status[bsel].up |= (1U << slot);
- acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_PCI_HOTPLUG_STATUS);
+ acpi_send_event(acpi_dev, ACPI_PCI_HOTPLUG_STATUS);
}
-void acpi_pcihp_device_unplug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s,
+void acpi_pcihp_device_unplug_cb(AcpiDeviceIf *acpi_dev, AcpiPciHpState *s,
DeviceState *dev, Error **errp)
{
PCIDevice *pdev = PCI_DEVICE(dev);
@@ -253,7 +253,7 @@ void acpi_pcihp_device_unplug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s,
}
s->acpi_pcihp_pci_status[bsel].down |= (1U << slot);
- acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_PCI_HOTPLUG_STATUS);
+ acpi_send_event(acpi_dev, ACPI_PCI_HOTPLUG_STATUS);
}
static uint64_t pci_read(void *opaque, hwaddr addr, unsigned int size)
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 6404af5f33..c26c66242f 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -374,22 +374,23 @@ static void piix4_device_plug_cb(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
PIIX4PMState *s = PIIX4_PM(hotplug_dev);
+ AcpiDeviceIf *acpi_dev = ACPI_DEVICE_IF(hotplug_dev);
if (s->acpi_memory_hotplug.is_enabled &&
object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) {
- nvdimm_acpi_plug_cb(hotplug_dev, dev);
+ nvdimm_acpi_plug_cb(acpi_dev, dev);
} else {
- acpi_memory_plug_cb(hotplug_dev, &s->acpi_memory_hotplug,
+ acpi_memory_plug_cb(acpi_dev, &s->acpi_memory_hotplug,
dev, errp);
}
} else if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
- acpi_pcihp_device_plug_cb(hotplug_dev, &s->acpi_pci_hotplug, dev, errp);
+ acpi_pcihp_device_plug_cb(acpi_dev, &s->acpi_pci_hotplug, dev, errp);
} else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
if (s->cpu_hotplug_legacy) {
- legacy_acpi_cpu_plug_cb(hotplug_dev, &s->gpe_cpu, dev, errp);
+ legacy_acpi_cpu_plug_cb(acpi_dev, &s->gpe_cpu, dev, errp);
} else {
- acpi_cpu_plug_cb(hotplug_dev, &s->cpuhp_state, dev, errp);
+ acpi_cpu_plug_cb(acpi_dev, &s->cpuhp_state, dev, errp);
}
} else {
error_setg(errp, "acpi: device plug request for not supported device"
@@ -401,17 +402,18 @@ static void piix4_device_unplug_request_cb(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
PIIX4PMState *s = PIIX4_PM(hotplug_dev);
+ AcpiDeviceIf *acpi_dev = ACPI_DEVICE_IF(hotplug_dev);
if (s->acpi_memory_hotplug.is_enabled &&
object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
- acpi_memory_unplug_request_cb(hotplug_dev, &s->acpi_memory_hotplug,
+ acpi_memory_unplug_request_cb(acpi_dev, &s->acpi_memory_hotplug,
dev, errp);
} else if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
- acpi_pcihp_device_unplug_cb(hotplug_dev, &s->acpi_pci_hotplug, dev,
+ acpi_pcihp_device_unplug_cb(acpi_dev, &s->acpi_pci_hotplug, dev,
errp);
} else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU) &&
!s->cpu_hotplug_legacy) {
- acpi_cpu_unplug_request_cb(hotplug_dev, &s->cpuhp_state, dev, errp);
+ acpi_cpu_unplug_request_cb(acpi_dev, &s->cpuhp_state, dev, errp);
} else {
error_setg(errp, "acpi: device unplug request for not supported device"
" type: %s", object_get_typename(OBJECT(dev)));
--
2.18.0.rc1.1.g3f1ff2140
^ permalink raw reply related
* [Qemu-devel] [PATCH for-3.1 1/2] acpi: Improve acpi_send_event() type safety
From: Eduardo Habkost @ 2018-07-23 19:31 UTC (permalink / raw)
To: qemu-devel
Cc: Marcel Apfelbaum, Igor Mammedov, Xiao Guangrong, Ben Warren,
Michael S. Tsirkin
In-Reply-To: <20180723193145.24705-1-ehabkost@redhat.com>
acpi_send_event() requires an object that implements
TYPE_ACPI_DEVICE_IF. Indicate that in the function prototype.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
include/hw/acpi/acpi_dev_interface.h | 2 +-
hw/acpi/acpi_interface.c | 5 ++---
hw/acpi/cpu.c | 4 ++--
hw/acpi/cpu_hotplug.c | 2 +-
hw/acpi/memory_hotplug.c | 4 ++--
hw/acpi/nvdimm.c | 2 +-
hw/acpi/pcihp.c | 4 ++--
hw/acpi/vmgenid.c | 2 +-
8 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/include/hw/acpi/acpi_dev_interface.h b/include/hw/acpi/acpi_dev_interface.h
index dabf4c4fc9..bab71f9d60 100644
--- a/include/hw/acpi/acpi_dev_interface.h
+++ b/include/hw/acpi/acpi_dev_interface.h
@@ -31,7 +31,7 @@ typedef struct AcpiDeviceIf {
Object Parent;
} AcpiDeviceIf;
-void acpi_send_event(DeviceState *dev, AcpiEventStatusBits event);
+void acpi_send_event(AcpiDeviceIf *dev, AcpiEventStatusBits event);
/**
* AcpiDeviceIfClass:
diff --git a/hw/acpi/acpi_interface.c b/hw/acpi/acpi_interface.c
index 6583917b8e..f9b538293e 100644
--- a/hw/acpi/acpi_interface.c
+++ b/hw/acpi/acpi_interface.c
@@ -2,12 +2,11 @@
#include "hw/acpi/acpi_dev_interface.h"
#include "qemu/module.h"
-void acpi_send_event(DeviceState *dev, AcpiEventStatusBits event)
+void acpi_send_event(AcpiDeviceIf *dev, AcpiEventStatusBits event)
{
AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(dev);
if (adevc->send_event) {
- AcpiDeviceIf *adev = ACPI_DEVICE_IF(dev);
- adevc->send_event(adev, event);
+ adevc->send_event(dev, event);
}
}
diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c
index 5ae595ecbe..2eb9b5a032 100644
--- a/hw/acpi/cpu.c
+++ b/hw/acpi/cpu.c
@@ -233,7 +233,7 @@ void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev,
cdev->cpu = CPU(dev);
if (dev->hotplugged) {
cdev->is_inserting = true;
- acpi_send_event(DEVICE(hotplug_dev), ACPI_CPU_HOTPLUG_STATUS);
+ acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_CPU_HOTPLUG_STATUS);
}
}
@@ -249,7 +249,7 @@ void acpi_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
}
cdev->is_removing = true;
- acpi_send_event(DEVICE(hotplug_dev), ACPI_CPU_HOTPLUG_STATUS);
+ acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_CPU_HOTPLUG_STATUS);
}
void acpi_cpu_unplug_cb(CPUHotplugState *cpu_st,
diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c
index 5243918125..5a1599796b 100644
--- a/hw/acpi/cpu_hotplug.c
+++ b/hw/acpi/cpu_hotplug.c
@@ -79,7 +79,7 @@ void legacy_acpi_cpu_plug_cb(HotplugHandler *hotplug_dev,
if (*errp != NULL) {
return;
}
- acpi_send_event(DEVICE(hotplug_dev), ACPI_CPU_HOTPLUG_STATUS);
+ acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_CPU_HOTPLUG_STATUS);
}
void legacy_acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
index 0ff1712c4c..24b2aa0301 100644
--- a/hw/acpi/memory_hotplug.c
+++ b/hw/acpi/memory_hotplug.c
@@ -280,7 +280,7 @@ void acpi_memory_plug_cb(HotplugHandler *hotplug_dev, MemHotplugState *mem_st,
mdev->is_enabled = true;
if (dev->hotplugged) {
mdev->is_inserting = true;
- acpi_send_event(DEVICE(hotplug_dev), ACPI_MEMORY_HOTPLUG_STATUS);
+ acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_MEMORY_HOTPLUG_STATUS);
}
}
@@ -296,7 +296,7 @@ void acpi_memory_unplug_request_cb(HotplugHandler *hotplug_dev,
}
mdev->is_removing = true;
- acpi_send_event(DEVICE(hotplug_dev), ACPI_MEMORY_HOTPLUG_STATUS);
+ acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_MEMORY_HOTPLUG_STATUS);
}
void acpi_memory_unplug_cb(MemHotplugState *mem_st,
diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
index 27eeb6609f..bdc373696d 100644
--- a/hw/acpi/nvdimm.c
+++ b/hw/acpi/nvdimm.c
@@ -921,7 +921,7 @@ static const MemoryRegionOps nvdimm_dsm_ops = {
void nvdimm_acpi_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev)
{
if (dev->hotplugged) {
- acpi_send_event(DEVICE(hotplug_dev), ACPI_NVDIMM_HOTPLUG_STATUS);
+ acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_NVDIMM_HOTPLUG_STATUS);
}
}
diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
index 80d42e12ff..b3bb11dac5 100644
--- a/hw/acpi/pcihp.c
+++ b/hw/acpi/pcihp.c
@@ -237,7 +237,7 @@ void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s,
}
s->acpi_pcihp_pci_status[bsel].up |= (1U << slot);
- acpi_send_event(DEVICE(hotplug_dev), ACPI_PCI_HOTPLUG_STATUS);
+ acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_PCI_HOTPLUG_STATUS);
}
void acpi_pcihp_device_unplug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s,
@@ -253,7 +253,7 @@ void acpi_pcihp_device_unplug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s,
}
s->acpi_pcihp_pci_status[bsel].down |= (1U << slot);
- acpi_send_event(DEVICE(hotplug_dev), ACPI_PCI_HOTPLUG_STATUS);
+ acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_PCI_HOTPLUG_STATUS);
}
static uint64_t pci_read(void *opaque, hwaddr addr, unsigned int size)
diff --git a/hw/acpi/vmgenid.c b/hw/acpi/vmgenid.c
index d78b579a20..74caedde79 100644
--- a/hw/acpi/vmgenid.c
+++ b/hw/acpi/vmgenid.c
@@ -158,7 +158,7 @@ static void vmgenid_update_guest(VmGenIdState *vms)
cpu_physical_memory_write(vmgenid_addr, guid_le.data,
sizeof(guid_le.data));
/* Send _GPE.E05 event */
- acpi_send_event(DEVICE(obj), ACPI_VMGENID_CHANGE_STATUS);
+ acpi_send_event(ACPI_DEVICE_IF(obj), ACPI_VMGENID_CHANGE_STATUS);
}
}
}
--
2.18.0.rc1.1.g3f1ff2140
^ permalink raw reply related
* [Qemu-devel] [PATCH for-3.1 0/2] ACPI type safety cleanup
From: Eduardo Habkost @ 2018-07-23 19:31 UTC (permalink / raw)
To: qemu-devel
Cc: Marcel Apfelbaum, Igor Mammedov, Xiao Guangrong, Ben Warren,
Michael S. Tsirkin
Small cleanup to make the ACPI callback functions harder to
misuse.
Eduardo Habkost (2):
acpi: Improve acpi_send_event() type safety
acpi: Decouple ACPI hotplug callbacks from HotplugHandler
include/hw/acpi/acpi_dev_interface.h | 2 +-
include/hw/acpi/cpu.h | 5 ++---
include/hw/acpi/cpu_hotplug.h | 2 +-
include/hw/acpi/memory_hotplug.h | 4 ++--
include/hw/acpi/pcihp.h | 4 ++--
include/hw/mem/nvdimm.h | 3 ++-
hw/acpi/acpi_interface.c | 5 ++---
hw/acpi/cpu.c | 8 ++++----
hw/acpi/cpu_hotplug.c | 4 ++--
hw/acpi/ich9.c | 14 ++++++++------
hw/acpi/memory_hotplug.c | 8 ++++----
hw/acpi/nvdimm.c | 4 ++--
hw/acpi/pcihp.c | 8 ++++----
hw/acpi/piix4.c | 18 ++++++++++--------
hw/acpi/vmgenid.c | 2 +-
15 files changed, 47 insertions(+), 44 deletions(-)
--
2.18.0.rc1.1.g3f1ff2140
^ permalink raw reply
* Re: [PATCH 2/2] cpufreq: Fix a circular lock dependency problem
From: Waiman Long @ 2018-07-23 19:27 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Rafael J. Wysocki, Viresh Kumar, Thomas Gleixner, Ingo Molnar,
linux-kernel, linux-pm, Paul E. McKenney, Greg Kroah-Hartman,
Konrad Rzeszutek Wilk
In-Reply-To: <20180723191627.GJ2494@hirez.programming.kicks-ass.net>
On 07/23/2018 03:16 PM, Peter Zijlstra wrote:
> On Mon, Jul 23, 2018 at 01:49:39PM -0400, Waiman Long wrote:
>> drivers/cpufreq/cpufreq.c | 16 +++++++++++++++-
>> 1 file changed, 15 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
>> index b0dfd32..9cf02d7 100644
>> --- a/drivers/cpufreq/cpufreq.c
>> +++ b/drivers/cpufreq/cpufreq.c
>> @@ -922,8 +922,22 @@ static ssize_t store(struct kobject *kobj, struct attribute *attr,
>> struct cpufreq_policy *policy = to_policy(kobj);
>> struct freq_attr *fattr = to_attr(attr);
>> ssize_t ret = -EINVAL;
>> + int retries = 3;
>>
>> - cpus_read_lock();
>> + /*
>> + * cpus_read_trylock() is used here to work around a circular lock
>> + * dependency problem with respect to the cpufreq_register_driver().
>> + * With a simple retry loop, the chance of not able to get the
>> + * read lock is extremely small.
>> + */
>> + while (!cpus_read_trylock()) {
>> + if (retries-- <= 0)
>> + return -EBUSY;
>> + /*
>> + * Sleep for about 50ms and retry again.
>> + */
>> + msleep(50);
>> + }
> That's atrocious.
>
>
I had thought about just returning an error if the trylock fails as CPU
hotplug rarely happened. I can revert to that simple case if others have
no objection.
Cheers,
Longman
^ permalink raw reply
* Re: [PATCH net] ipv6: use fib6_info_hold_safe() when necessary
From: Martin KaFai Lau @ 2018-07-23 18:25 UTC (permalink / raw)
To: Wei Wang; +Cc: David Miller, netdev, Eric Dumazet, David Ahern
In-Reply-To: <20180722035632.136090-1-tracywwnj@gmail.com>
On Sat, Jul 21, 2018 at 08:56:32PM -0700, Wei Wang wrote:
> From: Wei Wang <weiwan@google.com>
>
> In the code path where only rcu read lock is held, e.g. in the route
> lookup code path, it is not safe to directly call fib6_info_hold()
> because the fib6_info may already have been deleted but still exists
> in the rcu grace period. Holding reference to it could cause double
> free and crash the kernel.
>
> This patch adds a new function fib6_info_hold_safe() and replace
> fib6_info_hold() in all necessary places.
Acked-by: Martin KaFai Lau <kafai@fb.com>
^ permalink raw reply
* [U-Boot] [PATCH V2 29/32] fsl_esdhc: Update usdhc driver to support i.MX8
From: Fabio Estevam @ 2018-07-23 19:26 UTC (permalink / raw)
To: u-boot
In-Reply-To: <HE1PR04MB300482D714638B1159F970A488520@HE1PR04MB3004.eurprd04.prod.outlook.com>
Hi Peng,
On Thu, Jul 19, 2018 at 11:04 AM, Peng Fan <peng.fan@nxp.com> wrote:
> There is i.MX8/8X/8M, 8M is for i.MX8MQ and i.MX8MM
> i.MX8/8X has different SoC architecture compared with i.MX8M,
> such as there is SCU inside i.MX8/8X.
> So add a new macro dedicated for i.MX8/8X.
Yes, I understand the differences between the MX8 family.
Couldn't you make CONFIG_IMX8 instead of CONFIG_ARCH_IMX8 for consistency?
Also, for consistency: should CONFIG_MX8M be changed to CONFIG_IMX8M?
Thanks
^ permalink raw reply
* Re: [PATCH net-next 1/2] be2net: Collect the transmit queue data in Tx timeout
From: David Miller @ 2018-07-23 18:23 UTC (permalink / raw)
To: suresh.reddy; +Cc: netdev
In-Reply-To: <20180723142524.24224-2-suresh.reddy@broadcom.com>
From: Suresh Reddy <suresh.reddy@broadcom.com>
Date: Mon, 23 Jul 2018 10:25:23 -0400
> Driver dumps tx_queue, tx_compl, pending SKBs information in tx_timeout.
> This debug data used to idenfiy the cause of the time out.
>
> Also reset Lancer chip in tx_timeout.
>
> Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
The purpose of the tx timeout NDO operation is to do whatever is
necessary to handle the TX timeout.
Outputting debugging information is useful, but is secondary.
I see that you do reset the Lancer, but that is far from what really
needs to happen here.
When you get a TX timeout, the hardware is not processing TX ring
entries, nor signalling completion any longer.
Therefore the only way to get things going again is to reset all of
the TX side data structure and logic. This means shutting down the TX
engine, freeing up all of the TX SKBs in the ring, resetting the TX
ring software state, and then finally reprogramming the head/tail
pointer registers and re-enabling TX DMA processing.
^ permalink raw reply
* Re: [PATCH net] ipv6: use fib6_info_hold_safe() when necessary
From: David Miller @ 2018-07-23 18:19 UTC (permalink / raw)
To: weiwan; +Cc: netdev, edumazet, dsahern, kafai
In-Reply-To: <20180722035632.136090-1-tracywwnj@gmail.com>
From: Wei Wang <weiwan@google.com>
Date: Sat, 21 Jul 2018 20:56:32 -0700
> From: Wei Wang <weiwan@google.com>
>
> In the code path where only rcu read lock is held, e.g. in the route
> lookup code path, it is not safe to directly call fib6_info_hold()
> because the fib6_info may already have been deleted but still exists
> in the rcu grace period. Holding reference to it could cause double
> free and crash the kernel.
>
> This patch adds a new function fib6_info_hold_safe() and replace
> fib6_info_hold() in all necessary places.
>
> Syzbot reported 3 crash traces because of this. One of them is:
...
> Fixes: 93531c674315 (net/ipv6: separate handling of FIB entries from dst based routes)
> Reported-by: syzbot+902e2a1bcd4f7808cef5@syzkaller.appspotmail.com
> Reported-by: syzbot+8ae62d67f647abeeceb9@syzkaller.appspotmail.com
> Reported-by: syzbot+3f08feb14086930677d0@syzkaller.appspotmail.com
> Signed-off-by: Wei Wang <weiwan@google.com>
> Acked-by: Eric Dumazet <edumazet@google.com>
Applied, thank you.
^ permalink raw reply
* Re: [PATCH 1/2] Add sw2_sw4 voltage table to cpcap regulator.
From: Dmitry Osipenko @ 2018-07-23 19:20 UTC (permalink / raw)
To: Peter Geis
Cc: Mark Brown, lgirdwood, robh+dt, mark.rutland, linux-kernel,
devicetree, linux-tegra
In-Reply-To: <95929e34-eeb4-f3a4-daa1-0b89dd60f570@gmail.com>
On Monday, 23 July 2018 21:37:50 MSK Peter Geis wrote:
> On 07/23/2018 02:13 PM, Mark Brown wrote:
> > On Mon, Jul 23, 2018 at 01:58:26PM -0400, Peter Geis wrote:
> >> SW2 and SW4 use a shared table to provide voltage to the cpu core and
> >> devices on Tegra hardware.
> >> Added this table to the cpcap regulator driver as the first step to
> >> supporting this device on Tegra.
> >
> > This also doesn't apply against current code (though it does now parse
> > OK), please check and resend - make sure you don't have other out of
> > tree changes and are using an up to date kernel (ideally my regulator
> > for-next branch) as a base.
>
> Good Afternoon,
>
> I thought it was my error in the patches being stripped, unfortunately
> it seems to be a known Gmail behavior.
> Any ideas on how to get around it?
Use the "git send-email" instead of email client.
You need to create and send out patches using git, that will be something like
this:
1) "git format-patch -v1 -2 ..." to make patches
2) "git send-email --smtp-server=smtp.gmail.com --smtp-
user=pgwipeout@gmail.com --smtp-encryption=tls --smtp-server-port=587 --
suppress-cc=all --confirm=always --to 'Mark Brown <broonie@kernel.org>' --cc
'linux-tegra@vger.kernel.org' --cc 'linux-kernel@vger.kernel.org' ...
00*.patch" to send out the patches
^ permalink raw reply
* [U-Boot] [PATCH v2] gpio: xilinx: Convert driver to DM
From: Stefan Herbrechtsmeier @ 2018-07-23 19:19 UTC (permalink / raw)
To: u-boot
In-Reply-To: <397eb159-d47d-1657-39ed-9c6b0b1795ff@xilinx.com>
Hi Michal,
Am 23.07.2018 um 13:43 schrieb Michal Simek:
> On 20.7.2018 22:05, Stefan Herbrechtsmeier wrote:
>> Am 13.07.2018 um 17:20 schrieb Michal Simek:
>>> This patch is enabling GPIO_DM support to have an option to use this
>>> driver together with zynq gpio driver.
>>> !DM part is kept there till Microblaze is cleanup which will be done
>>> hopefully soon.
>>>
>>> Just a note:
>>> There is no reason to initialize uc-priv->name because it is completely
>>> unused.
>>>
>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>> ---
>>>
>>> Changes in v2:
>>> - Show value in set_value when debug is enabled
>>> - Implement xlate function
>>> - Remove tabs from structures for alignment (to be consistent with the
>>> rest of code)
>>>
>>> drivers/gpio/xilinx_gpio.c | 265
>>> ++++++++++++++++++++++++++++++++++++++++++++-
>>> 1 file changed, 264 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpio/xilinx_gpio.c b/drivers/gpio/xilinx_gpio.c
>>> index 74c5be0865d1..48b52c985a55 100644
>>> --- a/drivers/gpio/xilinx_gpio.c
>>> +++ b/drivers/gpio/xilinx_gpio.c
[snip]
>>> +static int xilinx_gpio_probe(struct udevice *dev)
>>> +{
>>> + struct xilinx_gpio_platdata *platdata = dev_get_platdata(dev);
>>> + struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
>>> +
>>> + uc_priv->bank_name = dev->name;
>> Have you check the "gpio status -a" output? Maybe you could use a
>> gpio-bank-name from the device tree.
> The same as for zynq. gpio-bank-name is not in Linux. And yes I was
> checking output. If you know better way please let me know.
Please see my other answer.
>>> +
>>> + uc_priv->gpio_count = platdata->bank_max[0] + platdata->bank_max[1];
>>> +
>>> + return 0;
>>> +}
>>> +
>>> +static int xilinx_gpio_ofdata_to_platdata(struct udevice *dev)
>>> +{
>>> + struct xilinx_gpio_platdata *platdata = dev_get_platdata(dev);
>>> + int is_dual;
>>> +
>>> + platdata->regs = (struct gpio_regs *)dev_read_addr(dev);
>>> +
>>> + platdata->bank_max[0] = dev_read_u32_default(dev,
>>> + "xlnx,gpio-width", 0);
>> The default value of the Linux driver is 32.
> but not in binding doc.
Okay
>>> + platdata->bank_input[0] = dev_read_u32_default(dev,
>>> + "xlnx,all-inputs", 0);
>> This isn't supported by the Linux driver but documented in the device
>> tree bindings.
> correct.
>
>>> + platdata->bank_output[0] = dev_read_u32_default(dev,
>>> + "xlnx,all-outputs", 0);
>> This isn't supported by the Linux driver neither documented in the
>> device tree bindings.
> This IP, driver and dt binding was done pretty long time ago. I could be
> one of the first dt driver that's why there could issues with dt bindings.
> DTG is generating all these properties from day one and in Linux only
> documented property where that one which are used by Linux.
> All that old dt binding docs should be checked again and there is
> actually 22 patches sent to gpio mailing list
> https://patchwork.ozlabs.org/patch/947371/
> but I haven't looked at them yet.
Okay
>>> +
>>> + is_dual = dev_read_u32_default(dev, "xlnx,is-dual", 0);
>>> + if (is_dual) {
>>> + platdata->bank_max[1] = dev_read_u32_default(dev,
>>> + "xlnx,gpio2-width", 0);
>>> + platdata->bank_input[1] = dev_read_u32_default(dev,
>>> + "xlnx,all-inputs-2", 0);
>>> + platdata->bank_output[1] = dev_read_u32_default(dev,
>>> + "xlnx,all-outputs-2", 0);
>>> + }
>>> +
>>> + return 0;
>>> +}
>>> +
>>> +static const struct udevice_id xilinx_gpio_ids[] = {
>>> + { .compatible = "xlnx,xps-gpio-1.00.a",},
>>> + { }
>>> +};
>>> +
>>> +U_BOOT_DRIVER(xilinx_gpio) = {
>>> + .name = "xlnx_gpio",
>>> + .id = UCLASS_GPIO,
>>> + .ops = &xilinx_gpio_ops,
>>> + .of_match = xilinx_gpio_ids,
>>> + .ofdata_to_platdata = xilinx_gpio_ofdata_to_platdata,
>>> + .probe = xilinx_gpio_probe,
>>> + .platdata_auto_alloc_size = sizeof(struct xilinx_gpio_platdata),
>>> +};
>>> +#endif
>> Maybe the Xilinx AXI GPIO LogiCore IP driver could be integrated into
>> the generic gpio-mmio driver. This driver is compatible to the hardware
>> and doesn't need a default value for the data register in the device tree.
> There is no support for irq that's why I don't think this is going to fly.
I wasn't aware of the irq because the irq support is missing in the
xilinx driver at the moment. I only realized that the xilinx driver use
a subset of the generic gpio driver with a different binding.
Best regards
Stefan
^ permalink raw reply
* Re: [PATCH 02/14] format-patch: add --interdiff option to embed diff in cover letter
From: Eric Sunshine @ 2018-07-23 19:18 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy
Cc: Git List, Johannes Schindelin,
Ævar Arnfjörð Bjarmason, Stefan Beller
In-Reply-To: <CACsJy8C8RK6HkfoEYJGZg=sgtJS0WksHD3=7Souw3jYebRo=Sg@mail.gmail.com>
On Mon, Jul 23, 2018 at 12:03 PM Duy Nguyen <pclouds@gmail.com> wrote:
> On Sun, Jul 22, 2018 at 11:57 AM Eric Sunshine <sunshine@sunshineco.com> wrote:
> > @@ -0,0 +1,17 @@
> > +void show_interdiff(struct rev_info *rev)
> > +{
> > + struct diff_options opts;
> > +
> > + memcpy(&opts, &rev->diffopt, sizeof(opts));
> > + opts.output_format = DIFF_FORMAT_PATCH;
> > + diff_setup_done(&opts);
> > +
> > + diff_tree_oid(rev->idiff_oid1, rev->idiff_oid2, "", &opts);
> > + diffcore_std(&opts);
> > + diff_flush(&opts);
> > +}
>
> Is it worth adding a new file just for a single function? I haven't
> read the rest of the series, but the cover letter's diffstat suggests
> this is it. Is interdiff intended to become a lot more complicated in
> the future? If not maybe just add this function in diff-lib.c
Good question. The functionality originally lived in builtin/log.c but
moved to log-tree.c when I added the ability to embed an interdiff in
a single patch. However, it didn't "feel" right in log-tree.c, so I
moved it to its own file to mirror how the range-diff engine resides
in its own file.
And, the function actually did several more things as originally
implemented. For instance, it took care of not clobbering global
diff-queue state, and consulting 'reroll_count' and printing the
"Interdiff:" header, but those bits eventually moved to live at more
"correct" locations, leaving this relatively minimal function behind.
It does get a bit more complex in a later patch, but not significantly
so.
I wasn't aware of diff-lib.c, but it does seem like show_interdiff()
could be at home there.
^ permalink raw reply
* [PATCH 5/5] sh_eth: make sh_eth_tsu_{read|write}_entry() prototypes symmetric
From: Sergei Shtylyov @ 2018-07-23 18:15 UTC (permalink / raw)
To: netdev, David S. Miller; +Cc: linux-renesas-soc
In-Reply-To: <24093fd0-1b9b-a211-f988-0272483185d6@cogentembedded.com>
sh_eth_tsu_read_entry() is still asymmetric with sh_eth_tsu_write_entry()
WRT their prototypes -- make them symmetric by passing to the former a TSU
register offset instead of its address and also adding the (now necessary)
'ndev' parameter...
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
drivers/net/ethernet/renesas/sh_eth.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net-next/drivers/net/ethernet/renesas/sh_eth.c
@@ -2695,16 +2695,17 @@ static int sh_eth_tsu_write_entry(struct
return 0;
}
-static void sh_eth_tsu_read_entry(void *reg, u8 *addr)
+static void sh_eth_tsu_read_entry(struct net_device *ndev, u16 offset, u8 *addr)
{
+ struct sh_eth_private *mdp = netdev_priv(ndev);
u32 val;
- val = ioread32(reg);
+ val = ioread32(mdp->tsu_addr + offset);
addr[0] = (val >> 24) & 0xff;
addr[1] = (val >> 16) & 0xff;
addr[2] = (val >> 8) & 0xff;
addr[3] = val & 0xff;
- val = ioread32(reg + 4);
+ val = ioread32(mdp->tsu_addr + offset + 4);
addr[4] = (val >> 8) & 0xff;
addr[5] = val & 0xff;
}
@@ -2718,7 +2719,7 @@ static int sh_eth_tsu_find_entry(struct
u8 c_addr[ETH_ALEN];
for (i = 0; i < SH_ETH_TSU_CAM_ENTRIES; i++, reg_offset += 8) {
- sh_eth_tsu_read_entry(mdp->tsu_addr + reg_offset, c_addr);
+ sh_eth_tsu_read_entry(ndev, reg_offset, c_addr);
if (ether_addr_equal(addr, c_addr))
return i;
}
@@ -2839,7 +2840,7 @@ static void sh_eth_tsu_purge_mcast(struc
return;
for (i = 0; i < SH_ETH_TSU_CAM_ENTRIES; i++, reg_offset += 8) {
- sh_eth_tsu_read_entry(mdp->tsu_addr + reg_offset, addr);
+ sh_eth_tsu_read_entry(ndev, reg_offset, addr);
if (is_multicast_ether_addr(addr))
sh_eth_tsu_del_entry(ndev, addr);
}
^ permalink raw reply
* Re: [PATCH v4 net-next 2/3] rds: Enable RDS IPv6 support
From: David Miller @ 2018-07-23 18:15 UTC (permalink / raw)
To: ka-cheong.poon; +Cc: netdev, santosh.shilimkar, rds-devel, sowmini.varadhan
In-Reply-To: <4dc7ee44840f6166cec8847aefc2bc51e072a7ac.1532318752.git.ka-cheong.poon@oracle.com>
From: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
Date: Mon, 23 Jul 2018 07:16:11 -0700
> @@ -163,15 +165,29 @@ int rds_tcp_accept_one(struct socket *sock)
>
> inet = inet_sk(new_sock->sk);
>
> + my_addr = &new_sock->sk->sk_v6_rcv_saddr;
> + peer_addr = &new_sock->sk->sk_v6_daddr,
> rdsdebug("accepted tcp %pI6c:%u -> %pI6c:%u\n",
Note that comma, instead of a semicolon, at the end of the peer_addr
assignment.
This doesn't even compile.
^ permalink raw reply
* [PATCH 4/5] sh_eth: make sh_eth_tsu_write_entry() take 'offset' parameter
From: Sergei Shtylyov @ 2018-07-23 18:14 UTC (permalink / raw)
To: netdev, David S. Miller; +Cc: linux-renesas-soc
In-Reply-To: <24093fd0-1b9b-a211-f988-0272483185d6@cogentembedded.com>
We can add the TSU register base address to a TSU register offset right
in sh_eth_tsu_write_entry(), no need to do it in its callers...
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
drivers/net/ethernet/renesas/sh_eth.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net-next/drivers/net/ethernet/renesas/sh_eth.c
@@ -2676,18 +2676,19 @@ static int sh_eth_tsu_busy(struct net_de
return 0;
}
-static int sh_eth_tsu_write_entry(struct net_device *ndev, void *reg,
+static int sh_eth_tsu_write_entry(struct net_device *ndev, u16 offset,
const u8 *addr)
{
+ struct sh_eth_private *mdp = netdev_priv(ndev);
u32 val;
val = addr[0] << 24 | addr[1] << 16 | addr[2] << 8 | addr[3];
- iowrite32(val, reg);
+ iowrite32(val, mdp->tsu_addr + offset);
if (sh_eth_tsu_busy(ndev) < 0)
return -EBUSY;
val = addr[4] << 8 | addr[5];
- iowrite32(val, reg + 4);
+ iowrite32(val, mdp->tsu_addr + offset + 4);
if (sh_eth_tsu_busy(ndev) < 0)
return -EBUSY;
@@ -2747,9 +2748,7 @@ static int sh_eth_tsu_disable_cam_entry_
~(1 << (31 - entry)), TSU_TEN);
memset(blank, 0, sizeof(blank));
- ret = sh_eth_tsu_write_entry(ndev,
- mdp->tsu_addr + reg_offset + entry * 8,
- blank);
+ ret = sh_eth_tsu_write_entry(ndev, reg_offset + entry * 8, blank);
if (ret < 0)
return ret;
return 0;
@@ -2770,9 +2769,7 @@ static int sh_eth_tsu_add_entry(struct n
i = sh_eth_tsu_find_empty(ndev);
if (i < 0)
return -ENOMEM;
- ret = sh_eth_tsu_write_entry(ndev,
- mdp->tsu_addr + reg_offset + i * 8,
- addr);
+ ret = sh_eth_tsu_write_entry(ndev, reg_offset + i * 8, addr);
if (ret < 0)
return ret;
^ permalink raw reply
* Re: [PATCH 2/2] cpufreq: Fix a circular lock dependency problem
From: Peter Zijlstra @ 2018-07-23 19:16 UTC (permalink / raw)
To: Waiman Long
Cc: Rafael J. Wysocki, Viresh Kumar, Thomas Gleixner, Ingo Molnar,
linux-kernel, linux-pm, Paul E. McKenney, Greg Kroah-Hartman,
Konrad Rzeszutek Wilk
In-Reply-To: <1532368179-15263-3-git-send-email-longman@redhat.com>
On Mon, Jul 23, 2018 at 01:49:39PM -0400, Waiman Long wrote:
> drivers/cpufreq/cpufreq.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index b0dfd32..9cf02d7 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -922,8 +922,22 @@ static ssize_t store(struct kobject *kobj, struct attribute *attr,
> struct cpufreq_policy *policy = to_policy(kobj);
> struct freq_attr *fattr = to_attr(attr);
> ssize_t ret = -EINVAL;
> + int retries = 3;
>
> - cpus_read_lock();
> + /*
> + * cpus_read_trylock() is used here to work around a circular lock
> + * dependency problem with respect to the cpufreq_register_driver().
> + * With a simple retry loop, the chance of not able to get the
> + * read lock is extremely small.
> + */
> + while (!cpus_read_trylock()) {
> + if (retries-- <= 0)
> + return -EBUSY;
> + /*
> + * Sleep for about 50ms and retry again.
> + */
> + msleep(50);
> + }
That's atrocious.
^ permalink raw reply
* [PATCH] drm/i915/icl: Add DSS_CTL Registers
From: Anusha Srivatsa @ 2018-07-23 19:11 UTC (permalink / raw)
To: intel-gfx; +Cc: Rodrigo Vivi
From: "Srivatsa, Anusha" <anusha.srivatsa@intel.com>
Add defines for DSS_CTL registers.
These registers specify the big joiner, splitter,
overlap pixels and info regarding display stream
compression enabled on left or right branch.
v2:
- Add define to conditionally check the buffer target depth (James Ausmus)
Suggested-by: Madhav Chauhan <madhav.chauhan@intel.com>
Cc: Madhav Chauhan <madhav.chauhan@intel.com>
Cc: Manasi Navare <manasi.d.navare@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
---
drivers/gpu/drm/i915/i915_reg.h | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 7394605..0a0e07c 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -7707,6 +7707,39 @@ enum {
#define RC_MAX_QP_SHIFT 5
#define RC_MIN_QP_SHIFT 0
+/* Display Stream Splitter Control */
+#define DSS_CTL1 _MMIO(0x67400)
+#define SPLITTER_ENABLE (1 << 31)
+#define JOINER_ENABLE (1 << 30)
+#define DUAL_LINK_MODE_INTERLEAVE (1 << 24)
+#define DUAL_LINK_MODE_FRONTBACK (0 << 24)
+#define OVERLAP_PIXELS_MASK (0xf << 16)
+#define OVERLAP_PIXELS(pixels) ((pixels) << 16)
+#define LEFT_DL_BUF_TARGET_DEPTH_MASK (0xfff << 0)
+#define LEFT_DL_BUF_TARGET_DEPTH(pixels) ((pixels) << 0)
+#define MAX_DL_BUFFER_TARGET_DEPTH 0x5A0
+
+#define DSS_CTL2 _MMIO(0x67404)
+#define LEFT_BRANCH_VDSC_ENABLE (1 << 31)
+#define RIGHT_BRANCH_VDSC_ENABLE (1 << 15)
+#define RIGHT_DL_BUF_TARGET_DEPTH_MASK (0xfff << 0)
+#define RIGHT_DL_BUF_TARGET_DEPTH(pixels) ((pixels) << 0)
+
+#define _ICL_PIPE_DSS_CTL1_PB 0x78200
+#define _ICL_PIPE_DSS_CTL1_PC 0x78400
+#define ICL_PIPE_DSS_CTL1(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
+ _ICL_PIPE_DSS_CTL1_PB, \
+ _ICL_PIPE_DSS_CTL1_PC)
+#define BIG_JOINER_ENABLE (1 << 29)
+#define MASTER_BIG_JOINER_ENABLE (1 << 28)
+#define VGA_CENTERING_ENABLE (1 << 27)
+
+#define _ICL_PIPE_DSS_CTL2_PB 0x78204
+#define _ICL_PIPE_DSS_CTL2_PC 0x78404
+#define ICL_PIPE_DSS_CTL2(pipe) _MMIO_PIPE((pipe) - PIPE_B, \
+ _ICL_PIPE_DSS_CTL2_PB, \
+ _ICL_PIPE_DSS_CTL2_PC)
+
#define DSCA_RC_RANGE_PARAMETERS_1 _MMIO(0x6B248)
#define DSCA_RC_RANGE_PARAMETERS_1_UDW _MMIO(0x6B248 + 4)
#define DSCC_RC_RANGE_PARAMETERS_1 _MMIO(0x6BA48)
--
2.7.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related
* [PATCH 3/5] sh_eth: call sh_eth_tsu_get_offset() from TSU register accessors
From: Sergei Shtylyov @ 2018-07-23 18:12 UTC (permalink / raw)
To: netdev, David S. Miller; +Cc: linux-renesas-soc
In-Reply-To: <24093fd0-1b9b-a211-f988-0272483185d6@cogentembedded.com>
With sh_eth_tsu_get_offset() now actually returning TSU register's offset,
we can at last use it in sh_eth_tsu_{read|write}(). Somehow this saves 248
bytes of object code with AArch64 gcc 4.8.5... :-)
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
drivers/net/ethernet/renesas/sh_eth.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net-next/drivers/net/ethernet/renesas/sh_eth.c
@@ -447,7 +447,7 @@ static u16 sh_eth_tsu_get_offset(struct
static void sh_eth_tsu_write(struct sh_eth_private *mdp, u32 data,
int enum_index)
{
- u16 offset = mdp->reg_offset[enum_index];
+ u16 offset = sh_eth_tsu_get_offset(mdp, enum_index);
if (WARN_ON(offset == SH_ETH_OFFSET_INVALID))
return;
@@ -457,7 +457,7 @@ static void sh_eth_tsu_write(struct sh_e
static u32 sh_eth_tsu_read(struct sh_eth_private *mdp, int enum_index)
{
- u16 offset = mdp->reg_offset[enum_index];
+ u16 offset = sh_eth_tsu_get_offset(mdp, enum_index);
if (WARN_ON(offset == SH_ETH_OFFSET_INVALID))
return ~0U;
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.