Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: VIA Padlock on AMD64



I created a patch to show the intention. It builds and "padlock"
attaches to the CPU. On another hand, I failed to find any application
which would be taking advantage of padlock (including i386). Neither
openssl (tried speed tests), nor openssh (some commands I found in
internet)  showed any difference with padlock module or without it.
Maybe some patching is needed but it seems hardware acceleration is
ignored with these apps. If somebody know a good way to test it on
NetBSD, I would be glad to hear it.

On the side note, same goes to viadrmums module (it's i386 only now)
but at least on VX900 I ended up with the crash, so I guess it may be
incompatible with amd64 (though it builds successfully). Will try to
test VX800 later on.

diff --git a/distrib/sets/lists/modules/md.amd64
b/distrib/sets/lists/modules/md.amd64
index 1ab3209f278..bd4752d4a53 100644
--- a/distrib/sets/lists/modules/md.amd64
+++ b/distrib/sets/lists/modules/md.amd64
@@ -193,6 +193,8 @@
 ./@MODULEDIR@/odcm/odcm.kmod                   modules-base-kernel     kmod
 ./@MODULEDIR@/pad                              modules-base-kernel     kmod
 ./@MODULEDIR@/pad/pad.kmod                     modules-base-kernel     kmod
+./@MODULEDIR@/padlock                          modules-base-kernel     kmod
+./@MODULEDIR@/padlock/padlock.kmod             modules-base-kernel     kmod
 ./@MODULEDIR@/powernow                         modules-base-kernel     kmod
 ./@MODULEDIR@/powernow/powernow.kmod           modules-base-kernel     kmod
 ./@MODULEDIR@/pwdog                            modules-base-kernel     kmod
diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC
index 44a0d35b400..c556feb5618 100644
--- a/sys/arch/amd64/conf/GENERIC
+++ b/sys/arch/amd64/conf/GENERIC
@@ -86,6 +86,7 @@ coretemp*     at cpu?         # Intel on-die thermal sensor
 est0           at cpu0         # Intel Enhanced SpeedStep (non-ACPI)
 hyperv0        at cpu0         # Microsoft Hyper-V
 #odcm0         at cpu0         # On-demand clock modulation
+padlock0               at cpu0         # VIA Padlock
 powernow0      at cpu0         # AMD PowerNow! and Cool'n'Quiet (non-ACPI)
 vmt0           at cpu0         # VMware Tools

diff --git a/sys/arch/x86/x86/via_padlock.c b/sys/arch/x86/x86/via_padlock.c
index f23f891a642..e9d5f812f17 100644
--- a/sys/arch/x86/x86/via_padlock.c
+++ b/sys/arch/x86/x86/via_padlock.c
@@ -341,7 +341,7 @@ via_padlock_cbc(void *cw, void *src, void *dst,
void *key, int rep,
        lcr0(cr0 & ~(CR0_EM|CR0_TS));

        /* Do the deed */
-       __asm __volatile("pushfl; popfl");      /* force key reload */
+       __asm __volatile("pushf; popf");        /* force key reload */
        __asm __volatile(".byte 0xf3, 0x0f, 0xa7, 0xd0" : /* rep xcrypt-cbc */
                        : "a" (iv), "b" (key), "c" (rep), "d" (cw),
"S" (src), "D" (dst)
                        : "memory", "cc");

diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 4a29a4a23cd..3595b37f246 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -321,7 +321,6 @@ SUBDIR+=    compat_freebsd
 SUBDIR+=       mach64drm
 SUBDIR+=       mgadrm
 SUBDIR+=       nsclpcsio
-SUBDIR+=       padlock
 SUBDIR+=       r128drm
 SUBDIR+=       radeondrm
 SUBDIR+=       savagedrm
@@ -342,6 +341,7 @@ SUBDIR+=    drmkms_pci
 SUBDIR+=       i915drm
 SUBDIR+=       i915drmkms
 SUBDIR+=       pad
+SUBDIR+=       padlock
 #
 # ISA modules
 #

On Tue, Mar 24, 2020 at 10:57 AM Andrius V <vezhlys%gmail.com@localhost> wrote:
>
> Hi,
>
> I accidentally noticed that padlock engine is not included on AMD64
> port (neither as module or built-in). Is there any reason it excluded
> from it? The build currently fails because inline asm code is using
> pushl, popl instructions in the code in via_padlock_cbc method, but
> replacing them with pushf, popf seemingly fixes the build and padlock
> attaches. Since VIA has x86-64 based CPUs and all of them has the
> engine, probably it makes sense to include it?
>
> Regards,
> Andrius V


Home | Main Index | Thread Index | Old Index