Message ID | 20230204174758.234951-1-vsementsov@yandex-team.ru (mailing list archive) |
---|---|
Headers | show |
Series | pcie: cleanup code and add trace point | expand |
On 4/2/23 18:47, Vladimir Sementsov-Ogievskiy wrote: > We already have indicator values in > include/standard-headers/linux/pci_regs.h , no reason to reinvent them > in include/hw/pci/pcie_regs.h. (and we already have usage of > PCI_EXP_SLTCTL_PWR_IND_BLINK and PCI_EXP_SLTCTL_PWR_IND_OFF in > hw/pci/pcie.c, so let's be consistent) > > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> > --- > include/hw/pci/pcie_regs.h | 9 --------- > hw/pci/pcie.c | 13 +++++++------ > 2 files changed, 7 insertions(+), 15 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
On 4/2/23 18:47, Vladimir Sementsov-Ogievskiy wrote: > PCI_EXP_SLTCTL_PIC_OFF is a value, and PCI_EXP_SLTCTL_PIC is a mask. > Happily PCI_EXP_SLTCTL_PIC_OFF is a maximum value for this mask and is > equal to the mask itself. Still the code looks like a bug. Let's make > it more reader-friendly. > > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> > --- > hw/pci/pcie.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
On 4/2/23 18:47, Vladimir Sementsov-Ogievskiy wrote: > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> > --- > hw/pci/pcie.c | 20 ++++++++++++++++++++ > hw/pci/trace-events | 3 +++ > 2 files changed, 23 insertions(+) > +static const char *pcie_sltctl_pic_str(uint16_t sltctl) > +{ > + switch (sltctl & PCI_EXP_SLTCTL_PIC) { > + case PCI_EXP_SLTCTL_PWR_IND_ON: > + return "on"; > + case PCI_EXP_SLTCTL_PWR_IND_BLINK: > + return "blink"; > + case PCI_EXP_SLTCTL_PWR_IND_OFF: > + return "off"; > + default: > + return "?"; Maybe "illegal"? Otherwise: Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> > + } > +}
Thanks for reviewing! On 05.02.23 13:56, Philippe Mathieu-Daudé wrote: > On 4/2/23 18:47, Vladimir Sementsov-Ogievskiy wrote: >> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> >> --- >> hw/pci/pcie.c | 20 ++++++++++++++++++++ >> hw/pci/trace-events | 3 +++ >> 2 files changed, 23 insertions(+) > >> +static const char *pcie_sltctl_pic_str(uint16_t sltctl) >> +{ >> + switch (sltctl & PCI_EXP_SLTCTL_PIC) { >> + case PCI_EXP_SLTCTL_PWR_IND_ON: >> + return "on"; >> + case PCI_EXP_SLTCTL_PWR_IND_BLINK: >> + return "blink"; >> + case PCI_EXP_SLTCTL_PWR_IND_OFF: >> + return "off"; >> + default: >> + return "?"; > > Maybe "illegal"? I just was unsure about it. For SHPC, 0 is correct, and means that this command don't change the led state. But with PCI-e hotplug we don't have such commands but change the led directly, so it must be one of "on"/"blink"/"off", and zero is really wrong, right? Also, I'm now looking at /* TODO: send event to monitor */ in shpc code, and working on it. So, I think, I'll soon send patches with such event for both SHPC and PCI-e, and probably that trace point becomes not needed. > > Otherwise: > > Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> > >> + } >> +} >
On Tue, Feb 07, 2023 at 01:39:03PM +0300, Vladimir Sementsov-Ogievskiy wrote: > Thanks for reviewing! > > On 05.02.23 13:56, Philippe Mathieu-Daudé wrote: > > On 4/2/23 18:47, Vladimir Sementsov-Ogievskiy wrote: > > > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> > > > --- > > > hw/pci/pcie.c | 20 ++++++++++++++++++++ > > > hw/pci/trace-events | 3 +++ > > > 2 files changed, 23 insertions(+) > > > > > +static const char *pcie_sltctl_pic_str(uint16_t sltctl) > > > +{ > > > + switch (sltctl & PCI_EXP_SLTCTL_PIC) { > > > + case PCI_EXP_SLTCTL_PWR_IND_ON: > > > + return "on"; > > > + case PCI_EXP_SLTCTL_PWR_IND_BLINK: > > > + return "blink"; > > > + case PCI_EXP_SLTCTL_PWR_IND_OFF: > > > + return "off"; > > > + default: > > > + return "?"; > > > > Maybe "illegal"? > > I just was unsure about it. > > For SHPC, 0 is correct, and means that this command don't change the led state. > > But with PCI-e hotplug we don't have such commands but change the led directly, so it must be one of "on"/"blink"/"off", and zero is really wrong, right? > > > Also, I'm now looking at /* TODO: send event to monitor */ in shpc code, and working on it. So, I think, I'll soon send patches with such event for both SHPC and PCI-e, and probably that trace point becomes not needed. I think it's ok to queue as is, change it with a patch on top. > > > > Otherwise: > > > > Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> > > > > > + } > > > +} > > > > -- > Best regards, > Vladimir