Hi,

I noticed the following when trying to do some benchmarking for the padlock 
engine on a VIA Eden CPU using the "openssl speed" command on -current (as of 6 
Sept) amd64:

 - machdep.xcrypt=0 (should be 15; like i386 port)
 - no hw.sensors.cpu?.temp (shows up on i386 port)
 - "openssl speed ... -evp aes-256-cbc" ~ 35MB/s max.
   (over 415MB/s on i386 port)

I have seen an external link 
(http://www.capnfreedom.com/home/viac7padlockaesbenchmarks) which suggests 
OpenBSD supports PadLock, so after a rather exhaustive search for relevant CVS 
commits which suggest changes for VIA CPUs. Last one I could find was this:

==========
CVSROOT:        /cvs
Module name:    src
Changes by:     deraadt@XXXXXXXXXXXXXXX 2009/07/22 14:33:13

Modified files:
        sys/arch/amd64/amd64: identcpu.c machdep.c 
        sys/arch/amd64/include: cpu.h 

Log message:
via nano cpus are amd64, and so we need machdep.xcrypt 
==========

Searched the relevant files, and found a single line (Line 571 of 
sys/arch/amd64/amd64/identcpu.c) to be the culprit.

================ BEGIN DIFF ====================
--- sys/arch/amd64/amd64/identcpu.c     24 Aug 2013 23:45:31 -0000      1.50
+++ sys/arch/amd64/amd64/identcpu.c     6 Sep 2013 05:42:56 -0000
@@ -568,7 +568,7 @@ identifycpu(struct cpu_info *ci)
        if (!strcmp(cpu_vendor, "AuthenticAMD"))
                amd64_errata(ci);

-       if (strncmp(mycpu_model, "VIA Nano processor", 18) == 0) {
+       if (!strcmp(cpu_vendor, "CentaurHauls")) {
                ci->cpu_setup = via_nano_setup;
 #ifndef SMALL_KERNEL
                strlcpy(ci->ci_sensordev.xname, ci->ci_dev->dv_xname,
================== END DIFF ===================

This fix will correct feature recognition and support for VIA Eden and like 
CPUs.

The result after applying this fix:

$ openssl speed -engine cryptodev -evp aes-256-cbc
engine "cryptodev" set.
Doing aes-256-cbc for 3s on 16 size blocks: 4825080 aes-256-cbc's in 3.01s
Doing aes-256-cbc for 3s on 64 size blocks: 4360645 aes-256-cbc's in 3.01s
Doing aes-256-cbc for 3s on 256 size blocks: 2704061 aes-256-cbc's in 3.01s
Doing aes-256-cbc for 3s on 1024 size blocks: 1066366 aes-256-cbc's in 3.01s
Doing aes-256-cbc for 3s on 8192 size blocks: 161747 aes-256-cbc's in 3.01s
OpenSSL 1.0.1c 10 May 2012
built on: date not available
options:bn(64,64) rc4(8x,int) des(idx,cisc,16,int) aes(partial) idea(int) 
blowfish(idx)
compiler: information not available
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
aes-256-cbc      25648.27k    92718.03k   229979.94k   362777.00k   440209.78k

$ sysctl machdep
machdep.console_device=ttyC0
machdep.bios.diskinfo.128=bootdev = 0xa0000200, cylinders = 1024, heads = 255, 
sectors = 63
machdep.bios.cksumlen=1
machdep.allowaperture=2
machdep.cpuvendor=CentaurHauls
machdep.cpuid=1788
machdep.cpufeature=-1076233217
machdep.kbdreset=0
machdep.xcrypt=15
machdep.lidsuspend=0

$ sysctl hw.sensors
hw.sensors.cpu0.temp0=44.00 degC
hw.sensors.acpiac0.indicator0=On (power supply)

$ dmesg
OpenBSD 5.4-current (GENERIC) #1: Fri Sep  6 06:20:50 UTC 2013
    r...@m2.my.domain:/usr/src/sys/arch/amd64/compile/GENERIC
real mem = 4009426944 (3823MB)
avail mem = 3894644736 (3714MB)
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.6 @ 0x9f400 (45 entries)
bios0: vendor VIA technology Inc. version "410 AMI R102" date 04/03/2012
bios0: VIA technology Inc. VT3410 H3100MB
acpi0 at bios0: rev 2
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP APIC MCFG WDRT OEMB HPET
acpi0: wakeup devices NBP0(S4) NP0S(S4) NBP1(S4) NP1S(S4) NBP2(S4) NP2S(S4) 
NBP3(S4) NP3S(S4) USB0(S3) USB1(S3) USB2(S3) USB3(S3) EHCI(S3) SBRG(S5) 
PS2K(S4) PS2M(S4) [...]
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: VIA Eden X2 U4200 @ 1.0+ GHz, 1000.17 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,MWAIT,VMX,EST,TM2,SSSE3,CX16,xTPR,SSE4.1,POPCNT,NXE,LONG,LAHF,PERF
cpu0: 64KB 64b/line 16-way I-cache, 64KB 64b/line 16-way D-cache, 1MB 64b/line 
16-way L2 cache
cpu0: ITLB 128 4KB entries 8-way
cpu0: DTLB 128 4KB entries 8-way
cpu0: RNG AES AES-CTR SHA1 SHA256 RSA
cpu0: apic clock running at 200MHz
cpu at mainbus0: not configured
ioapic0 at mainbus0: apid 3 pa 0xfec00000, version 3, 24 pins
ioapic0: misconfigured as apic 1, remapped to apid 3
ioapic1 at mainbus0: apid 4 pa 0xfecc0000, version 3, 24 pins
ioapic1: misconfigured as apic 3, remapped to apid 4
acpimcfg0 at acpi0 addr 0xe0000000, bus 0-255
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (NBP0)
acpiprt2 at acpi0: bus 2 (NBP1)
acpiprt3 at acpi0: bus 3 (NBP2)
acpiprt4 at acpi0: bus 5 (NBP3)
acpiprt5 at acpi0: bus 6 (P0P4)
acpicpu0 at acpi0
acpiac0 at acpi0: AC unit online
acpibtn0 at acpi0: SLPB
acpibtn1 at acpi0: PWRB
cpu0: unknown Enhanced SpeedStep CPU, msr 0x08480a4c08000a4d
cpu0: using only highest, current and lowest power states
cpu0: Enhanced SpeedStep 1000 MHz: speeds: 2000, 2000, 1600 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 vendor "VIA", unknown product 0x0410 rev 0x80
pchb1 at pci0 dev 0 function 1 vendor "VIA", unknown product 0x1410 rev 0x00
pchb2 at pci0 dev 0 function 2 vendor "VIA", unknown product 0x2410 rev 0x00
pchb3 at pci0 dev 0 function 3 vendor "VIA", unknown product 0x3410 rev 0x00
pchb4 at pci0 dev 0 function 4 vendor "VIA", unknown product 0x4410 rev 0x00
pchb5 at pci0 dev 0 function 5 vendor "VIA", unknown product 0x5410 rev 0x00
pchb6 at pci0 dev 0 function 6 vendor "VIA", unknown product 0x6410 rev 0x00
pchb7 at pci0 dev 0 function 7 vendor "VIA", unknown product 0x7410 rev 0x00
vga1 at pci0 dev 1 function 0 vendor "VIA", unknown product 0x7122 rev 0x00
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
azalia0 at pci0 dev 1 function 1 vendor "VIA", unknown product 0x9170 rev 0x00: 
apic 4 int 17
azalia0: no supported codecs
ppb0 at pci0 dev 3 function 0 vendor "VIA", unknown product 0xa410 rev 0x00: 
apic 4 int 3
pci1 at ppb0 bus 1
ppb1 at pci0 dev 3 function 1 vendor "VIA", unknown product 0xb410 rev 0x00: 
apic 4 int 7
pci2 at ppb1 bus 2
ppb2 at pci0 dev 3 function 2 vendor "VIA", unknown product 0xc410 rev 0x00: 
apic 4 int 11
pci3 at ppb2 bus 3
ppb3 at pci0 dev 3 function 3 vendor "VIA", unknown product 0xd410 rev 0x00: 
apic 4 int 15
pci4 at ppb3 bus 5
vge0 at pci4 dev 0 function 0 "VIA VT612x" rev 0x82: apic 4 int 12, address 
00:1f:f2:08:a0:d6
ipgphy0 at vge0 phy 22: IP1001 10/100/1000 PHY, rev. 0
pchb8 at pci0 dev 3 function 4 vendor "VIA", unknown product 0xe410 rev 0x00
pciide0 at pci0 dev 15 function 0 "VIA VX900 IDE" rev 0x00: ATA133, channel 0 
configured to native-PCI, channel 1 configured to native-PCI
pciide0: using apic 3 int 21 for native-PCI interrupt
wd0 at pciide0 channel 0 drive 0: <HITACHI HTS725032A9A364>
wd0: 16-sector PIO, LBA48, 305245MB, 625142448 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5
pciide0: channel 1 disabled (no drives)
uhci0 at pci0 dev 16 function 0 "VIA VT83C572 USB" rev 0xa0: apic 3 int 20
uhci1 at pci0 dev 16 function 1 "VIA VT83C572 USB" rev 0xa0: apic 3 int 22
uhci2 at pci0 dev 16 function 2 "VIA VT83C572 USB" rev 0xa0: apic 3 int 21
uhci3 at pci0 dev 16 function 3 "VIA VT83C572 USB" rev 0xa0: apic 3 int 23
ehci0 at pci0 dev 16 function 4 "VIA VT6202 USB" rev 0x90: apic 3 int 23
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "VIA EHCI root hub" rev 2.00/1.00 addr 1
pcib0 at pci0 dev 17 function 0 vendor "VIA", unknown product 0x8410 rev 0x00
pchb9 at pci0 dev 17 function 7 "VIA VX800 Host" rev 0x00
ppb4 at pci0 dev 19 function 0 "VIA VX800" rev 0x00
pci5 at ppb4 bus 6
azalia1 at pci0 dev 20 function 0 "VIA HD Audio" rev 0x20: apic 3 int 17
azalia1: codecs: VIA/0x0441
audio0 at azalia1
usb1 at uhci0: USB revision 1.0
uhub1 at usb1 "VIA UHCI root hub" rev 1.00/1.00 addr 1
usb2 at uhci1: USB revision 1.0
uhub2 at usb2 "VIA UHCI root hub" rev 1.00/1.00 addr 1
usb3 at uhci2: USB revision 1.0
uhub3 at usb3 "VIA UHCI root hub" rev 1.00/1.00 addr 1
usb4 at uhci3: USB revision 1.0
uhub4 at usb4 "VIA UHCI root hub" rev 1.00/1.00 addr 1
isa0 at pcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com0: probed fifo depth: 15 bytes
com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
com1: probed fifo depth: 15 bytes
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
lpt0 at isa0 port 0x378/4 irq 7
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
fd0 at fdc0 drive 0: density unknown
fd1 at fdc0 drive 1: density unknown
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
umass0 at uhub0 port 6 configuration 1 interface 0 "Sunplus Innovation 
Technology USB to Serial-ATA bridge" rev 2.00/1.19 addr 2
umass0: using SCSI over Bulk-Only
scsibus0 at umass0: 2 targets, initiator 0
cd0 at scsibus0 targ 1 lun 0: <MATSHITA, DVD-RAM UJ8D1, 1.00> SCSI0 5/cdrom 
removable serial.1bcf0c310DFFD0224633
uhidev0 at uhub3 port 1 configuration 1 interface 0 " USB Keyboard" rev 
1.10/1.01 addr 2
uhidev0: iclass 3/1
ukbd0 at uhidev0: 8 variable keys, 6 key codes
wskbd1 at ukbd0 mux 1
wskbd1: connecting to wsdisplay0
uhidev1 at uhub3 port 1 configuration 1 interface 1 " USB Keyboard" rev 
1.10/1.01 addr 2
uhidev1: iclass 3/0, 2 report ids
uhid0 at uhidev1 reportid 1: input=1, output=0, feature=0
uhid1 at uhidev1 reportid 2: input=3, output=0, feature=0
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
scsibus2 at softraid0: 256 targets
root on wd0a (833c5e91667f9ce8.a) swap on wd0b dump on wd0b


(works well on GENERIC.MP as well)

Alert me if there are any issues with this patch, and I'll see if I can fix it 
up.

Reply via email to