[PATCH v8 0/7] Support RAS virtualization in KVM
by Dongjiu Geng
This series patches mainly do below things:
1. Trap RAS ERR* registers Accesses to EL2 from Non-secure EL1,
KVM will will do a minimum simulation, there registers are simulated
to RAZ/WI in KVM.
2. Route synchronous External Abort exceptions from Non-secure EL0
and EL1 to EL2. When exception EL3 routing is enabled by firmware,
system will trap to EL3 firmware instead of EL2 KVM, then firmware
judges whether El2 routing is enabled, if enabled, jump to EL2 KVM,
otherwise jump to EL1 host kernel.
3. Enable APEI ARv8 SEI notification to parse the CPER records for SError
in the ACPI GHES driver, KVM will call handle_guest_sei() to let ACPI
driver to parse the CPER record for SError which happened in the guest
4. Although we can use APEI driver to handle the guest SError, but not all
system support SEI notification, such as kernel-first. So here KVM will
also classify the Error through Exception Syndrome Register and do different
approaches according to Asynchronous Error Type
5. If the guest SError error is not propagated and not consumed, then KVM return
recoverable error status to user-space, user-space will specify the guest ESR
and inject a virtual SError. For other Asynchronous Error Type, KVM directly
injects virtual SError with IMPLEMENTATION DEFINED ESR or KVM is panic if the
error is fatal. In the RAS extension, guest virtual ESR must be set, because
all-zero means 'RAS error: Uncategorized' instead of 'no valid ISS', so set
this ESR to IMPLEMENTATION DEFINED by default if user space does not specify it.
Dongjiu Geng (5):
acpi: apei: Add SEI notification type support for ARMv8
KVM: arm64: Trap RAS error registers and set HCR_EL2's TERR & TEA
arm64: kvm: Introduce KVM_ARM_SET_SERROR_ESR ioctl
arm64: kvm: Set Virtual SError Exception Syndrome for guest
arm64: kvm: handle SError Interrupt by categorization
James Morse (1):
KVM: arm64: Save ESR_EL2 on guest SError
Xie XiuQi (1):
arm64: cpufeature: Detect CPU RAS Extentions
Documentation/virtual/kvm/api.txt | 11 ++++++
arch/arm/include/asm/kvm_host.h | 1 +
arch/arm/kvm/guest.c | 9 +++++
arch/arm64/Kconfig | 16 +++++++++
arch/arm64/include/asm/barrier.h | 1 +
arch/arm64/include/asm/cpucaps.h | 3 +-
arch/arm64/include/asm/esr.h | 15 ++++++++
arch/arm64/include/asm/kvm_arm.h | 2 ++
arch/arm64/include/asm/kvm_asm.h | 3 ++
arch/arm64/include/asm/kvm_emulate.h | 17 +++++++++
arch/arm64/include/asm/kvm_host.h | 2 ++
arch/arm64/include/asm/sysreg.h | 15 ++++++++
arch/arm64/include/asm/system_misc.h | 1 +
arch/arm64/kernel/cpufeature.c | 13 +++++++
arch/arm64/kernel/process.c | 3 ++
arch/arm64/kvm/guest.c | 14 ++++++++
arch/arm64/kvm/handle_exit.c | 67 +++++++++++++++++++++++++++++++++---
arch/arm64/kvm/hyp/switch.c | 31 +++++++++++++++--
arch/arm64/kvm/inject_fault.c | 13 ++++++-
arch/arm64/kvm/reset.c | 3 ++
arch/arm64/kvm/sys_regs.c | 10 ++++++
arch/arm64/mm/fault.c | 16 +++++++++
drivers/acpi/apei/Kconfig | 15 ++++++++
drivers/acpi/apei/ghes.c | 53 ++++++++++++++++++++++++++++
include/acpi/ghes.h | 1 +
include/uapi/linux/kvm.h | 3 ++
virt/kvm/arm/arm.c | 7 ++++
27 files changed, 336 insertions(+), 9 deletions(-)
--
1.9.1
4 years, 7 months
Re: [Devel] [PATCH v10 2/4] pm: add to_power_supply macro to the API
by Andy Shevchenko
On Sat, Dec 30, 2017 at 1:49 AM, Ognjen Galić <smclt30p(a)gmail.com> wrote:
> On Čet, 2017-12-28 at 10:19 +0200, Andy Shevchenko wrote:
>> On Sat, Dec 23, 2017 at 12:53 PM, Ognjen Galic <smclt30p(a)gmail.com>
>> wrote:
>> >
>> > This patch adds the to_power_supply macro to upcast
>> > a device to a power_supply struct.
>> >
>> > This is needed because the same piece of code using
>> > container_of is used in various other places, so we
>> > abstract away such low-level operations via a macro.
>> >
>> > ---
>> This is wrong! You have to use *existing* --- line below. Otherwise
>> all mail parsers will cut this out including your SoB tag.
>>
>
> My bad I guess. Want another patch revision with that fixed or
> something?
>
You definitely need to send a new revision with all comments
addressed. So far you didn't responce to them which I recognize as
total agreement that they have to be addressed.
--
With Best Regards,
Andy Shevchenko
4 years, 7 months
Re: [Devel] [PATCH v10 2/4] pm: add to_power_supply macro to the API
by Andy Shevchenko
On Sat, Dec 23, 2017 at 12:53 PM, Ognjen Galic <smclt30p(a)gmail.com> wrote:
> This patch adds the to_power_supply macro to upcast
> a device to a power_supply struct.
>
> This is needed because the same piece of code using
> container_of is used in various other places, so we
> abstract away such low-level operations via a macro.
> ---
This is wrong! You have to use *existing* --- line below. Otherwise
all mail parsers will cut this out including your SoB tag.
>
> v9:
> * Split the pm changes from the thinkpad_acpi patch
> into its own patch
>
> v10:
> * No changes in this patch in v10
>
> Signed-off-by: Ognjen Galic <smclt30p(a)gmail.com>
Missed:
Suggested-by: Andy Shevchenko <andriy.shevchenko(a)linux.intel.com>
> ---
> drivers/power/supply/power_supply_core.c | 2 +-
> include/linux/power_supply.h | 2 ++
> 2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
> index 82f998a..feac7b0 100644
> --- a/drivers/power/supply/power_supply_core.c
> +++ b/drivers/power/supply/power_supply_core.c
> @@ -668,7 +668,7 @@ EXPORT_SYMBOL_GPL(power_supply_powers);
>
> static void power_supply_dev_release(struct device *dev)
> {
> - struct power_supply *psy = container_of(dev, struct power_supply, dev);
> + struct power_supply *psy = to_power_supply(dev);
> dev_dbg(dev, "%s\n", __func__);
> kfree(psy);
> }
> diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
> index 79e90b3..f0139b4 100644
> --- a/include/linux/power_supply.h
> +++ b/include/linux/power_supply.h
> @@ -371,6 +371,8 @@ devm_power_supply_register_no_ws(struct device *parent,
> extern void power_supply_unregister(struct power_supply *psy);
> extern int power_supply_powers(struct power_supply *psy, struct device *dev);
>
> +#define to_power_supply(device) container_of(device, struct power_supply, dev)
> +
> extern void *power_supply_get_drvdata(struct power_supply *psy);
> /* For APM emulation, think legacy userspace. */
> extern struct class *power_supply_class;
Should fold in the changes you sent as a separate patch.
--
With Best Regards,
Andy Shevchenko
4 years, 7 months
Re: [Devel] [PATCH] pm: Fix build issues in ds278* (thinkpad_acpi)
by kbuild test robot
Hi Ognjen,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on battery/master]
[also build test ERROR on v4.15-rc5 next-20171222]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Ognjen-Galic/pm-Fix-build-issues...
base: git://git.infradead.org/battery-2.6.git master
config: i386-randconfig-s1-201752 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
drivers/power/supply/ds2781_battery.c: In function 'ds2781_get_pmod_enabled':
>> drivers/power/supply/ds2781_battery.c:455:29: error: implicit declaration of function 'to_power_supply' [-Werror=implicit-function-declaration]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power/supply/ds2781_battery.c:455:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
drivers/power/supply/ds2781_battery.c: In function 'ds2781_set_pmod_enabled':
drivers/power/supply/ds2781_battery.c:474:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power/supply/ds2781_battery.c: In function 'ds2781_get_sense_resistor_value':
drivers/power/supply/ds2781_battery.c:509:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power/supply/ds2781_battery.c: In function 'ds2781_set_sense_resistor_value':
drivers/power/supply/ds2781_battery.c:527:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power/supply/ds2781_battery.c: In function 'ds2781_get_rsgain_setting':
drivers/power/supply/ds2781_battery.c:547:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power/supply/ds2781_battery.c: In function 'ds2781_set_rsgain_setting':
drivers/power/supply/ds2781_battery.c:564:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power/supply/ds2781_battery.c: In function 'ds2781_get_pio_pin':
drivers/power/supply/ds2781_battery.c:590:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power/supply/ds2781_battery.c: In function 'ds2781_set_pio_pin':
drivers/power/supply/ds2781_battery.c:608:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power/supply/ds2781_battery.c: In function 'ds2781_read_param_eeprom_bin':
drivers/power/supply/ds2781_battery.c:634:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power/supply/ds2781_battery.c: In function 'ds2781_write_param_eeprom_bin':
drivers/power/supply/ds2781_battery.c:647:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power/supply/ds2781_battery.c: In function 'ds2781_read_user_eeprom_bin':
drivers/power/supply/ds2781_battery.c:679:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power/supply/ds2781_battery.c: In function 'ds2781_write_user_eeprom_bin':
drivers/power/supply/ds2781_battery.c:693:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/to_power_supply +455 drivers/power/supply/ds2781_battery.c
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29 448
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29 449 static ssize_t ds2781_get_pmod_enabled(struct device *dev,
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29 450 struct device_attribute *attr,
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29 451 char *buf)
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29 452 {
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29 453 int ret;
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29 454 u8 control_reg;
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29 @455 struct power_supply *psy = to_power_supply(dev);
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29 456 struct ds2781_device_info *dev_info = to_ds2781_device_info(psy);
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29 457
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29 458 /* Get power mode */
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29 459 ret = ds2781_get_control_register(dev_info, &control_reg);
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29 460 if (ret < 0)
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29 461 return ret;
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29 462
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29 463 return sprintf(buf, "%d\n",
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29 464 !!(control_reg & DS2781_CONTROL_PMOD));
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29 465 }
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29 466
:::::: The code at line 455 was first introduced by commit
:::::: fef37e9a47b9927ce2817fe1a0fa8cf40f6eefb6 DS2781 Maxim Stand-Alone Fuel Gauge battery and w1 slave drivers
:::::: TO: Renata Sayakhova <rsayakhova(a)gmail.com>
:::::: CC: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
4 years, 7 months
Re: [Devel] [PATCH] pm: Fix build issues in ds278* (thinkpad_acpi)
by kbuild test robot
Hi Ognjen,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on battery/master]
[also build test ERROR on v4.15-rc5 next-20171222]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Ognjen-Galic/pm-Fix-build-issues...
base: git://git.infradead.org/battery-2.6.git master
config: i386-randconfig-x007-201752 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All error/warnings (new ones prefixed by >>):
drivers/power//supply/ds2780_battery.c: In function 'ds2780_get_pmod_enabled':
>> drivers/power//supply/ds2780_battery.c:453:29: error: implicit declaration of function 'to_power_supply'; did you mean 'power_supply_put'? [-Werror=implicit-function-declaration]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
power_supply_put
>> drivers/power//supply/ds2780_battery.c:453:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
drivers/power//supply/ds2780_battery.c: In function 'ds2780_set_pmod_enabled':
drivers/power//supply/ds2780_battery.c:472:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power//supply/ds2780_battery.c: In function 'ds2780_get_sense_resistor_value':
drivers/power//supply/ds2780_battery.c:507:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power//supply/ds2780_battery.c: In function 'ds2780_set_sense_resistor_value':
drivers/power//supply/ds2780_battery.c:525:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power//supply/ds2780_battery.c: In function 'ds2780_get_rsgain_setting':
drivers/power//supply/ds2780_battery.c:545:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power//supply/ds2780_battery.c: In function 'ds2780_set_rsgain_setting':
drivers/power//supply/ds2780_battery.c:562:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power//supply/ds2780_battery.c: In function 'ds2780_get_pio_pin':
drivers/power//supply/ds2780_battery.c:588:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power//supply/ds2780_battery.c: In function 'ds2780_set_pio_pin':
drivers/power//supply/ds2780_battery.c:606:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power//supply/ds2780_battery.c: In function 'ds2780_read_param_eeprom_bin':
drivers/power//supply/ds2780_battery.c:632:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power//supply/ds2780_battery.c: In function 'ds2780_write_param_eeprom_bin':
drivers/power//supply/ds2780_battery.c:645:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power//supply/ds2780_battery.c: In function 'ds2780_read_user_eeprom_bin':
drivers/power//supply/ds2780_battery.c:677:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power//supply/ds2780_battery.c: In function 'ds2780_write_user_eeprom_bin':
drivers/power//supply/ds2780_battery.c:690:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
drivers/power//supply/ds2781_battery.c: In function 'ds2781_get_pmod_enabled':
>> drivers/power//supply/ds2781_battery.c:455:29: error: implicit declaration of function 'to_power_supply'; did you mean 'power_supply_put'? [-Werror=implicit-function-declaration]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
power_supply_put
>> drivers/power//supply/ds2781_battery.c:455:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
drivers/power//supply/ds2781_battery.c: In function 'ds2781_set_pmod_enabled':
drivers/power//supply/ds2781_battery.c:474:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power//supply/ds2781_battery.c: In function 'ds2781_get_sense_resistor_value':
drivers/power//supply/ds2781_battery.c:509:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power//supply/ds2781_battery.c: In function 'ds2781_set_sense_resistor_value':
drivers/power//supply/ds2781_battery.c:527:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power//supply/ds2781_battery.c: In function 'ds2781_get_rsgain_setting':
drivers/power//supply/ds2781_battery.c:547:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power//supply/ds2781_battery.c: In function 'ds2781_set_rsgain_setting':
drivers/power//supply/ds2781_battery.c:564:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power//supply/ds2781_battery.c: In function 'ds2781_get_pio_pin':
drivers/power//supply/ds2781_battery.c:590:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power//supply/ds2781_battery.c: In function 'ds2781_set_pio_pin':
drivers/power//supply/ds2781_battery.c:608:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power//supply/ds2781_battery.c: In function 'ds2781_read_param_eeprom_bin':
drivers/power//supply/ds2781_battery.c:634:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power//supply/ds2781_battery.c: In function 'ds2781_write_param_eeprom_bin':
drivers/power//supply/ds2781_battery.c:647:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power//supply/ds2781_battery.c: In function 'ds2781_read_user_eeprom_bin':
drivers/power//supply/ds2781_battery.c:679:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
drivers/power//supply/ds2781_battery.c: In function 'ds2781_write_user_eeprom_bin':
drivers/power//supply/ds2781_battery.c:693:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct power_supply *psy = to_power_supply(dev);
^~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +453 drivers/power//supply/ds2780_battery.c
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26 446
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26 447 static ssize_t ds2780_get_pmod_enabled(struct device *dev,
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26 448 struct device_attribute *attr,
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26 449 char *buf)
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26 450 {
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26 451 int ret;
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26 452 u8 control_reg;
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26 @453 struct power_supply *psy = to_power_supply(dev);
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26 454 struct ds2780_device_info *dev_info = to_ds2780_device_info(psy);
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26 455
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26 456 /* Get power mode */
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26 457 ret = ds2780_get_control_register(dev_info, &control_reg);
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26 458 if (ret < 0)
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26 459 return ret;
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26 460
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26 461 return sprintf(buf, "%d\n",
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26 462 !!(control_reg & DS2780_CONTROL_REG_PMOD));
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26 463 }
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26 464
:::::: The code at line 453 was first introduced by commit
:::::: 275ac74629c4d8ec430d7edecb16d936f46a47c5 w1: add Maxim/Dallas DS2780 Stand-Alone Fuel Gauge IC support
:::::: TO: Clifton Barnes <cabarnes(a)indesign-llc.com>
:::::: CC: Linus Torvalds <torvalds(a)linux-foundation.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
4 years, 7 months
Re: [Devel] [PATCH 2/3 v7] thinkpad_acpi: Add support for battery thresholds
by kbuild test robot
Hi Ognjen,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on platform-drivers-x86/for-next]
[also build test ERROR on v4.15-rc4 next-20171222]
[cannot apply to pm/linux-next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Ognjen-Galic/battery-Add-the-bat...
base: git://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git for-next
config: x86_64-acpi-redef (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
In file included from include/linux/list.h:9:0,
from include/linux/module.h:9,
from drivers/power/supply/ds2780_battery.c:16:
>> include/linux/kernel.h:928:42: error: expected identifier or '(' before '{' token
#define container_of(ptr, type, member) ({ \
^
include/linux/power_supply.h:374:33: note: in expansion of macro 'container_of'
#define to_power_supply(device) container_of(device, struct power_supply, dev)
^~~~~~~~~~~~
drivers/power/supply/ds2780_battery.c:59:36: note: in expansion of macro 'to_power_supply'
static inline struct power_supply *to_power_supply(struct device *dev)
^~~~~~~~~~~~~~~
--
In file included from include/linux/list.h:9:0,
from include/linux/module.h:9,
from drivers/power/supply/ds2781_battery.c:14:
>> include/linux/kernel.h:928:42: error: expected identifier or '(' before '{' token
#define container_of(ptr, type, member) ({ \
^
include/linux/power_supply.h:374:33: note: in expansion of macro 'container_of'
#define to_power_supply(device) container_of(device, struct power_supply, dev)
^~~~~~~~~~~~
drivers/power/supply/ds2781_battery.c:57:36: note: in expansion of macro 'to_power_supply'
static inline struct power_supply *to_power_supply(struct device *dev)
^~~~~~~~~~~~~~~
--
In file included from include/linux/list.h:9:0,
from include/linux/module.h:9,
from drivers/power//supply/ds2780_battery.c:16:
>> include/linux/kernel.h:928:42: error: expected identifier or '(' before '{' token
#define container_of(ptr, type, member) ({ \
^
include/linux/power_supply.h:374:33: note: in expansion of macro 'container_of'
#define to_power_supply(device) container_of(device, struct power_supply, dev)
^~~~~~~~~~~~
drivers/power//supply/ds2780_battery.c:59:36: note: in expansion of macro 'to_power_supply'
static inline struct power_supply *to_power_supply(struct device *dev)
^~~~~~~~~~~~~~~
--
In file included from include/linux/list.h:9:0,
from include/linux/module.h:9,
from drivers/power//supply/ds2781_battery.c:14:
>> include/linux/kernel.h:928:42: error: expected identifier or '(' before '{' token
#define container_of(ptr, type, member) ({ \
^
include/linux/power_supply.h:374:33: note: in expansion of macro 'container_of'
#define to_power_supply(device) container_of(device, struct power_supply, dev)
^~~~~~~~~~~~
drivers/power//supply/ds2781_battery.c:57:36: note: in expansion of macro 'to_power_supply'
static inline struct power_supply *to_power_supply(struct device *dev)
^~~~~~~~~~~~~~~
vim +928 include/linux/kernel.h
^1da177e4 Linus Torvalds 2005-04-16 911
91f68b735 Wu Fengguang 2009-01-07 912
e8c97af0c Randy Dunlap 2017-10-13 913 /**
e8c97af0c Randy Dunlap 2017-10-13 914 * swap - swap values of @a and @b
e8c97af0c Randy Dunlap 2017-10-13 915 * @a: first value
e8c97af0c Randy Dunlap 2017-10-13 916 * @b: second value
91f68b735 Wu Fengguang 2009-01-07 917 */
ac7b90049 Peter Zijlstra 2009-02-04 918 #define swap(a, b) \
ac7b90049 Peter Zijlstra 2009-02-04 919 do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
91f68b735 Wu Fengguang 2009-01-07 920
^1da177e4 Linus Torvalds 2005-04-16 921 /**
^1da177e4 Linus Torvalds 2005-04-16 922 * container_of - cast a member of a structure out to the containing structure
^1da177e4 Linus Torvalds 2005-04-16 923 * @ptr: the pointer to the member.
^1da177e4 Linus Torvalds 2005-04-16 924 * @type: the type of the container struct this is embedded in.
^1da177e4 Linus Torvalds 2005-04-16 925 * @member: the name of the member within the struct.
^1da177e4 Linus Torvalds 2005-04-16 926 *
^1da177e4 Linus Torvalds 2005-04-16 927 */
^1da177e4 Linus Torvalds 2005-04-16 @928 #define container_of(ptr, type, member) ({ \
c7acec713 Ian Abbott 2017-07-12 929 void *__mptr = (void *)(ptr); \
c7acec713 Ian Abbott 2017-07-12 930 BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
c7acec713 Ian Abbott 2017-07-12 931 !__same_type(*(ptr), void), \
c7acec713 Ian Abbott 2017-07-12 932 "pointer type mismatch in container_of()"); \
c7acec713 Ian Abbott 2017-07-12 933 ((type *)(__mptr - offsetof(type, member))); })
^1da177e4 Linus Torvalds 2005-04-16 934
:::::: The code at line 928 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds <torvalds(a)ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds(a)ppc970.osdl.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
4 years, 7 months
Re: [Devel] [PATCH v10 1/4] battery: Add the battery hooking API
by Rafael J. Wysocki
On Sat, Dec 23, 2017 at 11:52 AM, Ognjen Galic <smclt30p(a)gmail.com> wrote:
> This is a patch that implements a generic hooking API for the
> generic ACPI battery driver.
>
> With this new generic API, drivers can expose platform specific
> behaviour via sysfs attributes in /sys/class/power_supply/BATn/
> in a generic way.
>
> A perfect example of the need for this API are Lenovo ThinkPads.
>
> Lenovo ThinkPads have a ACPI extension that allows the setting of
> start and stop charge thresholds in the EC and battery firmware
> via ACPI. The thinkpad_acpi module can use this API to expose
> sysfs attributes that it controls inside the ACPI battery driver
> sysfs tree, under /sys/class/power_supply/BATN/.
>
> The file drivers/acpi/battery.h has been moved to
> include/acpi/battery.h and the includes inside ac.c, sbs.c, and
> battery.c have been adjusted to reflect that.
>
> When drivers hooks into the API, the API calls add_battery() for
> each battery in the system that passes it a acpi_battery
> struct. Then, the drivers can use device_create_file() to create
> new sysfs attributes with that struct and identify the batteries
> for per-battery attributes.
> ---
> v7:
> * Implemented mutual exclusion for hooking methods and battery
> callbacks
> * Fixed a BUG where errors in other modules would occur when the
> modules that depend on battery get unloaded
>
> v8:
> * Use list_for_each_safe instead of list_for_each for the module
> exit function where deletion of nodes occurs
>
> v9:
> * No changes in this patch in v9
>
> v10:
> * Fix compiler warnings in Intel's 0-day CI
You're sending new revisions too fast for me to review them. :-/
Please stop doing this for a while until you get a response from me for the v10.
Thanks,
Rafael
4 years, 7 months
[RFC PATCH] battery: hook_mutex can be static
by kbuild test robot
Fixes: 19380b8e214c ("battery: Add the battery hooking API")
Signed-off-by: Fengguang Wu <fengguang.wu(a)intel.com>
---
battery.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 1794408..9324591 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -640,9 +640,9 @@ static const struct device_attribute alarm_attr = {
LIST_HEAD(acpi_battery_list);
LIST_HEAD(battery_hook_list);
-DEFINE_MUTEX(hook_mutex);
+static DEFINE_MUTEX(hook_mutex);
-void __battery_hook_unregister(struct acpi_battery_hook *hook, int force)
+static void __battery_hook_unregister(struct acpi_battery_hook *hook, int force)
{
struct list_head *position;
struct acpi_battery *battery;
4 years, 7 months
Re: [Devel] [PATCH 1/3 v7] battery: Add the battery hooking API
by kbuild test robot
Hi Ognjen,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on platform-drivers-x86/for-next]
[also build test WARNING on v4.15-rc4 next-20171222]
[cannot apply to pm/linux-next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Ognjen-Galic/battery-Add-the-bat...
base: git://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git for-next
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
drivers/acpi/battery.c: In function 'acpi_battery_exit':
>> drivers/acpi/battery.c:1532:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if (battery_driver_registered)
^~
drivers/acpi/battery.c:1534:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
battery_hook_exit();
^~~~~~~~~~~~~~~~~
vim +/if +1532 drivers/acpi/battery.c
^1da177e Linus Torvalds 2005-04-16 1528
4be44fcd Len Brown 2005-08-05 1529 static void __exit acpi_battery_exit(void)
^1da177e Linus Torvalds 2005-04-16 1530 {
5dfa0c73 Chris Wilson 2016-05-19 1531 async_synchronize_cookie(async_cookie + 1);
bc39fbcf Hans de Goede 2017-04-19 @1532 if (battery_driver_registered)
^1da177e Linus Torvalds 2005-04-16 1533 acpi_bus_unregister_driver(&acpi_battery_driver);
19380b8e Ognjen Galic 2017-12-20 1534 battery_hook_exit();
3a670cc7 Lan Tianyu 2014-05-04 1535 #ifdef CONFIG_ACPI_PROCFS_POWER
bc39fbcf Hans de Goede 2017-04-19 1536 if (acpi_battery_dir)
3a670cc7 Lan Tianyu 2014-05-04 1537 acpi_unlock_battery_dir(acpi_battery_dir);
3a670cc7 Lan Tianyu 2014-05-04 1538 #endif
^1da177e Linus Torvalds 2005-04-16 1539 }
^1da177e Linus Torvalds 2005-04-16 1540
:::::: The code at line 1532 was first introduced by commit
:::::: bc39fbcf9c782970263bdc5b428e4a755db16efb ACPI / battery: Fix acpi_battery_exit on acpi_battery_init_async errors
:::::: TO: Hans de Goede <hdegoede(a)redhat.com>
:::::: CC: Rafael J. Wysocki <rafael.j.wysocki(a)intel.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
4 years, 7 months