diff mbox series

[1/2] habanalabs/uapi: move uapi file to drm

Message ID 20221226213227.26953-1-ogabbay@kernel.org (mailing list archive)
State New, archived
Headers show
Series [1/2] habanalabs/uapi: move uapi file to drm | expand

Commit Message

Oded Gabbay Dec. 26, 2022, 9:32 p.m. UTC
Move the habanalabs.h uapi file from include/uapi/misc to
include/uapi/drm, and rename it to habanalabs_accel.h.

This is required before moving the actual driver to the accel
subsystem.

Update MAINTAINERS file accordingly.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
---
 MAINTAINERS                                                | 2 +-
 drivers/misc/habanalabs/Kconfig                            | 2 +-
 drivers/misc/habanalabs/common/command_buffer.c            | 2 +-
 drivers/misc/habanalabs/common/command_submission.c        | 2 +-
 drivers/misc/habanalabs/common/device.c                    | 2 +-
 drivers/misc/habanalabs/common/habanalabs.h                | 2 +-
 drivers/misc/habanalabs/common/habanalabs_ioctl.c          | 2 +-
 drivers/misc/habanalabs/common/memory.c                    | 2 +-
 drivers/misc/habanalabs/common/state_dump.c                | 2 +-
 drivers/misc/habanalabs/gaudi/gaudiP.h                     | 2 +-
 drivers/misc/habanalabs/gaudi/gaudi_coresight.c            | 3 ++-
 drivers/misc/habanalabs/gaudi2/gaudi2P.h                   | 2 +-
 drivers/misc/habanalabs/gaudi2/gaudi2_coresight.c          | 2 +-
 drivers/misc/habanalabs/goya/goyaP.h                       | 2 +-
 drivers/misc/habanalabs/goya/goya_coresight.c              | 2 +-
 include/uapi/{misc/habanalabs.h => drm/habanalabs_accel.h} | 0
 16 files changed, 16 insertions(+), 15 deletions(-)
 rename include/uapi/{misc/habanalabs.h => drm/habanalabs_accel.h} (100%)

Comments

Greg Kroah-Hartman Dec. 27, 2022, 7:26 a.m. UTC | #1
On Mon, Dec 26, 2022 at 11:32:26PM +0200, Oded Gabbay wrote:
> Move the habanalabs.h uapi file from include/uapi/misc to
> include/uapi/drm, and rename it to habanalabs_accel.h.
> 
> This is required before moving the actual driver to the accel
> subsystem.

What requires this?  Isn't this going to break userspace code?

thanks,

greg k-h
Oded Gabbay Dec. 27, 2022, 12:04 p.m. UTC | #2
On Tue, Dec 27, 2022 at 9:26 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Mon, Dec 26, 2022 at 11:32:26PM +0200, Oded Gabbay wrote:
> > Move the habanalabs.h uapi file from include/uapi/misc to
> > include/uapi/drm, and rename it to habanalabs_accel.h.
> >
> > This is required before moving the actual driver to the accel
> > subsystem.
>
> What requires this?  Isn't this going to break userspace code?
Yes, most definitely it will break userspace code. Moreover, the
patches I'll send in 1-2 weeks to change the device char files will
also break it.
Having said that, I'm not worried because I don't believe anyone is
working with the upstream version because there is no NIC support
(yet).

If this is unacceptable, I can offer a couple of alternatives and we
can discuss what's best:

1. Do what AMD did a couple of years ago with radeon and amdgpu. We
keep the habanalabs original driver in misc to support Goya, Gaudi1
and Gaudi2 (only with the current features). Create a new habanalabs
driver in accel that will support only Gaudi2 and beyond. Our NIC
driver (which I will start upstreaming in a few months) anyway will
only support Gaudi2, so it will only work with the new driver. Make
the drivers mutually exclusive in Kconfig.
Gaudi2 as-is will be supported in the current driver, but if users
want to use new features (and NIC), they will need to move to the new
driver.

2. Move the driver to the new accel, but keep a copy of the uapi file
in misc (to prevent breaking include paths). In addition, expose both
new accel device char file (through drm code) and current habanalabs
char file. Users can "acquire" the device through either
/dev/accel/accel0 or /dev/hl0. Add new uapi content only to the uapi
file in include/uapi/drm. This is what I'm going to do in our internal
tree that we release as an out-of-tree driver to customers.

3. Keep the driver in misc. Clone it to accel only for next-gen ASIC,
whenever that may be.

WDYT ?
I'm sure there are additional variations of the three options above,
or a different option entirely.

Thanks,
Oded

>
> thanks,
>
> greg k-h
Greg Kroah-Hartman Dec. 27, 2022, 1:46 p.m. UTC | #3
On Tue, Dec 27, 2022 at 02:04:14PM +0200, Oded Gabbay wrote:
> On Tue, Dec 27, 2022 at 9:26 AM Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > On Mon, Dec 26, 2022 at 11:32:26PM +0200, Oded Gabbay wrote:
> > > Move the habanalabs.h uapi file from include/uapi/misc to
> > > include/uapi/drm, and rename it to habanalabs_accel.h.
> > >
> > > This is required before moving the actual driver to the accel
> > > subsystem.
> >
> > What requires this?  Isn't this going to break userspace code?
> Yes, most definitely it will break userspace code. Moreover, the
> patches I'll send in 1-2 weeks to change the device char files will
> also break it.
> Having said that, I'm not worried because I don't believe anyone is
> working with the upstream version because there is no NIC support
> (yet).

Ok, if you are sure that no one will complain about broken builds,
that's fine to move, but be aware that if they do complain, you'll have
to back these changes out.

thanks,

greg k-h
Oded Gabbay Dec. 27, 2022, 1:54 p.m. UTC | #4
On Tue, Dec 27, 2022 at 3:46 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Tue, Dec 27, 2022 at 02:04:14PM +0200, Oded Gabbay wrote:
> > On Tue, Dec 27, 2022 at 9:26 AM Greg KH <gregkh@linuxfoundation.org> wrote:
> > >
> > > On Mon, Dec 26, 2022 at 11:32:26PM +0200, Oded Gabbay wrote:
> > > > Move the habanalabs.h uapi file from include/uapi/misc to
> > > > include/uapi/drm, and rename it to habanalabs_accel.h.
> > > >
> > > > This is required before moving the actual driver to the accel
> > > > subsystem.
> > >
> > > What requires this?  Isn't this going to break userspace code?
> > Yes, most definitely it will break userspace code. Moreover, the
> > patches I'll send in 1-2 weeks to change the device char files will
> > also break it.
> > Having said that, I'm not worried because I don't believe anyone is
> > working with the upstream version because there is no NIC support
> > (yet).
>
> Ok, if you are sure that no one will complain about broken builds,
> that's fine to move, but be aware that if they do complain, you'll have
> to back these changes out.
Of course, I completely understand that.
Thanks,
Oded
>
> thanks,
>
> greg k-h
Jeffrey Hugo Dec. 27, 2022, 6:29 p.m. UTC | #5
On 12/26/2022 2:32 PM, Oded Gabbay wrote:
> Move the habanalabs.h uapi file from include/uapi/misc to
> include/uapi/drm, and rename it to habanalabs_accel.h.
> 
> This is required before moving the actual driver to the accel
> subsystem.
> 
> Update MAINTAINERS file accordingly.
> 
> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>

This would impact the hl-thunk project at 
https://github.com/HabanaAI/hl-thunk as the open userspace, right?  I 
don't appear to see corresponding changes there.  Is there a dev branch 
I'm missing?

-Jeff
Oded Gabbay Dec. 29, 2022, 12:27 p.m. UTC | #6
On Tue, Dec 27, 2022 at 8:29 PM Jeffrey Hugo <quic_jhugo@quicinc.com> wrote:
>
> On 12/26/2022 2:32 PM, Oded Gabbay wrote:
> > Move the habanalabs.h uapi file from include/uapi/misc to
> > include/uapi/drm, and rename it to habanalabs_accel.h.
> >
> > This is required before moving the actual driver to the accel
> > subsystem.
> >
> > Update MAINTAINERS file accordingly.
> >
> > Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
>
> This would impact the hl-thunk project at
> https://github.com/HabanaAI/hl-thunk as the open userspace, right?  I
> don't appear to see corresponding changes there.  Is there a dev branch
> I'm missing?
I will change it in a few weeks. The driver changes are only inside my
branch, I have time until the next merge cycle.
Oded
>
> -Jeff
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index f61eb221415b..ce47d05693d9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9049,7 +9049,7 @@  F:	Documentation/ABI/testing/debugfs-driver-habanalabs
 F:	Documentation/ABI/testing/sysfs-driver-habanalabs
 F:	drivers/misc/habanalabs/
 F:	include/trace/events/habanalabs.h
-F:	include/uapi/misc/habanalabs.h
+F:	include/uapi/drm/habanalabs_accel.h
 
 HACKRF MEDIA DRIVER
 M:	Antti Palosaari <crope@iki.fi>
diff --git a/drivers/misc/habanalabs/Kconfig b/drivers/misc/habanalabs/Kconfig
index bd01d0d940c0..585235531b9b 100644
--- a/drivers/misc/habanalabs/Kconfig
+++ b/drivers/misc/habanalabs/Kconfig
@@ -19,7 +19,7 @@  config HABANA_AI
 	  the user to submit workloads to the devices.
 
 	  The user-space interface is described in
-	  include/uapi/misc/habanalabs.h
+	  include/uapi/drm/habanalabs_accel.h
 
 	  If unsure, say N.
 
diff --git a/drivers/misc/habanalabs/common/command_buffer.c b/drivers/misc/habanalabs/common/command_buffer.c
index 24100501f8ca..6263d01cb9c1 100644
--- a/drivers/misc/habanalabs/common/command_buffer.c
+++ b/drivers/misc/habanalabs/common/command_buffer.c
@@ -5,7 +5,7 @@ 
  * All Rights Reserved.
  */
 
-#include <uapi/misc/habanalabs.h>
+#include <uapi/drm/habanalabs_accel.h>
 #include "habanalabs.h"
 
 #include <linux/mm.h>
diff --git a/drivers/misc/habanalabs/common/command_submission.c b/drivers/misc/habanalabs/common/command_submission.c
index 1543ef993f8e..f6ee10334235 100644
--- a/drivers/misc/habanalabs/common/command_submission.c
+++ b/drivers/misc/habanalabs/common/command_submission.c
@@ -5,7 +5,7 @@ 
  * All Rights Reserved.
  */
 
-#include <uapi/misc/habanalabs.h>
+#include <uapi/drm/habanalabs_accel.h>
 #include "habanalabs.h"
 
 #include <linux/uaccess.h>
diff --git a/drivers/misc/habanalabs/common/device.c b/drivers/misc/habanalabs/common/device.c
index 71f958a2e91b..6620580e9ba8 100644
--- a/drivers/misc/habanalabs/common/device.c
+++ b/drivers/misc/habanalabs/common/device.c
@@ -7,7 +7,7 @@ 
 
 #define pr_fmt(fmt)			"habanalabs: " fmt
 
-#include <uapi/misc/habanalabs.h>
+#include <uapi/drm/habanalabs_accel.h>
 #include "habanalabs.h"
 
 #include <linux/pci.h>
diff --git a/drivers/misc/habanalabs/common/habanalabs.h b/drivers/misc/habanalabs/common/habanalabs.h
index c609b2e44ad3..7b6f10033ee9 100644
--- a/drivers/misc/habanalabs/common/habanalabs.h
+++ b/drivers/misc/habanalabs/common/habanalabs.h
@@ -11,7 +11,7 @@ 
 #include "../include/common/cpucp_if.h"
 #include "../include/common/qman_if.h"
 #include "../include/hw_ip/mmu/mmu_general.h"
-#include <uapi/misc/habanalabs.h>
+#include <uapi/drm/habanalabs_accel.h>
 
 #include <linux/cdev.h>
 #include <linux/iopoll.h>
diff --git a/drivers/misc/habanalabs/common/habanalabs_ioctl.c b/drivers/misc/habanalabs/common/habanalabs_ioctl.c
index 4d642987ad02..079483421e12 100644
--- a/drivers/misc/habanalabs/common/habanalabs_ioctl.c
+++ b/drivers/misc/habanalabs/common/habanalabs_ioctl.c
@@ -7,7 +7,7 @@ 
 
 #define pr_fmt(fmt)	"habanalabs: " fmt
 
-#include <uapi/misc/habanalabs.h>
+#include <uapi/drm/habanalabs_accel.h>
 #include "habanalabs.h"
 
 #include <linux/fs.h>
diff --git a/drivers/misc/habanalabs/common/memory.c b/drivers/misc/habanalabs/common/memory.c
index a2d24c9a3d1e..1c38fab39337 100644
--- a/drivers/misc/habanalabs/common/memory.c
+++ b/drivers/misc/habanalabs/common/memory.c
@@ -5,7 +5,7 @@ 
  * All Rights Reserved.
  */
 
-#include <uapi/misc/habanalabs.h>
+#include <uapi/drm/habanalabs_accel.h>
 #include "habanalabs.h"
 #include "../include/hw_ip/mmu/mmu_general.h"
 
diff --git a/drivers/misc/habanalabs/common/state_dump.c b/drivers/misc/habanalabs/common/state_dump.c
index 74726907c95e..3a9931f24259 100644
--- a/drivers/misc/habanalabs/common/state_dump.c
+++ b/drivers/misc/habanalabs/common/state_dump.c
@@ -6,7 +6,7 @@ 
  */
 
 #include <linux/vmalloc.h>
-#include <uapi/misc/habanalabs.h>
+#include <uapi/drm/habanalabs_accel.h>
 #include "habanalabs.h"
 
 /**
diff --git a/drivers/misc/habanalabs/gaudi/gaudiP.h b/drivers/misc/habanalabs/gaudi/gaudiP.h
index 4fbcf3f0afe5..3d88d56c8eb3 100644
--- a/drivers/misc/habanalabs/gaudi/gaudiP.h
+++ b/drivers/misc/habanalabs/gaudi/gaudiP.h
@@ -8,7 +8,7 @@ 
 #ifndef GAUDIP_H_
 #define GAUDIP_H_
 
-#include <uapi/misc/habanalabs.h>
+#include <uapi/drm/habanalabs_accel.h>
 #include "../common/habanalabs.h"
 #include "../include/common/hl_boot_if.h"
 #include "../include/gaudi/gaudi_packets.h"
diff --git a/drivers/misc/habanalabs/gaudi/gaudi_coresight.c b/drivers/misc/habanalabs/gaudi/gaudi_coresight.c
index 08108f5fed67..3455b14554c6 100644
--- a/drivers/misc/habanalabs/gaudi/gaudi_coresight.c
+++ b/drivers/misc/habanalabs/gaudi/gaudi_coresight.c
@@ -11,7 +11,8 @@ 
 #include "../include/gaudi/gaudi_masks.h"
 #include "../include/gaudi/gaudi_reg_map.h"
 
-#include <uapi/misc/habanalabs.h>
+#include <uapi/drm/habanalabs_accel.h>
+
 #define SPMU_SECTION_SIZE		MME0_ACC_SPMU_MAX_OFFSET
 #define SPMU_EVENT_TYPES_OFFSET		0x400
 #define SPMU_MAX_COUNTERS		6
diff --git a/drivers/misc/habanalabs/gaudi2/gaudi2P.h b/drivers/misc/habanalabs/gaudi2/gaudi2P.h
index b4383c199bbb..ed09864c2dfc 100644
--- a/drivers/misc/habanalabs/gaudi2/gaudi2P.h
+++ b/drivers/misc/habanalabs/gaudi2/gaudi2P.h
@@ -8,7 +8,7 @@ 
 #ifndef GAUDI2P_H_
 #define GAUDI2P_H_
 
-#include <uapi/misc/habanalabs.h>
+#include <uapi/drm/habanalabs_accel.h>
 #include "../common/habanalabs.h"
 #include "../include/common/hl_boot_if.h"
 #include "../include/gaudi2/gaudi2.h"
diff --git a/drivers/misc/habanalabs/gaudi2/gaudi2_coresight.c b/drivers/misc/habanalabs/gaudi2/gaudi2_coresight.c
index 1df7a59e4101..1dfbe293ecec 100644
--- a/drivers/misc/habanalabs/gaudi2/gaudi2_coresight.c
+++ b/drivers/misc/habanalabs/gaudi2/gaudi2_coresight.c
@@ -5,7 +5,7 @@ 
  * All Rights Reserved.
  */
 #include "gaudi2_coresight_regs.h"
-#include <uapi/misc/habanalabs.h>
+#include <uapi/drm/habanalabs_accel.h>
 
 #define GAUDI2_PLDM_CORESIGHT_TIMEOUT_USEC	(CORESIGHT_TIMEOUT_USEC * 2000)
 #define SPMU_MAX_COUNTERS			6
diff --git a/drivers/misc/habanalabs/goya/goyaP.h b/drivers/misc/habanalabs/goya/goyaP.h
index d6ec43d6f6b0..5df3d30b91fd 100644
--- a/drivers/misc/habanalabs/goya/goyaP.h
+++ b/drivers/misc/habanalabs/goya/goyaP.h
@@ -8,7 +8,7 @@ 
 #ifndef GOYAP_H_
 #define GOYAP_H_
 
-#include <uapi/misc/habanalabs.h>
+#include <uapi/drm/habanalabs_accel.h>
 #include "../common/habanalabs.h"
 #include "../include/common/hl_boot_if.h"
 #include "../include/goya/goya_packets.h"
diff --git a/drivers/misc/habanalabs/goya/goya_coresight.c b/drivers/misc/habanalabs/goya/goya_coresight.c
index 2c5133cfae65..e7ac3046cfaa 100644
--- a/drivers/misc/habanalabs/goya/goya_coresight.c
+++ b/drivers/misc/habanalabs/goya/goya_coresight.c
@@ -10,7 +10,7 @@ 
 #include "../include/goya/asic_reg/goya_regs.h"
 #include "../include/goya/asic_reg/goya_masks.h"
 
-#include <uapi/misc/habanalabs.h>
+#include <uapi/drm/habanalabs_accel.h>
 
 #define GOYA_PLDM_CORESIGHT_TIMEOUT_USEC	(CORESIGHT_TIMEOUT_USEC * 100)
 
diff --git a/include/uapi/misc/habanalabs.h b/include/uapi/drm/habanalabs_accel.h
similarity index 100%
rename from include/uapi/misc/habanalabs.h
rename to include/uapi/drm/habanalabs_accel.h