-
Notifications
You must be signed in to change notification settings - Fork 92
[Deepin-Kernel-SIG] [linux 6.6-y] [Sunway] 6.6: update patches for sw64 architecture #919
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Deepin-Kernel-SIG] [linux 6.6-y] [Sunway] 6.6: update patches for sw64 architecture #919
Conversation
Change "void notrace *" to "void * notrace" to make the syntax more standardized. Signed-off-by: Gao Chen <[email protected]> Reviewed-by: He Sheng <[email protected]> Signed-off-by: Gu Zitao <[email protected]>
There are some registers for configuring PCIe controller in the devmn module on Sunway platform. Signed-off-by: Jing Li <[email protected]> Reviewed-by: He Sheng <[email protected]> Signed-off-by: Gu Zitao <[email protected]>
Signed-off-by: Jing Li <[email protected]> Reviewed-by: He Sheng <[email protected]> Signed-off-by: Gu Zitao <[email protected]>
If a task executes syscall(-1), we intercept this early and force r0 to be -ENOSYS so that we don't need to distinguish this scenario from one where the nr is -1 because a tracer wants to skip the system call using ptrace. With the return value set, the return path is the same as the skip case. Signed-off-by: Gu Zitao <[email protected]> Reviewed-by: He Sheng <[email protected]>
Remove the unnecessary reset of zx200's dma mask to DMA_BIT_MASK(32). Signed-off-by: Zheng Chongzhen <[email protected]> Reviewed-by: He Sheng <[email protected]> Signed-off-by: Gu Zitao <[email protected]>
This patch extends commit fcbfe81("Kconfig: introduce HAS_IOPORT option and select it as necessary") to sw64. Signed-off-by: Zheng Chongzhen <[email protected]> Reviewed-by: He Sheng <[email protected]> Signed-off-by: Gu Zitao <[email protected]>
This patch: - Register callback for monitoring guest info to enable perf kvm correctly. - For core4, we determine the running mode of the vcpu through the CPU mode bit of the PC rather than PS. Signed-off-by: Min Fanlei <[email protected]> Reviewed-by: He Sheng <[email protected]> Signed-off-by: Gu Zitao <[email protected]>
RC and PIU components are not used in VM or emulator, so we add judgment to skip the I/O access of RC and PIU components. Signed-off-by: Yu Jiayi <[email protected]> Reviewed-by: He Sheng <[email protected]> Signed-off-by: Gu Zitao <[email protected]>
As it is not normally available on x86_64 not being tested on test-all.c but being in FEATURE_TESTS_BASIC ends up implying that those features are present, which leads to trying to link with those libraries and a build failure now that test-all.c is finally again building successfully: /usr/bin/ld: cannot find -lunwind-sw_64 collect2: error: ld returned 1 exit status So remove those features from there and explicitely test them. Signed-off-by: He Chuyue <[email protected]> Reviewed-by: He Sheng <[email protected]> Signed-off-by: Gu Zitao <[email protected]>
Reviewer's GuideThis PR refines SW64 Linux 6.6 support by updating PCI host controller logic with guest/emulation gating and devmn_base mapping, adjusting notrace attributes in string routines, fixing NO_SYSCALL return handling, enhancing KVM/perf callbacks, adding ACPI compatibility macros, and revising libunwind-sw64 build features. Class diagram for updated pci_controller structure (devmn_base addition)classDiagram
class pci_controller {
unsigned long sparse_mem_base
unsigned long dense_mem_base
unsigned long sparse_io_base
unsigned long dense_io_base
void __iomem *ep_config_space_base
void __iomem *rc_config_space_base
void __iomem *piu_ior0_base
void __iomem *piu_ior1_base
void __iomem *devmn_base
unsigned long index
unsigned long node
...
}
Class diagram for string function signatures with notrace adjustmentclassDiagram
class string {
+void * notrace memcpy(void *dest, const void *src, size_t n)
+void * notrace __memcpy(void *dest, const void *src, size_t n)
+void * notrace __constant_c_memset(void *s, unsigned long c, size_t n)
+void * notrace ___memset(void *s, int c, size_t n)
+void * notrace __memset(void *s, int c, size_t n)
+void * notrace memset(void *s, int c, size_t n)
+void * notrace __memsetw(void *dest, unsigned short c, size_t count)
}
Class diagram for ACPI compatibility macro additionclassDiagram
class acpi {
+int acpi_strict
+int acpi_disabled
+int acpi_pci_disabled
+#define acpi_disable_cmcff 1
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review代码审查意见:
以上是针对代码审查意见的总结,具体的代码审查意见需要根据代码的具体实现和上下文来给出。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Avenger-285714 - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `drivers/pci/controller/pci-sunway.c:843` </location>
<code_context>
/* Get necessary properties of Root Complex */
for (i = 0; i < PROP_NUM; ++i) {
+ if ((i == PROP_DEVMN_BASE) && !is_junzhang_v3())
+ break;
+
ret = fwnode_property_read_u64(fwnode, prop_names[i],
</code_context>
<issue_to_address>
Breaking out of property loop early may skip required properties.
Using 'break' here will prevent processing any properties after PROP_DEVMN_BASE for non-junzhang_v3 platforms, which could cause issues if more properties are added later. Use 'continue' to skip only the current property.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
if ((i == PROP_DEVMN_BASE) && !is_junzhang_v3())
break;
=======
if ((i == PROP_DEVMN_BASE) && !is_junzhang_v3())
continue;
>>>>>>> REPLACE
</suggested_fix>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
if ((i == PROP_DEVMN_BASE) && !is_junzhang_v3()) | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (bug_risk): Breaking out of property loop early may skip required properties.
Using 'break' here will prevent processing any properties after PROP_DEVMN_BASE for non-junzhang_v3 platforms, which could cause issues if more properties are added later. Use 'continue' to skip only the current property.
if ((i == PROP_DEVMN_BASE) && !is_junzhang_v3()) | |
break; | |
if ((i == PROP_DEVMN_BASE) && !is_junzhang_v3()) | |
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the SW64 support in Linux 6.6 by refining function instrumentation, extending PCI host controller mappings, enhancing ACPI/KVM configuration, and fixing syscall(-1) handling.
- Introduce
PROP_DEVMN_BASE
and map the DEVMN region in the Sunway PCI host controller. - Adjust
notrace
placement for memcpy/memset variants in the SW64 string library. - Enable ACPI APEI and guest perf events, register perf callbacks, and correct ptrace syscall skipping.
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
tools/perf/Makefile.config | Add SW64 libunwind link flags and feature check |
tools/build/Makefile.feature | Move libunwind-sw_64 from basic to extra tests |
drivers/pci/controller/pci-sunway.c | Add PROP_DEVMN_BASE , conditional devmn_base mapping, guard allocs for guests |
drivers/irqchip/irq-sunway-pci-intx.c | Guard set_pcieport_service_irq behind !is_guest_or_emul() |
arch/sw_64/pci/pci.c | Remove zx200 DMA fixup, guard bus number init under non-guest |
arch/sw_64/lib/string.c | Reposition notrace attribute on memcpy/memset functions |
arch/sw_64/kvm/perf.c | Update kvm_arch_vcpu_in_kernel logic for CONFIG_SUBARCH_C3B |
arch/sw_64/kvm/kvm_core3.c, kvm_core4.c | Register perf callbacks before kvm_init |
arch/sw_64/kvm/Kconfig | Select GUEST_PERF_EVENTS when PERF_EVENTS |
arch/sw_64/kernel/sys_sw64.c | Fix syscall(-1) skip logic in ptrace path |
arch/sw_64/include/asm/pci.h | Define SUNWAY_DEVMN_SIZE and add devmn_base field |
arch/sw_64/include/asm/kvm_host.h | Add kvm_arch_pmi_in_guest inline helper |
arch/sw_64/include/asm/acpi.h | Define acpi_disable_cmcff for compatibility |
arch/sw_64/Kconfig | Select HAS_IOPORT and HAVE_ACPI_APEI when ACPI |
Comments suppressed due to low confidence (1)
arch/sw_64/include/asm/pci.h:86
- [nitpick] Add a brief comment describing what
SUNWAY_DEVMN_SIZE
represents (e.g., the size of the DEVMN MMIO region) to improve readability and future maintenance.
#define SUNWAY_DEVMN_SIZE 0x3480UL
@@ -838,6 +840,9 @@ static int pci_prepare_controller(struct pci_controller *hose, | |||
|
|||
/* Get necessary properties of Root Complex */ | |||
for (i = 0; i < PROP_NUM; ++i) { | |||
if ((i == PROP_DEVMN_BASE) && !is_junzhang_v3()) | |||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Using break
here exits the loop entirely when PROP_DEVMN_BASE
is hit; consider using continue
to skip only this index and preserve the loop for any future properties.
break; | |
continue; |
Copilot uses AI. Check for mistakes.
if (is_junzhang_v3()) | ||
hose->devmn_base = ioremap(props[PROP_DEVMN_BASE], SUNWAY_DEVMN_SIZE); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ioremap
may return NULL on failure; consider checking the returned pointer (or using IS_ERR
/PTR_ERR
) and handling errors to avoid potential null pointer dereferences.
if (is_junzhang_v3()) | |
hose->devmn_base = ioremap(props[PROP_DEVMN_BASE], SUNWAY_DEVMN_SIZE); | |
if (is_junzhang_v3()) { | |
hose->devmn_base = ioremap(props[PROP_DEVMN_BASE], SUNWAY_DEVMN_SIZE); | |
if (!hose->devmn_base) { | |
pr_err("Failed to map devmn_base at 0x%lx\n", props[PROP_DEVMN_BASE]); | |
return -ENOMEM; | |
} | |
} |
Copilot uses AI. Check for mistakes.
if (!is_guest_or_emul()) | ||
set_pcieport_service_irq(hose); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Wrap the single-line if
statement with braces for clarity and to comply with kernel coding style, e.g., if (!is_guest_or_emul()) { set_pcieport_service_irq(hose); }
.
if (!is_guest_or_emul()) | |
set_pcieport_service_irq(hose); | |
if (!is_guest_or_emul()) { | |
set_pcieport_service_irq(hose); | |
} |
Copilot uses AI. Check for mistakes.
*/ | ||
static inline bool kvm_arch_pmi_in_guest(struct kvm_vcpu *vcpu) | ||
{ | ||
return IS_ENABLED(CONFIG_GUEST_PERF_EVENTS) && !!vcpu; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Using !!vcpu
to test pointer non-null is concise but may be unclear; consider replacing it with vcpu != NULL
for better readability.
return IS_ENABLED(CONFIG_GUEST_PERF_EVENTS) && !!vcpu; | |
return IS_ENABLED(CONFIG_GUEST_PERF_EVENTS) && (vcpu != NULL); |
Copilot uses AI. Check for mistakes.
bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu) | ||
{ | ||
return (vcpu->arch.regs.ps & 8) != 0; | ||
if (IS_ENABLED(CONFIG_SUBARCH_C3B)) | ||
return (vcpu->arch.regs.ps & 0x8) == 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The magic mask 0x8
could be replaced with a named constant or documented to clarify which status bit is tested—and why the logic is inverted for CONFIG_SUBARCH_C3B
.
Copilot uses AI. Check for mistakes.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: opsiff The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
sw64: adjust the notrace in the code
sw64: pci: add base address of devmn
sw64: acpi: select HAVE_ACPI_APEI when ACPI is set
sw64: fix for executing syscall(-1)
sw64: pci: remove zx200 dma mask reset
...
Summary by Sourcery
Refine SW64 architecture support by adjusting PCI initialization and host bridge mappings, fixing syscall(-1) behavior under ptrace, cleaning up notrace annotations on string routines, enhancing KVM/perf integration, and updating build test inclusion.
New Features:
Bug Fixes:
Enhancements:
Build: