Skip to content

vc_mem: Add the DMA memcpy support from bcm2708_fb - #5651

Merged
pelwell merged 1 commit into
raspberrypi:rpi-6.1.yfrom
pelwell:vcmem_dma
Oct 16, 2023
Merged

pelwell merged 1 commit into
raspberrypi:rpi-6.1.yfrom
pelwell:vcmem_dma

Conversation

@pelwell

@pelwell pelwell commented Oct 15, 2023

Copy link
Copy Markdown
Contributor

bcm2708_fb is disabled by the vc4-kms-v3d overlay, which means that the DMA memcpy support it provides is not available to allow vclog to read the VC logs from the top 16MB on Pi 3. Add the code to the vc_mem driver, which will still be available.

It ought to be possible to do a proper DMA_MEM_TO_MEM copy via the generic DMA customer API, but that can be a later step.

@pelwell

pelwell commented Oct 15, 2023

Copy link
Copy Markdown
Contributor Author

raspberrypi/utils#36 is the corresponding vclog change.

@pelwell

pelwell commented Oct 16, 2023

Copy link
Copy Markdown
Contributor Author

@timg236 Updated to bail out on everything but a BCM2710.

Comment thread drivers/char/broadcom/vc_mem.c Outdated
fwnode = of_find_node_by_path("/system");
rc = of_property_read_u32(fwnode, "linux,revision", &revision);
if (((revision >> 12) & 0xf) != 2) {
/* Only BCM2710 has a memory hole to work around */

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By hole, do you mean peripherals mapping low (below 1GB) .
Doesn't that include 2709 (pi2) and 2710 (pi3)?
Wasn't pi4 still mapping low by default?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right about 2709 - I was thinking Pi 2 was still 512MB, but that's not the case. Pi 4 is OK because the firmware puts the logs in the first 1GB while the peripherals are mapped just below 4GB, so they don't obstruct the host's view of the VPU's RAM usage.

I'll confirm that Pi 2 is affected, then add it to the conditional.

@pelwell
pelwell force-pushed the vcmem_dma branch 2 times, most recently from 334660d to f2d85ed Compare October 16, 2023 14:34
Comment thread drivers/char/broadcom/vc_mem.c Outdated
fwnode = of_find_node_by_path("/system");
rc = of_property_read_u32(fwnode, "linux,revision", &revision);
revision = (revision >> 12) & 0xf;
if (revision != 1 && revision != 12) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean 12 or 2?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed - more haste, less speed

bcm2708_fb is disabled by the vc4-kms-v3d overlay, which means that the
DMA memcpy support it provides is not available to allow vclog to read
the VC logs from the top 16MB on Pi 2 and Pi 3. Add the code to the
vc_mem driver, which will still be enabled.

It ought to be possible to do a proper DMA_MEM_TO_MEM copy via the
generic DMA customer API, but that can be a later step.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
@timg236

timg236 commented Oct 16, 2023

Copy link
Copy Markdown
Contributor

Looks good

@popcornmix

Copy link
Copy Markdown
Collaborator

Tested on Pi2 (32-bit), Pi3 (64-bit) and Pi4 (64-bit).
Checked with strace that it behaved as desired.

Would be nice to get this using a higher level dma api, but this is fine as fix for now.

@pelwell
pelwell merged commit 2a47ccf into raspberrypi:rpi-6.1.y Oct 16, 2023
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Oct 17, 2023
kernel: drivers: media: rp1_cfe: Fix link validate test for pixel format
See: raspberrypi/linux#5657

kernel: drm/vc4: Correct address offset for planes with src_[xy] offsets
See: raspberrypi/linux#5654

kernel: input: touchscreen: edt-ft5x06: Suppress bogus data on startup
See: raspberrypi/linux#5645

kernel: vc_mem: Add the DMA memcpy support from bcm2708_fb
See: raspberrypi/linux#5651

kernel: dts: bcm2712: Set default I2C baudrates to 100kHz
See: raspberrypi/linux#5653

kernel: MCP23017: allow specification of the i2c bus
See: raspberrypi/linux#5650

kernel: Revert: bcm2708_fb: Hack out dma support
See: raspberrypi/linux#5648

firmware: config: Add [pi5] to config.txt on 2711 and earlier platforms

userland: bcm_host: Update kms/fkms check for pi5
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Oct 17, 2023
kernel: drivers: media: rp1_cfe: Fix link validate test for pixel format
See: raspberrypi/linux#5657

kernel: drm/vc4: Correct address offset for planes with src_[xy] offsets
See: raspberrypi/linux#5654

kernel: input: touchscreen: edt-ft5x06: Suppress bogus data on startup
See: raspberrypi/linux#5645

kernel: vc_mem: Add the DMA memcpy support from bcm2708_fb
See: raspberrypi/linux#5651

kernel: dts: bcm2712: Set default I2C baudrates to 100kHz
See: raspberrypi/linux#5653

kernel: MCP23017: allow specification of the i2c bus
See: raspberrypi/linux#5650

kernel: Revert: bcm2708_fb: Hack out dma support
See: raspberrypi/linux#5648

firmware: config: Add [pi5] to config.txt on 2711 and earlier platforms

userland: bcm_host: Update kms/fkms check for pi5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants