Re: [PATCH 04/83] drm/radeon: Add radeon <--> kfd interface
On 11/07/14 19:24, Jerome Glisse wrote: On Thu, Jul 10, 2014 at 03:38:33PM -0700, Joe Perches wrote: On Fri, 2014-07-11 at 00:50 +0300, Oded Gabbay wrote: This patch adds the interface between the radeon driver and the kfd driver. The interface implementation is contained in radeon_kfd.c and radeon_kfd.h. [] include/linux/radeon_kfd.h | 67 ++ Is there a good reason to put this file in include/linux? Agrees, we do not want to clutter include/linux/ with specific driver include, i think its one of the rules even thought there is some hw header already in there. I would rather see either a new dir include/hsa or inside include/drm. Cheers, Jérôme Moved to drm/radeon in v2 of the patchset Oded -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 04/83] drm/radeon: Add radeon -- kfd interface
On 11/07/14 19:24, Jerome Glisse wrote: On Thu, Jul 10, 2014 at 03:38:33PM -0700, Joe Perches wrote: On Fri, 2014-07-11 at 00:50 +0300, Oded Gabbay wrote: This patch adds the interface between the radeon driver and the kfd driver. The interface implementation is contained in radeon_kfd.c and radeon_kfd.h. [] include/linux/radeon_kfd.h | 67 ++ Is there a good reason to put this file in include/linux? Agrees, we do not want to clutter include/linux/ with specific driver include, i think its one of the rules even thought there is some hw header already in there. I would rather see either a new dir include/hsa or inside include/drm. Cheers, Jérôme Moved to drm/radeon in v2 of the patchset Oded -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 04/83] drm/radeon: Add radeon <--> kfd interface
On Thu, Jul 10, 2014 at 03:38:33PM -0700, Joe Perches wrote: > On Fri, 2014-07-11 at 00:50 +0300, Oded Gabbay wrote: > > This patch adds the interface between the radeon driver and the kfd > > driver. The interface implementation is contained in > > radeon_kfd.c and radeon_kfd.h. > [] > > include/linux/radeon_kfd.h | 67 ++ > > Is there a good reason to put this file in include/linux? > Agrees, we do not want to clutter include/linux/ with specific driver include, i think its one of the rules even thought there is some hw header already in there. I would rather see either a new dir include/hsa or inside include/drm. Cheers, Jérôme -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 04/83] drm/radeon: Add radeon -- kfd interface
On Thu, Jul 10, 2014 at 03:38:33PM -0700, Joe Perches wrote: On Fri, 2014-07-11 at 00:50 +0300, Oded Gabbay wrote: This patch adds the interface between the radeon driver and the kfd driver. The interface implementation is contained in radeon_kfd.c and radeon_kfd.h. [] include/linux/radeon_kfd.h | 67 ++ Is there a good reason to put this file in include/linux? Agrees, we do not want to clutter include/linux/ with specific driver include, i think its one of the rules even thought there is some hw header already in there. I would rather see either a new dir include/hsa or inside include/drm. Cheers, Jérôme -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 04/83] drm/radeon: Add radeon <--> kfd interface
On Fri, 2014-07-11 at 00:50 +0300, Oded Gabbay wrote: > This patch adds the interface between the radeon driver and the kfd > driver. The interface implementation is contained in > radeon_kfd.c and radeon_kfd.h. [] > include/linux/radeon_kfd.h | 67 ++ Is there a good reason to put this file in include/linux? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 04/83] drm/radeon: Add radeon <--> kfd interface
This patch adds the interface between the radeon driver and the kfd driver. The interface implementation is contained in radeon_kfd.c and radeon_kfd.h. The interface itself is represented by a pointer to struct kfd_dev. The pointer is located inside radeon_device structure. Signed-off-by: Oded Gabbay --- drivers/gpu/drm/radeon/Makefile | 1 + drivers/gpu/drm/radeon/radeon.h | 3 ++ drivers/gpu/drm/radeon/radeon_kfd.c | 94 + include/linux/radeon_kfd.h | 67 ++ 4 files changed, 165 insertions(+) create mode 100644 drivers/gpu/drm/radeon/radeon_kfd.c create mode 100644 include/linux/radeon_kfd.h diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile index 1b04002..a1c913d 100644 --- a/drivers/gpu/drm/radeon/Makefile +++ b/drivers/gpu/drm/radeon/Makefile @@ -104,6 +104,7 @@ radeon-y += \ radeon_vce.o \ vce_v1_0.o \ vce_v2_0.o \ + radeon_kfd.o radeon-$(CONFIG_COMPAT) += radeon_ioc32.o radeon-$(CONFIG_VGA_SWITCHEROO) += radeon_atpx_handler.o diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 4e7e41f..90f66bb 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -2340,6 +2340,9 @@ struct radeon_device { struct dev_pm_domain vga_pm_domain; bool have_disp_power_ref; + + /* HSA KFD interface */ + struct kfd_dev *kfd; }; bool radeon_is_px(struct drm_device *dev); diff --git a/drivers/gpu/drm/radeon/radeon_kfd.c b/drivers/gpu/drm/radeon/radeon_kfd.c new file mode 100644 index 000..7c7f808 --- /dev/null +++ b/drivers/gpu/drm/radeon/radeon_kfd.c @@ -0,0 +1,94 @@ +/* + * Copyright 2014 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include +#include "radeon.h" + +static const struct kfd2kgd_calls kfd2kgd = { +}; + +static const struct kgd2kfd_calls *kgd2kfd; + +bool radeon_kfd_init(void) +{ + bool (*kgd2kfd_init_p)(unsigned, const struct kfd2kgd_calls*, + const struct kgd2kfd_calls**); + + kgd2kfd_init_p = symbol_request(kgd2kfd_init); + + if (kgd2kfd_init_p == NULL) + return false; + + if (!kgd2kfd_init_p(KFD_INTERFACE_VERSION, , )) { + symbol_put(kgd2kfd_init); + kgd2kfd = NULL; + + return false; + } + + return true; +} + +void radeon_kfd_fini(void) +{ + if (kgd2kfd) { + kgd2kfd->exit(); + symbol_put(kgd2kfd_init); + } +} + +void radeon_kfd_device_probe(struct radeon_device *rdev) +{ + if (kgd2kfd) + rdev->kfd = kgd2kfd->probe((struct kgd_dev *)rdev, rdev->pdev); +} + +void radeon_kfd_device_init(struct radeon_device *rdev) +{ + if (rdev->kfd) { + struct kgd2kfd_shared_resources gpu_resources = { + .mmio_registers = rdev->rmmio, + + .compute_vmid_bitmap = 0xFF00, + + .first_compute_pipe = 1, + .compute_pipe_count = 8 - 1, + }; + + radeon_doorbell_get_kfd_info(rdev, + _resources.doorbell_physical_address, + _resources.doorbell_aperture_size, + _resources.doorbell_start_offset); + + kgd2kfd->device_init(rdev->kfd, _resources); + } +} + +void radeon_kfd_device_fini(struct radeon_device *rdev) +{ + if (rdev->kfd) { + kgd2kfd->device_exit(rdev->kfd); + rdev->kfd = NULL; + } +} diff --git a/include/linux/radeon_kfd.h b/include/linux/radeon_kfd.h new file mode 100644 index 000..59785e9 --- /dev/null +++ b/include/linux/radeon_kfd.h @@ -0,0 +1,67 @@ +/* + * Copyright 2014 Advanced Micro Devices, Inc. + * + * Permission
[PATCH 04/83] drm/radeon: Add radeon -- kfd interface
This patch adds the interface between the radeon driver and the kfd driver. The interface implementation is contained in radeon_kfd.c and radeon_kfd.h. The interface itself is represented by a pointer to struct kfd_dev. The pointer is located inside radeon_device structure. Signed-off-by: Oded Gabbay oded.gab...@amd.com --- drivers/gpu/drm/radeon/Makefile | 1 + drivers/gpu/drm/radeon/radeon.h | 3 ++ drivers/gpu/drm/radeon/radeon_kfd.c | 94 + include/linux/radeon_kfd.h | 67 ++ 4 files changed, 165 insertions(+) create mode 100644 drivers/gpu/drm/radeon/radeon_kfd.c create mode 100644 include/linux/radeon_kfd.h diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile index 1b04002..a1c913d 100644 --- a/drivers/gpu/drm/radeon/Makefile +++ b/drivers/gpu/drm/radeon/Makefile @@ -104,6 +104,7 @@ radeon-y += \ radeon_vce.o \ vce_v1_0.o \ vce_v2_0.o \ + radeon_kfd.o radeon-$(CONFIG_COMPAT) += radeon_ioc32.o radeon-$(CONFIG_VGA_SWITCHEROO) += radeon_atpx_handler.o diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 4e7e41f..90f66bb 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -2340,6 +2340,9 @@ struct radeon_device { struct dev_pm_domain vga_pm_domain; bool have_disp_power_ref; + + /* HSA KFD interface */ + struct kfd_dev *kfd; }; bool radeon_is_px(struct drm_device *dev); diff --git a/drivers/gpu/drm/radeon/radeon_kfd.c b/drivers/gpu/drm/radeon/radeon_kfd.c new file mode 100644 index 000..7c7f808 --- /dev/null +++ b/drivers/gpu/drm/radeon/radeon_kfd.c @@ -0,0 +1,94 @@ +/* + * Copyright 2014 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the Software), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include linux/module.h +#include linux/radeon_kfd.h +#include drm/drmP.h +#include radeon.h + +static const struct kfd2kgd_calls kfd2kgd = { +}; + +static const struct kgd2kfd_calls *kgd2kfd; + +bool radeon_kfd_init(void) +{ + bool (*kgd2kfd_init_p)(unsigned, const struct kfd2kgd_calls*, + const struct kgd2kfd_calls**); + + kgd2kfd_init_p = symbol_request(kgd2kfd_init); + + if (kgd2kfd_init_p == NULL) + return false; + + if (!kgd2kfd_init_p(KFD_INTERFACE_VERSION, kfd2kgd, kgd2kfd)) { + symbol_put(kgd2kfd_init); + kgd2kfd = NULL; + + return false; + } + + return true; +} + +void radeon_kfd_fini(void) +{ + if (kgd2kfd) { + kgd2kfd-exit(); + symbol_put(kgd2kfd_init); + } +} + +void radeon_kfd_device_probe(struct radeon_device *rdev) +{ + if (kgd2kfd) + rdev-kfd = kgd2kfd-probe((struct kgd_dev *)rdev, rdev-pdev); +} + +void radeon_kfd_device_init(struct radeon_device *rdev) +{ + if (rdev-kfd) { + struct kgd2kfd_shared_resources gpu_resources = { + .mmio_registers = rdev-rmmio, + + .compute_vmid_bitmap = 0xFF00, + + .first_compute_pipe = 1, + .compute_pipe_count = 8 - 1, + }; + + radeon_doorbell_get_kfd_info(rdev, + gpu_resources.doorbell_physical_address, + gpu_resources.doorbell_aperture_size, + gpu_resources.doorbell_start_offset); + + kgd2kfd-device_init(rdev-kfd, gpu_resources); + } +} + +void radeon_kfd_device_fini(struct radeon_device *rdev) +{ + if (rdev-kfd) { + kgd2kfd-device_exit(rdev-kfd); + rdev-kfd = NULL; + } +} diff --git a/include/linux/radeon_kfd.h b/include/linux/radeon_kfd.h new file mode 100644 index 000..59785e9 --- /dev/null +++ b/include/linux/radeon_kfd.h @@ -0,0 +1,67 @@
Re: [PATCH 04/83] drm/radeon: Add radeon -- kfd interface
On Fri, 2014-07-11 at 00:50 +0300, Oded Gabbay wrote: This patch adds the interface between the radeon driver and the kfd driver. The interface implementation is contained in radeon_kfd.c and radeon_kfd.h. [] include/linux/radeon_kfd.h | 67 ++ Is there a good reason to put this file in include/linux? -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/